Class: Numo::SComplex
Defined Under Namespace
Modules: Math
Constant Summary
- UPCAST =
hCast
- ELEMENT_BIT_SIZE =
INT2FIX(sizeof(dtype)*8)
- ELEMENT_BYTE_SIZE =
INT2FIX(sizeof(dtype))
- CONTIGUOUS_STRIDE =
INT2FIX(sizeof(dtype))
- EPSILON =
M_EPSILON
- MAX =
M_MAX
- MIN =
M_MIN
Constants inherited from NArray
Class Method Summary collapse
-
.[](obj) ⇒ Numo::SComplex
Cast object to Numo::SComplex.
-
.cast(obj) ⇒ Numo::SComplex
Cast object to Numo::SComplex.
Instance Method Summary collapse
-
#*(other) ⇒ Numo::NArray
Binary mul.
-
#**(other) ⇒ Numo::NArray
Binary power.
-
#+(other) ⇒ Numo::NArray
Binary add.
-
#-(other) ⇒ Numo::NArray
Binary sub.
-
#-@ ⇒ Numo::SComplex
Unary minus.
-
#/(other) ⇒ Numo::NArray
Binary div.
-
#[](dim0, ..., dimL) ⇒ Numeric, NArray::SComplex
Array element referenece or slice view.
-
#[]=(dim0, .., dimL, val) ⇒ Numeric
Array element(s) set.
-
#abs ⇒ Numo::SFloat
abs of self.
-
#allocate ⇒ Object
-
#arg ⇒ Numo::SFloat
(also: #angle)
arg of self.
-
#ceil ⇒ Numo::SComplex
Unary ceil.
-
#coerce_cast(type) ⇒ nil
return NArray with cast to the type of self.
-
#conj ⇒ Numo::SComplex
(also: #conjugate)
Unary conj.
-
#copysign(other) ⇒ Numo::NArray
Binary copysign.
-
#cumprod(axis: nil, nan: false) ⇒ Numo::SComplex
cumprod of self.
-
#cumsum(axis: nil, nan: false) ⇒ Numo::SComplex
cumsum of self.
-
#each ⇒ Numo::NArray
Calls the given block once for each element in self, passing that element as a parameter.
-
#each_with_index ⇒ Numo::NArray
Invokes the given block once for each element of self, passing that element and indices along each axis as parameters.
-
#eq(other) ⇒ Numo::Bit
Comparison eq other.
-
#extract ⇒ Numeric, Numo::NArray
Extract an element only if self is a dimensionless NArray.
-
#eye([element,offset]) ⇒ Numo::SComplex
Eye: Set a value to diagonal components, set 0 to non-diagonal components.
-
#fill(other) ⇒ Numo::SComplex
Fill elements with other.
-
#floor ⇒ Numo::SComplex
Unary floor.
-
#format(format) ⇒ Numo::RObject
Format elements into strings.
-
#format_to_a(format) ⇒ Array
Format elements into strings.
-
#im ⇒ Numo::SComplex
Unary im.
-
#imag ⇒ Numo::SFloat
imag of self.
-
#inspect ⇒ String
Returns a string containing a human-readable representation of NArray.
-
#isfinite ⇒ Numo::Bit
Condition of isfinite.
-
#isinf ⇒ Numo::Bit
Condition of isinf.
-
#isnan ⇒ Numo::Bit
Condition of isnan.
-
#isneginf ⇒ Numo::Bit
Condition of isneginf.
-
#isposinf ⇒ Numo::Bit
Condition of isposinf.
-
#logseq(beg, step, [base]) ⇒ Numo::SComplex
Set logarithmic sequence of numbers to self.
-
#map ⇒ Numo::SComplex
Unary map.
-
#map_with_index ⇒ Numo::NArray
Invokes the given block once for each element of self, passing that element and indices along each axis as parameters.
-
#mean(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
mean of self.
-
#mulsum(other, axis: nil, keepdims: false, nan: false) ⇒ Numo::NArray
Binary mulsum.
-
#ne(other) ⇒ Numo::Bit
Comparison ne other.
-
#nearly_eq(other) ⇒ Numo::Bit
(also: #close_to)
Comparison nearly_eq other.
-
#poly(a0, a1, ...) ⇒ Numo::SComplex
Polynomial.: a0 + a1x + a2x2 + a3*x3 + …
-
#prod(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
prod of self.
-
#rand([[low],high]) ⇒ Numo::SComplex
Generate uniformly distributed random numbers on self narray.
-
#rand_norm([mu,[sigma]]) ⇒ Numo::SComplex
Generates random numbers from the normal distribution on self narray using Box-Muller Transformation.
-
#real ⇒ Numo::SFloat
real of self.
-
#reciprocal ⇒ Numo::SComplex
Unary reciprocal.
-
#rint ⇒ Numo::SComplex
Unary rint.
-
#rms(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
rms of self.
-
#round ⇒ Numo::SComplex
Unary round.
-
#seq([beg,[step]]) ⇒ Numo::SComplex
(also: #indgen)
Set linear sequence of numbers to self.
-
#set_imag(a1) ⇒ Object
(also: #imag=)
-
#set_real(a1) ⇒ Object
(also: #real=)
-
#sign ⇒ Numo::SComplex
Unary sign.
-
#square ⇒ Numo::SComplex
Unary square.
-
#stddev(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
stddev of self.
-
#store(other) ⇒ Numo::SComplex
Store elements to Numo::SComplex from other.
-
#sum(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
sum of self.
-
#to_a ⇒ Array
Convert self to Array.
-
#trunc ⇒ Numo::SComplex
Unary trunc.
-
#var(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
var of self.
Methods inherited from NArray
#==, #append, array_type, asarray, #at, byte_size, #byte_size, #byte_swapped?, #cast_to, #coerce, #column_major?, column_stack, concatenate, #concatenate, #contiguous?, #cov, debug=, #debug_info, #deg2rad, #delete, #diag, #diag_indices, diag_indices, #diagonal, #diff, #dot, #dsplit, dstack, #empty?, #expand_dims, eye, #flatten, #fliplr, #flipud, from_binary, #host_order?, #hsplit, hstack, #initialize, #initialize_copy, #inner, #inplace, #inplace!, #inplace?, #insert, inspect_cols, inspect_cols=, inspect_rows, inspect_rows=, #kron, linspace, logspace, #marshal_dump, #marshal_load, #ndim, #new_fill, new_like, #new_narray, #new_ones, #new_zeros, ones, #out_of_place!, #outer, parse, profile, profile=, #rad2deg, #repeat, #reshape, #reshape!, #reverse, #rot90, #row_major?, #shape, #size, #split, srand, #store_binary, #swap_byte, #swapaxes, #tile, #to_binary, #to_c, #to_f, #to_host, #to_i, #to_network, #to_swapped, #to_vacs, #trace, #transpose, #tril, #tril!, #tril_indices, tril_indices, #triu, #triu!, #triu_indices, triu_indices, upcast, #view, #vsplit, vstack, zeros
Constructor Details
This class inherits a constructor from Numo::NArray
Class Method Details
.[](elements) ⇒ Numo::SComplex .cast(array) ⇒ Numo::SComplex
Cast object to Numo::SComplex.
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 |
# File 'ext/numo/narray/types/scomplex.c', line 1394
static VALUE
scomplex_s_cast(VALUE type, VALUE obj)
{
VALUE v;
narray_t *na;
dtype x;
if (CLASS_OF(obj)==cT) {
return obj;
}
if (RTEST(rb_obj_is_kind_of(obj,rb_cNumeric))) {
x = m_num_to_data(obj);
return scomplex_new_dim0(x);
}
if (RTEST(rb_obj_is_kind_of(obj,rb_cArray))) {
return scomplex_cast_array(obj);
}
if (IsNArray(obj)) {
GetNArray(obj,na);
v = nary_new(cT, NA_NDIM(na), NA_SHAPE(na));
if (NA_SIZE(na) > 0) {
scomplex_store(v,obj);
}
return v;
}
#line 41 "gen/tmpl/cast.c"
rb_raise(nary_eCastError,"cannot cast to %s",rb_class2name(type));
return Qnil;
}
|
.[](elements) ⇒ Numo::SComplex .cast(array) ⇒ Numo::SComplex
Cast object to Numo::SComplex.
1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 |
# File 'ext/numo/narray/types/scomplex.c', line 1394
static VALUE
scomplex_s_cast(VALUE type, VALUE obj)
{
VALUE v;
narray_t *na;
dtype x;
if (CLASS_OF(obj)==cT) {
return obj;
}
if (RTEST(rb_obj_is_kind_of(obj,rb_cNumeric))) {
x = m_num_to_data(obj);
return scomplex_new_dim0(x);
}
if (RTEST(rb_obj_is_kind_of(obj,rb_cArray))) {
return scomplex_cast_array(obj);
}
if (IsNArray(obj)) {
GetNArray(obj,na);
v = nary_new(cT, NA_NDIM(na), NA_SHAPE(na));
if (NA_SIZE(na) > 0) {
scomplex_store(v,obj);
}
return v;
}
#line 41 "gen/tmpl/cast.c"
rb_raise(nary_eCastError,"cannot cast to %s",rb_class2name(type));
return Qnil;
}
|
Instance Method Details
#*(other) ⇒ Numo::NArray
Binary mul.
2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 |
# File 'ext/numo/narray/types/scomplex.c', line 2399
static VALUE
scomplex_mul(VALUE self, VALUE other)
{
#line 87 "gen/tmpl/binary.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_mul_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, '*', 1, other);
}
}
|
#**(other) ⇒ Numo::NArray
Binary power.
2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 |
# File 'ext/numo/narray/types/scomplex.c', line 2573
static VALUE
scomplex_pow(VALUE self, VALUE other)
{
#line 69 "gen/tmpl/pow.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_pow_self(self,other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, id_pow, 1, other);
}
}
|
#+(other) ⇒ Numo::NArray
Binary add.
2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 |
# File 'ext/numo/narray/types/scomplex.c', line 2213
static VALUE
scomplex_add(VALUE self, VALUE other)
{
#line 87 "gen/tmpl/binary.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_add_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, '+', 1, other);
}
}
|
#-(other) ⇒ Numo::NArray
Binary sub.
2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 |
# File 'ext/numo/narray/types/scomplex.c', line 2306
static VALUE
scomplex_sub(VALUE self, VALUE other)
{
#line 87 "gen/tmpl/binary.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_sub_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, '-', 1, other);
}
}
|
#-@ ⇒ Numo::SComplex
Unary minus.
2663 2664 2665 2666 2667 2668 2669 2670 2671 |
# File 'ext/numo/narray/types/scomplex.c', line 2663
static VALUE
scomplex_minus(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_minus, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#/(other) ⇒ Numo::NArray
Binary div.
2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 |
# File 'ext/numo/narray/types/scomplex.c', line 2492
static VALUE
scomplex_div(VALUE self, VALUE other)
{
#line 87 "gen/tmpl/binary.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_div_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, '/', 1, other);
}
}
|
#[](dim0, ..., dimL) ⇒ Numeric, NArray::SComplex
Array element referenece or slice view. — Returns the element at +dim0+, +dim1+, … are Numeric indices for each dimension, or returns a NArray View as a sliced subarray if +dim0+, +dim1+, … includes other than Numeric index, e.g., Range or Array or true.
1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 |
# File 'ext/numo/narray/types/scomplex.c', line 1466
static VALUE
scomplex_aref(int argc, VALUE *argv, VALUE self)
{
int nd;
size_t pos;
char *ptr;
nd = na_get_result_dimension(self, argc, argv, sizeof(dtype), &pos);
if (nd) {
return na_aref_main(argc, argv, self, 0, nd);
} else {
ptr = na_get_pointer_for_read(self) + pos;
return m_extract(ptr);
}
}
|
#[]=(dim0, .., dimL, val) ⇒ Numeric
Array element(s) set. — Replace element(s) at +dim0+, +dim1+, … (index/range/array/true for each dimention). Broadcasting mechanism is applied.
1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 |
# File 'ext/numo/narray/types/scomplex.c', line 1523
static VALUE
scomplex_aset(int argc, VALUE *argv, VALUE self)
{
int nd;
size_t pos;
char *ptr;
VALUE a;
dtype x;
argc--;
if (argc==0) {
scomplex_store(self, argv[argc]);
} else {
nd = na_get_result_dimension(self, argc, argv, sizeof(dtype), &pos);
if (nd) {
a = na_aref_main(argc, argv, self, 0, nd);
scomplex_store(a, argv[argc]);
} else {
x = scomplex_extract_data(argv[argc]);
ptr = na_get_pointer_for_read_write(self) + pos;
*(dtype*)ptr = x;
}
}
return argv[argc];
}
|
#abs ⇒ Numo::SFloat
abs of self.
2127 2128 2129 2130 2131 2132 2133 2134 2135 |
# File 'ext/numo/narray/types/scomplex.c', line 2127
static VALUE
scomplex_abs(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_scomplex_abs, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#allocate ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'ext/numo/narray/types/scomplex.c', line 135
static VALUE
scomplex_allocate(VALUE self)
{
narray_t *na;
char *ptr;
GetNArray(self,na);
switch(NA_TYPE(na)) {
case NARRAY_DATA_T:
ptr = NA_DATA_PTR(na);
if (na->size > 0 && ptr == NULL) {
ptr = xmalloc(sizeof(dtype) * na->size);
#line 22 "gen/tmpl/allocate.c"
NA_DATA_PTR(na) = ptr;
}
break;
case NARRAY_VIEW_T:
rb_funcall(NA_VIEW_DATA(na), rb_intern("allocate"), 0);
break;
case NARRAY_FILEMAP_T:
//ptr = ((narray_filemap_t*)na)->ptr;
// to be implemented
default:
rb_bug("invalid narray type : %d",NA_TYPE(na));
}
return self;
}
|
#arg ⇒ Numo::SFloat Also known as: angle
arg of self.
3266 3267 3268 3269 3270 3271 3272 3273 3274 |
# File 'ext/numo/narray/types/scomplex.c', line 3266
static VALUE
scomplex_arg(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_scomplex_arg, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#ceil ⇒ Numo::SComplex
Unary ceil.
3812 3813 3814 3815 3816 3817 3818 3819 3820 |
# File 'ext/numo/narray/types/scomplex.c', line 3812
static VALUE
scomplex_ceil(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_ceil, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#coerce_cast(type) ⇒ nil
return NArray with cast to the type of self.
1557 1558 1559 1560 1561 |
# File 'ext/numo/narray/types/scomplex.c', line 1557
static VALUE
scomplex_coerce_cast(VALUE self, VALUE type)
{
return Qnil;
}
|
#conj ⇒ Numo::SComplex Also known as: conjugate
Unary conj.
2999 3000 3001 3002 3003 3004 3005 3006 3007 |
# File 'ext/numo/narray/types/scomplex.c', line 2999
static VALUE
scomplex_conj(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_conj, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#copysign(other) ⇒ Numo::NArray
Binary copysign.
4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 |
# File 'ext/numo/narray/types/scomplex.c', line 4066
static VALUE
scomplex_copysign(VALUE self, VALUE other)
{
#line 87 "gen/tmpl/binary.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_copysign_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, id_copysign, 1, other);
}
}
|
#cumprod(axis: nil, nan: false) ⇒ Numo::SComplex
cumprod of self.
4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 |
# File 'ext/numo/narray/types/scomplex.c', line 4811
static VALUE
scomplex_cumprod(int argc, VALUE *argv, VALUE self)
{
VALUE reduce;
ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = { iter_scomplex_cumprod, STRIDE_LOOP|NDF_FLAT_REDUCE|NDF_CUM,
2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_cumprod_nan);
#line 48 "gen/tmpl/cum.c"
return na_ndloop(&ndf, 2, self, reduce);
}
|
#cumsum(axis: nil, nan: false) ⇒ Numo::SComplex
cumsum of self.
4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 |
# File 'ext/numo/narray/types/scomplex.c', line 4736
static VALUE
scomplex_cumsum(int argc, VALUE *argv, VALUE self)
{
VALUE reduce;
ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = { iter_scomplex_cumsum, STRIDE_LOOP|NDF_FLAT_REDUCE|NDF_CUM,
2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_cumsum_nan);
#line 48 "gen/tmpl/cum.c"
return na_ndloop(&ndf, 2, self, reduce);
}
|
#each ⇒ Numo::NArray
Calls the given block once for each element in self, passing that element as a parameter. For a block {|x| … }
1818 1819 1820 1821 1822 1823 1824 1825 1826 |
# File 'ext/numo/narray/types/scomplex.c', line 1818
static VALUE
scomplex_each(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{Qnil,0}};
ndfunc_t ndf = {iter_scomplex_each, FULL_LOOP_NIP, 1,0, ain,0};
na_ndloop(&ndf, 1, self);
return self;
}
|
#each_with_index ⇒ Numo::NArray
Invokes the given block once for each element of self, passing that element and indices along each axis as parameters. For a block {|x,i,j,…| … }
1969 1970 1971 1972 1973 1974 1975 1976 1977 |
# File 'ext/numo/narray/types/scomplex.c', line 1969
static VALUE
scomplex_each_with_index(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{Qnil,0}};
ndfunc_t ndf = {iter_scomplex_each_with_index, FULL_LOOP_NIP, 1,0, ain,0};
na_ndloop_with_index(&ndf, 1, self);
return self;
}
|
#eq(other) ⇒ Numo::Bit
Comparison eq other.
3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 |
# File 'ext/numo/narray/types/scomplex.c', line 3439
static VALUE
scomplex_eq(VALUE self, VALUE other)
{
#line 46 "gen/tmpl/cond_binary.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_eq_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, id_eq, 1, other);
}
}
|
#extract ⇒ Numeric, Numo::NArray
Extract an element only if self is a dimensionless NArray. — Extract element value as Ruby Object if self is a dimensionless NArray, otherwise returns self.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'ext/numo/narray/types/scomplex.c', line 174
static VALUE
scomplex_extract(VALUE self)
{
volatile VALUE v;
char *ptr;
narray_t *na;
GetNArray(self,na);
if (na->ndim==0) {
ptr = na_get_pointer_for_read(self) + na_get_offset(self);
v = m_extract(ptr);
na_release_lock(self);
return v;
}
return self;
}
|
#eye([element,offset]) ⇒ Numo::SComplex
Eye: Set a value to diagonal components, set 0 to non-diagonal components.
5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 |
# File 'ext/numo/narray/types/scomplex.c', line 5173
static VALUE
scomplex_eye(int argc, VALUE *argv, VALUE self)
{
ndfunc_arg_in_t ain[1] = {{OVERWRITE,2}};
ndfunc_t ndf = {iter_scomplex_eye, NO_LOOP, 1,0, ain,0};
ssize_t kofs;
dtype data;
char *g;
int nd;
narray_t *na;
// check arguments
if (argc > 2) {
rb_raise(rb_eArgError,"too many arguments (%d for 0..2)",argc);
} else if (argc == 2) {
data = m_num_to_data(argv[0]);
kofs = NUM2SSIZET(argv[1]);
} else if (argc == 1) {
data = m_num_to_data(argv[0]);
kofs = 0;
} else {
data = m_one;
kofs = 0;
}
GetNArray(self,na);
nd = na->ndim;
if (nd < 2) {
rb_raise(nary_eDimensionError,"less than 2-d array");
}
// Diagonal offset from the main diagonal.
if (kofs >= 0) {
if ((size_t)(kofs) >= na->shape[nd-1]) {
rb_raise(rb_eArgError,"invalid diagonal offset(%"SZF"d) for "
"last dimension size(%"SZF"d)",kofs,na->shape[nd-1]);
}
} else {
if ((size_t)(-kofs) >= na->shape[nd-2]) {
rb_raise(rb_eArgError,"invalid diagonal offset(%"SZF"d) for "
"last-1 dimension size(%"SZF"d)",kofs,na->shape[nd-2]);
}
}
g = ALLOCA_N(char,sizeof(ssize_t)+sizeof(dtype));
*(ssize_t*)g = kofs;
*(dtype*)(g+sizeof(ssize_t)) = data;
na_ndloop3(&ndf, g, 1, self);
return self;
}
|
#fill(other) ⇒ Numo::SComplex
Fill elements with other.
1638 1639 1640 1641 1642 1643 1644 1645 1646 |
# File 'ext/numo/narray/types/scomplex.c', line 1638
static VALUE
scomplex_fill(VALUE self, VALUE val)
{
ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{sym_option}};
ndfunc_t ndf = { iter_scomplex_fill, FULL_LOOP, 2, 0, ain, 0 };
na_ndloop(&ndf, 2, self, val);
return self;
}
|
#floor ⇒ Numo::SComplex
Unary floor.
3644 3645 3646 3647 3648 3649 3650 3651 3652 |
# File 'ext/numo/narray/types/scomplex.c', line 3644
static VALUE
scomplex_floor(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_floor, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#format(format) ⇒ Numo::RObject
Format elements into strings.
1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 |
# File 'ext/numo/narray/types/scomplex.c', line 1698
static VALUE
scomplex_format(int argc, VALUE *argv, VALUE self)
{
VALUE fmt=Qnil;
ndfunc_arg_in_t ain[2] = {{Qnil,0},{sym_option}};
ndfunc_arg_out_t aout[1] = {{numo_cRObject,0}};
ndfunc_t ndf = { iter_scomplex_format, FULL_LOOP_NIP, 2, 1, ain, aout };
rb_scan_args(argc, argv, "01", &fmt);
return na_ndloop(&ndf, 2, self, fmt);
}
|
#format_to_a(format) ⇒ Array
Format elements into strings.
1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 |
# File 'ext/numo/narray/types/scomplex.c', line 1749
static VALUE
scomplex_format_to_a(int argc, VALUE *argv, VALUE self)
{
volatile VALUE fmt=Qnil;
ndfunc_arg_in_t ain[3] = {{Qnil,0},{sym_loop_opt},{sym_option}};
ndfunc_arg_out_t aout[1] = {{rb_cArray,0}}; // dummy?
ndfunc_t ndf = { iter_scomplex_format_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
rb_scan_args(argc, argv, "01", &fmt);
return na_ndloop_cast_narray_to_rarray(&ndf, self, fmt);
}
|
#im ⇒ Numo::SComplex
Unary im.
3083 3084 3085 3086 3087 3088 3089 3090 3091 |
# File 'ext/numo/narray/types/scomplex.c', line 3083
static VALUE
scomplex_im(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_im, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#imag ⇒ Numo::SFloat
imag of self.
3205 3206 3207 3208 3209 3210 3211 3212 3213 |
# File 'ext/numo/narray/types/scomplex.c', line 3205
static VALUE
scomplex_imag(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_scomplex_imag, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#inspect ⇒ String
Returns a string containing a human-readable representation of NArray.
1776 1777 1778 1779 1780 |
# File 'ext/numo/narray/types/scomplex.c', line 1776
VALUE
scomplex_inspect(VALUE ary)
{
return na_ndloop_inspect(ary, iter_scomplex_inspect, Qnil);
}
|
#isfinite ⇒ Numo::Bit
Condition of isfinite.
4313 4314 4315 4316 4317 4318 4319 4320 4321 |
# File 'ext/numo/narray/types/scomplex.c', line 4313
static VALUE
scomplex_isfinite(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_scomplex_isfinite, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#isinf ⇒ Numo::Bit
Condition of isinf.
4169 4170 4171 4172 4173 4174 4175 4176 4177 |
# File 'ext/numo/narray/types/scomplex.c', line 4169
static VALUE
scomplex_isinf(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_scomplex_isinf, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#isnan ⇒ Numo::Bit
Condition of isnan.
4121 4122 4123 4124 4125 4126 4127 4128 4129 |
# File 'ext/numo/narray/types/scomplex.c', line 4121
static VALUE
scomplex_isnan(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_scomplex_isnan, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#isneginf ⇒ Numo::Bit
Condition of isneginf.
4265 4266 4267 4268 4269 4270 4271 4272 4273 |
# File 'ext/numo/narray/types/scomplex.c', line 4265
static VALUE
scomplex_isneginf(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_scomplex_isneginf, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#isposinf ⇒ Numo::Bit
Condition of isposinf.
4217 4218 4219 4220 4221 4222 4223 4224 4225 |
# File 'ext/numo/narray/types/scomplex.c', line 4217
static VALUE
scomplex_isposinf(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_scomplex_isposinf, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#logseq(beg, step, [base]) ⇒ Numo::SComplex
Set logarithmic sequence of numbers to self. The sequence is obtained from base*(beg+istep) where i is 1-dimensional index. Applicable classes: DFloat, SFloat, DComplex, SCopmplex.
5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 |
# File 'ext/numo/narray/types/scomplex.c', line 5110
static VALUE
scomplex_logseq(int argc, VALUE *args, VALUE self)
{
logseq_opt_t *g;
VALUE vbeg, vstep, vbase;
ndfunc_arg_in_t ain[1] = {{OVERWRITE,0}};
ndfunc_t ndf = {iter_scomplex_logseq, FULL_LOOP, 1,0, ain,0};
g = ALLOCA_N(logseq_opt_t,1);
rb_scan_args(argc, args, "21", &vbeg, &vstep, &vbase);
g->beg = m_num_to_data(vbeg);
g->step = m_num_to_data(vstep);
if (vbase==Qnil) {
g->base = m_from_real(10);
} else {
g->base = m_num_to_data(vbase);
}
na_ndloop3(&ndf, g, 1, self);
return self;
}
|
#map ⇒ Numo::SComplex
Unary map.
1902 1903 1904 1905 1906 1907 1908 1909 1910 |
# File 'ext/numo/narray/types/scomplex.c', line 1902
static VALUE
scomplex_map(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_map, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#map_with_index ⇒ Numo::NArray
Invokes the given block once for each element of self,
passing that element and indices along each axis as parameters.
Creates a new NArray containing the values returned by the block.
Inplace option is allowed, i.e., nary.inplace.map
overwrites nary
.
For a block { | x,i,j,… | … } |
2066 2067 2068 2069 2070 2071 2072 2073 2074 |
# File 'ext/numo/narray/types/scomplex.c', line 2066
static VALUE
scomplex_map_with_index(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{Qnil,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_map_with_index, FULL_LOOP, 1,1, ain,aout};
return na_ndloop_with_index(&ndf, 1, self);
}
|
#mean(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
mean of self.
4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 |
# File 'ext/numo/narray/types/scomplex.c', line 4481
static VALUE
scomplex_mean(int argc, VALUE *argv, VALUE self)
{
VALUE v, reduce;
ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = { iter_scomplex_mean, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_mean_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
return scomplex_extract(v);
#line 48 "gen/tmpl/accum.c"
}
|
#mulsum(other, axis: nil, keepdims: false, nan: false) ⇒ Numo::NArray
Binary mulsum.
4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 |
# File 'ext/numo/narray/types/scomplex.c', line 4938
static VALUE
scomplex_mulsum(int argc, VALUE *argv, VALUE self)
{
//
VALUE klass, v;
//
if (argc < 1) {
rb_raise(rb_eArgError,"wrong number of arguments (%d for >=1)",argc);
}
//
#line 92 "gen/tmpl/accum_binary.c"
klass = na_upcast(CLASS_OF(self),CLASS_OF(argv[0]));
if (klass==cT) {
return scomplex_mulsum_self(argc, argv, self);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall2(v, rb_intern("mulsum"), argc, argv);
}
//
}
|
#ne(other) ⇒ Numo::Bit
Comparison ne other.
3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 |
# File 'ext/numo/narray/types/scomplex.c', line 3496
static VALUE
scomplex_ne(VALUE self, VALUE other)
{
#line 46 "gen/tmpl/cond_binary.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_ne_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, id_ne, 1, other);
}
}
|
#nearly_eq(other) ⇒ Numo::Bit Also known as: close_to
Comparison nearly_eq other.
3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 |
# File 'ext/numo/narray/types/scomplex.c', line 3553
static VALUE
scomplex_nearly_eq(VALUE self, VALUE other)
{
#line 46 "gen/tmpl/cond_binary.c"
VALUE klass, v;
klass = na_upcast(CLASS_OF(self),CLASS_OF(other));
if (klass==cT) {
return scomplex_nearly_eq_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, id_nearly_eq, 1, other);
}
}
|
#poly(a0, a1, ...) ⇒ Numo::SComplex
Polynomial.: a0 + a1x + a2x2 + a3x**3 + … + anxn
5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 |
# File 'ext/numo/narray/types/scomplex.c', line 5449
static VALUE
scomplex_poly(VALUE self, VALUE args)
{
int argc, i;
VALUE *argv;
volatile VALUE v, a;
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = { iter_scomplex_poly, NO_LOOP, 0, 1, 0, aout };
argc = RARRAY_LEN(args);
ndf.nin = argc+1;
ndf.ain = ALLOCA_N(ndfunc_arg_in_t,argc+1);
for (i=0; i<argc+1; i++) {
ndf.ain[i].type = cT;
}
argv = ALLOCA_N(VALUE,argc+1);
argv[0] = self;
for (i=0; i<argc; i++) {
argv[i+1] = RARRAY_PTR(args)[i];
}
a = rb_ary_new4(argc+1, argv);
v = na_ndloop2(&ndf, a);
return scomplex_extract(v);
}
|
#prod(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
prod of self.
4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 |
# File 'ext/numo/narray/types/scomplex.c', line 4422
static VALUE
scomplex_prod(int argc, VALUE *argv, VALUE self)
{
VALUE v, reduce;
ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = { iter_scomplex_prod, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_prod_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
return scomplex_extract(v);
#line 48 "gen/tmpl/accum.c"
}
|
#rand([[low],high]) ⇒ Numo::SComplex
Generate uniformly distributed random numbers on self narray.
5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 |
# File 'ext/numo/narray/types/scomplex.c', line 5287
static VALUE
scomplex_rand(int argc, VALUE *args, VALUE self)
{
rand_opt_t g;
VALUE v1=Qnil, v2=Qnil;
dtype high;
ndfunc_arg_in_t ain[1] = {{OVERWRITE,0}};
ndfunc_t ndf = {iter_scomplex_rand, FULL_LOOP, 1,0, ain,0};
#line 140 "gen/tmpl/rand.c"
rb_scan_args(argc, args, "02", &v1, &v2);
if (v2==Qnil) {
g.low = m_zero;
if (v1==Qnil) {
g.max = high = c_new(1,1);
#line 149 "gen/tmpl/rand.c"
} else {
g.max = high = m_num_to_data(v1);
}
} else {
g.low = m_num_to_data(v1);
high = m_num_to_data(v2);
g.max = m_sub(high,g.low);
}
#line 163 "gen/tmpl/rand.c"
na_ndloop3(&ndf, &g, 1, self);
return self;
}
|
#rand_norm([mu,[sigma]]) ⇒ Numo::SComplex
Generates random numbers from the normal distribution on self narray using Box-Muller Transformation.
5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 |
# File 'ext/numo/narray/types/scomplex.c', line 5398
static VALUE
scomplex_rand_norm(int argc, VALUE *args, VALUE self)
{
int n;
randn_opt_t g;
VALUE v1=Qnil, v2=Qnil;
ndfunc_arg_in_t ain[1] = {{OVERWRITE,0}};
ndfunc_t ndf = {iter_scomplex_rand_norm, FULL_LOOP, 1,0, ain,0};
n = rb_scan_args(argc, args, "02", &v1, &v2);
if (n == 0) {
g.mu = m_zero;
} else {
g.mu = m_num_to_data(v1);
}
if (n == 2) {
g.sigma = NUM2DBL(v2);
} else {
g.sigma = 1;
}
na_ndloop3(&ndf, &g, 1, self);
return self;
}
|
#real ⇒ Numo::SFloat
real of self.
3144 3145 3146 3147 3148 3149 3150 3151 3152 |
# File 'ext/numo/narray/types/scomplex.c', line 3144
static VALUE
scomplex_real(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_scomplex_real, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#reciprocal ⇒ Numo::SComplex
Unary reciprocal.
2747 2748 2749 2750 2751 2752 2753 2754 2755 |
# File 'ext/numo/narray/types/scomplex.c', line 2747
static VALUE
scomplex_reciprocal(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_reciprocal, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#rint ⇒ Numo::SComplex
Unary rint.
3980 3981 3982 3983 3984 3985 3986 3987 3988 |
# File 'ext/numo/narray/types/scomplex.c', line 3980
static VALUE
scomplex_rint(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_rint, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#rms(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
rms of self.
4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 |
# File 'ext/numo/narray/types/scomplex.c', line 4658
static VALUE
scomplex_rms(int argc, VALUE *argv, VALUE self)
{
VALUE v, reduce;
ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_scomplex_rms, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_rms_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
#line 46 "gen/tmpl/accum.c"
return rb_funcall(v,rb_intern("extract"),0);
}
|
#round ⇒ Numo::SComplex
Unary round.
3728 3729 3730 3731 3732 3733 3734 3735 3736 |
# File 'ext/numo/narray/types/scomplex.c', line 3728
static VALUE
scomplex_round(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_round, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#seq([beg,[step]]) ⇒ Numo::SComplex Also known as: indgen
Set linear sequence of numbers to self. The sequence is obtained from beg+i*step where i is 1-dimensional index.
5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 |
# File 'ext/numo/narray/types/scomplex.c', line 5024
static VALUE
scomplex_seq(int argc, VALUE *args, VALUE self)
{
seq_opt_t *g;
VALUE vbeg=Qnil, vstep=Qnil;
ndfunc_arg_in_t ain[1] = {{OVERWRITE,0}};
ndfunc_t ndf = {iter_scomplex_seq, FULL_LOOP, 1,0, ain,0};
g = ALLOCA_N(seq_opt_t,1);
g->beg = m_zero;
g->step = m_one;
g->count = 0;
rb_scan_args(argc, args, "02", &vbeg, &vstep);
#line 86 "gen/tmpl/seq.c"
if (vbeg!=Qnil) {g->beg = m_num_to_data(vbeg);}
if (vstep!=Qnil) {g->step = m_num_to_data(vstep);}
#line 90 "gen/tmpl/seq.c"
na_ndloop3(&ndf, g, 1, self);
return self;
}
|
#set_imag(a1) ⇒ Object Also known as: imag=
3326 3327 3328 3329 3330 3331 3332 3333 3334 |
# File 'ext/numo/narray/types/scomplex.c', line 3326
static VALUE
scomplex_set_imag(VALUE self, VALUE a1)
{
ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{cRT,0}};
ndfunc_t ndf = { iter_scomplex_set_imag, FULL_LOOP, 2, 0, ain, 0 };
na_ndloop(&ndf, 2, self, a1);
return a1;
}
|
#set_real(a1) ⇒ Object Also known as: real=
3385 3386 3387 3388 3389 3390 3391 3392 3393 |
# File 'ext/numo/narray/types/scomplex.c', line 3385
static VALUE
scomplex_set_real(VALUE self, VALUE a1)
{
ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{cRT,0}};
ndfunc_t ndf = { iter_scomplex_set_real, FULL_LOOP, 2, 0, ain, 0 };
na_ndloop(&ndf, 2, self, a1);
return a1;
}
|
#sign ⇒ Numo::SComplex
Unary sign.
2831 2832 2833 2834 2835 2836 2837 2838 2839 |
# File 'ext/numo/narray/types/scomplex.c', line 2831
static VALUE
scomplex_sign(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_sign, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#square ⇒ Numo::SComplex
Unary square.
2915 2916 2917 2918 2919 2920 2921 2922 2923 |
# File 'ext/numo/narray/types/scomplex.c', line 2915
static VALUE
scomplex_square(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_square, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#stddev(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
stddev of self.
4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 |
# File 'ext/numo/narray/types/scomplex.c', line 4540
static VALUE
scomplex_stddev(int argc, VALUE *argv, VALUE self)
{
VALUE v, reduce;
ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_scomplex_stddev, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_stddev_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
#line 46 "gen/tmpl/accum.c"
return rb_funcall(v,rb_intern("extract"),0);
}
|
#store(other) ⇒ Numo::SComplex
Store elements to Numo::SComplex from other.
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 |
# File 'ext/numo/narray/types/scomplex.c', line 1118
static VALUE
scomplex_store(VALUE self, VALUE obj)
{
VALUE r, klass;
klass = CLASS_OF(obj);
if (klass==numo_cSComplex) {
scomplex_store_scomplex(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (IS_INTEGER_CLASS(klass) || klass==rb_cFloat || klass==rb_cComplex) {
scomplex_store_numeric(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cBit) {
scomplex_store_bit(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cDComplex) {
scomplex_store_dcomplex(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cDFloat) {
scomplex_store_dfloat(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cSFloat) {
scomplex_store_sfloat(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cInt64) {
scomplex_store_int64(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cInt32) {
scomplex_store_int32(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cInt16) {
scomplex_store_int16(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cInt8) {
scomplex_store_int8(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cUInt64) {
scomplex_store_uint64(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cUInt32) {
scomplex_store_uint32(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cUInt16) {
scomplex_store_uint16(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cUInt8) {
scomplex_store_uint8(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cRObject) {
scomplex_store_robject(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==rb_cArray) {
scomplex_store_array(self,obj);
return self;
}
if (IsNArray(obj)) {
r = rb_funcall(obj, rb_intern("coerce_cast"), 1, cT);
if (CLASS_OF(r)==cT) {
scomplex_store(self,r);
return self;
}
}
#line 36 "gen/tmpl/store.c"
rb_raise(nary_eCastError, "unknown conversion from %s to %s",
rb_class2name(CLASS_OF(obj)),
rb_class2name(CLASS_OF(self)));
return self;
}
|
#sum(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
sum of self.
4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 |
# File 'ext/numo/narray/types/scomplex.c', line 4363
static VALUE
scomplex_sum(int argc, VALUE *argv, VALUE self)
{
VALUE v, reduce;
ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = { iter_scomplex_sum, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_sum_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
return scomplex_extract(v);
#line 48 "gen/tmpl/accum.c"
}
|
#to_a ⇒ Array
Convert self to Array.
1598 1599 1600 1601 1602 1603 1604 1605 |
# File 'ext/numo/narray/types/scomplex.c', line 1598
static VALUE
scomplex_to_a(VALUE self)
{
ndfunc_arg_in_t ain[3] = {{Qnil,0},{sym_loop_opt},{sym_option}};
ndfunc_arg_out_t aout[1] = {{rb_cArray,0}}; // dummy?
ndfunc_t ndf = { iter_scomplex_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
}
|
#trunc ⇒ Numo::SComplex
Unary trunc.
3896 3897 3898 3899 3900 3901 3902 3903 3904 |
# File 'ext/numo/narray/types/scomplex.c', line 3896
static VALUE
scomplex_trunc(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_scomplex_trunc, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#var(axis: nil, keepdims: false, nan: false) ⇒ Numo::SComplex
var of self.
4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 |
# File 'ext/numo/narray/types/scomplex.c', line 4599
static VALUE
scomplex_var(int argc, VALUE *argv, VALUE self)
{
VALUE v, reduce;
ndfunc_arg_in_t ain[2] = {{cT,0},{sym_reduce,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_scomplex_var, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_scomplex_var_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
#line 46 "gen/tmpl/accum.c"
return rb_funcall(v,rb_intern("extract"),0);
}
|