Class: Numo::DComplex
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::DComplex
Cast object to Numo::DComplex.
-
.cast(obj) ⇒ Numo::DComplex
Cast object to Numo::DComplex.
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::DComplex
Unary minus.
-
#/(other) ⇒ Numo::NArray
Binary div.
-
#[](dim0, ..., dimL) ⇒ Numeric, NArray::DComplex
Array element referenece or slice view.
-
#[]=(dim0, .., dimL, val) ⇒ Numeric
Array element(s) set.
-
#abs ⇒ Numo::DFloat
abs of self.
-
#allocate ⇒ Object
-
#arg ⇒ Numo::DFloat
(also: #angle)
arg of self.
-
#ceil ⇒ Numo::DComplex
Unary ceil.
-
#coerce_cast(type) ⇒ nil
return NArray with cast to the type of self.
-
#conj ⇒ Numo::DComplex
(also: #conjugate)
Unary conj.
-
#copysign(other) ⇒ Numo::NArray
Binary copysign.
-
#cumprod(axis: nil, nan: false) ⇒ Numo::DComplex
cumprod of self.
-
#cumsum(axis: nil, nan: false) ⇒ Numo::DComplex
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::DComplex
Eye: Set a value to diagonal components, set 0 to non-diagonal components.
-
#fill(other) ⇒ Numo::DComplex
Fill elements with other.
-
#floor ⇒ Numo::DComplex
Unary floor.
-
#format(format) ⇒ Numo::RObject
Format elements into strings.
-
#format_to_a(format) ⇒ Array
Format elements into strings.
-
#im ⇒ Numo::DComplex
Unary im.
-
#imag ⇒ Numo::DFloat
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.
-
#kahan_sum(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
kahan_sum of self.
-
#logseq(beg, step, [base]) ⇒ Numo::DComplex
Set logarithmic sequence of numbers to self.
-
#map ⇒ Numo::DComplex
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::DComplex
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::DComplex
Polynomial.: a0 + a1x + a2x2 + a3*x3 + …
-
#prod(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
prod of self.
-
#rand([[low],high]) ⇒ Numo::DComplex
Generate uniformly distributed random numbers on self narray.
-
#rand_norm([mu,[sigma]]) ⇒ Numo::DComplex
Generates random numbers from the normal distribution on self narray using Box-Muller Transformation.
-
#real ⇒ Numo::DFloat
real of self.
-
#reciprocal ⇒ Numo::DComplex
Unary reciprocal.
-
#rint ⇒ Numo::DComplex
Unary rint.
-
#rms(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
rms of self.
-
#round ⇒ Numo::DComplex
Unary round.
-
#seq([beg,[step]]) ⇒ Numo::DComplex
(also: #indgen)
Set linear sequence of numbers to self.
-
#set_imag(a1) ⇒ Object
(also: #imag=)
-
#set_real(a1) ⇒ Object
(also: #real=)
-
#sign ⇒ Numo::DComplex
Unary sign.
-
#square ⇒ Numo::DComplex
Unary square.
-
#stddev(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
stddev of self.
-
#store(other) ⇒ Numo::DComplex
Store elements to Numo::DComplex from other.
-
#sum(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
sum of self.
-
#to_a ⇒ Array
Convert self to Array.
-
#trunc ⇒ Numo::DComplex
Unary trunc.
-
#var(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
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::DComplex .cast(array) ⇒ Numo::DComplex
Cast object to Numo::DComplex.
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/dcomplex.c', line 1394
static VALUE
dcomplex_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 dcomplex_new_dim0(x);
}
if (RTEST(rb_obj_is_kind_of(obj,rb_cArray))) {
return dcomplex_cast_array(obj);
}
if (IsNArray(obj)) {
GetNArray(obj,na);
v = nary_new(cT, NA_NDIM(na), NA_SHAPE(na));
if (NA_SIZE(na) > 0) {
dcomplex_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::DComplex .cast(array) ⇒ Numo::DComplex
Cast object to Numo::DComplex.
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/dcomplex.c', line 1394
static VALUE
dcomplex_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 dcomplex_new_dim0(x);
}
if (RTEST(rb_obj_is_kind_of(obj,rb_cArray))) {
return dcomplex_cast_array(obj);
}
if (IsNArray(obj)) {
GetNArray(obj,na);
v = nary_new(cT, NA_NDIM(na), NA_SHAPE(na));
if (NA_SIZE(na) > 0) {
dcomplex_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/dcomplex.c', line 2399
static VALUE
dcomplex_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 dcomplex_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/dcomplex.c', line 2573
static VALUE
dcomplex_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 dcomplex_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/dcomplex.c', line 2213
static VALUE
dcomplex_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 dcomplex_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/dcomplex.c', line 2306
static VALUE
dcomplex_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 dcomplex_sub_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, '-', 1, other);
}
}
|
#-@ ⇒ Numo::DComplex
Unary minus.
2663 2664 2665 2666 2667 2668 2669 2670 2671 |
# File 'ext/numo/narray/types/dcomplex.c', line 2663
static VALUE
dcomplex_minus(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_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/dcomplex.c', line 2492
static VALUE
dcomplex_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 dcomplex_div_self(self, other);
} else {
v = rb_funcall(klass, id_cast, 1, self);
return rb_funcall(v, '/', 1, other);
}
}
|
#[](dim0, ..., dimL) ⇒ Numeric, NArray::DComplex
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/dcomplex.c', line 1466
static VALUE
dcomplex_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/dcomplex.c', line 1523
static VALUE
dcomplex_aset(int argc, VALUE *argv, VALUE self)
{
int nd;
size_t pos;
char *ptr;
VALUE a;
dtype x;
argc--;
if (argc==0) {
dcomplex_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);
dcomplex_store(a, argv[argc]);
} else {
x = dcomplex_extract_data(argv[argc]);
ptr = na_get_pointer_for_read_write(self) + pos;
*(dtype*)ptr = x;
}
}
return argv[argc];
}
|
#abs ⇒ Numo::DFloat
abs of self.
2127 2128 2129 2130 2131 2132 2133 2134 2135 |
# File 'ext/numo/narray/types/dcomplex.c', line 2127
static VALUE
dcomplex_abs(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_dcomplex_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/dcomplex.c', line 135
static VALUE
dcomplex_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::DFloat Also known as: angle
arg of self.
3266 3267 3268 3269 3270 3271 3272 3273 3274 |
# File 'ext/numo/narray/types/dcomplex.c', line 3266
static VALUE
dcomplex_arg(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_dcomplex_arg, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#ceil ⇒ Numo::DComplex
Unary ceil.
3812 3813 3814 3815 3816 3817 3818 3819 3820 |
# File 'ext/numo/narray/types/dcomplex.c', line 3812
static VALUE
dcomplex_ceil(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_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/dcomplex.c', line 1557
static VALUE
dcomplex_coerce_cast(VALUE self, VALUE type)
{
return Qnil;
}
|
#conj ⇒ Numo::DComplex Also known as: conjugate
Unary conj.
2999 3000 3001 3002 3003 3004 3005 3006 3007 |
# File 'ext/numo/narray/types/dcomplex.c', line 2999
static VALUE
dcomplex_conj(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_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/dcomplex.c', line 4066
static VALUE
dcomplex_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 dcomplex_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::DComplex
cumprod of self.
4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 |
# File 'ext/numo/narray/types/dcomplex.c', line 4870
static VALUE
dcomplex_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_dcomplex_cumprod, STRIDE_LOOP|NDF_FLAT_REDUCE|NDF_CUM,
2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_cumprod_nan);
#line 48 "gen/tmpl/cum.c"
return na_ndloop(&ndf, 2, self, reduce);
}
|
#cumsum(axis: nil, nan: false) ⇒ Numo::DComplex
cumsum of self.
4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 |
# File 'ext/numo/narray/types/dcomplex.c', line 4795
static VALUE
dcomplex_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_dcomplex_cumsum, STRIDE_LOOP|NDF_FLAT_REDUCE|NDF_CUM,
2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_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/dcomplex.c', line 1818
static VALUE
dcomplex_each(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{Qnil,0}};
ndfunc_t ndf = {iter_dcomplex_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/dcomplex.c', line 1969
static VALUE
dcomplex_each_with_index(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{Qnil,0}};
ndfunc_t ndf = {iter_dcomplex_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/dcomplex.c', line 3439
static VALUE
dcomplex_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 dcomplex_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/dcomplex.c', line 174
static VALUE
dcomplex_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::DComplex
Eye: Set a value to diagonal components, set 0 to non-diagonal components.
5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 |
# File 'ext/numo/narray/types/dcomplex.c', line 5232
static VALUE
dcomplex_eye(int argc, VALUE *argv, VALUE self)
{
ndfunc_arg_in_t ain[1] = {{OVERWRITE,2}};
ndfunc_t ndf = {iter_dcomplex_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::DComplex
Fill elements with other.
1638 1639 1640 1641 1642 1643 1644 1645 1646 |
# File 'ext/numo/narray/types/dcomplex.c', line 1638
static VALUE
dcomplex_fill(VALUE self, VALUE val)
{
ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{sym_option}};
ndfunc_t ndf = { iter_dcomplex_fill, FULL_LOOP, 2, 0, ain, 0 };
na_ndloop(&ndf, 2, self, val);
return self;
}
|
#floor ⇒ Numo::DComplex
Unary floor.
3644 3645 3646 3647 3648 3649 3650 3651 3652 |
# File 'ext/numo/narray/types/dcomplex.c', line 3644
static VALUE
dcomplex_floor(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_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/dcomplex.c', line 1698
static VALUE
dcomplex_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_dcomplex_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/dcomplex.c', line 1749
static VALUE
dcomplex_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_dcomplex_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::DComplex
Unary im.
3083 3084 3085 3086 3087 3088 3089 3090 3091 |
# File 'ext/numo/narray/types/dcomplex.c', line 3083
static VALUE
dcomplex_im(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_im, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#imag ⇒ Numo::DFloat
imag of self.
3205 3206 3207 3208 3209 3210 3211 3212 3213 |
# File 'ext/numo/narray/types/dcomplex.c', line 3205
static VALUE
dcomplex_imag(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_dcomplex_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/dcomplex.c', line 1776
VALUE
dcomplex_inspect(VALUE ary)
{
return na_ndloop_inspect(ary, iter_dcomplex_inspect, Qnil);
}
|
#isfinite ⇒ Numo::Bit
Condition of isfinite.
4313 4314 4315 4316 4317 4318 4319 4320 4321 |
# File 'ext/numo/narray/types/dcomplex.c', line 4313
static VALUE
dcomplex_isfinite(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_dcomplex_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/dcomplex.c', line 4169
static VALUE
dcomplex_isinf(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_dcomplex_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/dcomplex.c', line 4121
static VALUE
dcomplex_isnan(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_dcomplex_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/dcomplex.c', line 4265
static VALUE
dcomplex_isneginf(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_dcomplex_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/dcomplex.c', line 4217
static VALUE
dcomplex_isposinf(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{numo_cBit,0}};
ndfunc_t ndf = { iter_dcomplex_isposinf, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#kahan_sum(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
kahan_sum 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/dcomplex.c', line 4481
static VALUE
dcomplex_kahan_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_dcomplex_kahan_sum, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_kahan_sum_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
return dcomplex_extract(v);
#line 48 "gen/tmpl/accum.c"
}
|
#logseq(beg, step, [base]) ⇒ Numo::DComplex
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.
5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 |
# File 'ext/numo/narray/types/dcomplex.c', line 5169
static VALUE
dcomplex_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_dcomplex_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::DComplex
Unary map.
1902 1903 1904 1905 1906 1907 1908 1909 1910 |
# File 'ext/numo/narray/types/dcomplex.c', line 1902
static VALUE
dcomplex_map(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_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/dcomplex.c', line 2066
static VALUE
dcomplex_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_dcomplex_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::DComplex
mean 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/dcomplex.c', line 4540
static VALUE
dcomplex_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_dcomplex_mean, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_mean_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
return dcomplex_extract(v);
#line 48 "gen/tmpl/accum.c"
}
|
#mulsum(other, axis: nil, keepdims: false, nan: false) ⇒ Numo::NArray
Binary mulsum.
4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 |
# File 'ext/numo/narray/types/dcomplex.c', line 4997
static VALUE
dcomplex_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 dcomplex_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/dcomplex.c', line 3496
static VALUE
dcomplex_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 dcomplex_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/dcomplex.c', line 3553
static VALUE
dcomplex_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 dcomplex_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::DComplex
Polynomial.: a0 + a1x + a2x2 + a3x**3 + … + anxn
5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 |
# File 'ext/numo/narray/types/dcomplex.c', line 5508
static VALUE
dcomplex_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_dcomplex_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 dcomplex_extract(v);
}
|
#prod(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
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/dcomplex.c', line 4422
static VALUE
dcomplex_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_dcomplex_prod, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_prod_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
return dcomplex_extract(v);
#line 48 "gen/tmpl/accum.c"
}
|
#rand([[low],high]) ⇒ Numo::DComplex
Generate uniformly distributed random numbers on self narray.
5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 |
# File 'ext/numo/narray/types/dcomplex.c', line 5346
static VALUE
dcomplex_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_dcomplex_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::DComplex
Generates random numbers from the normal distribution on self narray using Box-Muller Transformation.
5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 |
# File 'ext/numo/narray/types/dcomplex.c', line 5457
static VALUE
dcomplex_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_dcomplex_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::DFloat
real of self.
3144 3145 3146 3147 3148 3149 3150 3151 3152 |
# File 'ext/numo/narray/types/dcomplex.c', line 3144
static VALUE
dcomplex_real(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cRT,0}};
ndfunc_t ndf = { iter_dcomplex_real, FULL_LOOP, 1, 1, ain, aout };
return na_ndloop(&ndf, 1, self);
}
|
#reciprocal ⇒ Numo::DComplex
Unary reciprocal.
2747 2748 2749 2750 2751 2752 2753 2754 2755 |
# File 'ext/numo/narray/types/dcomplex.c', line 2747
static VALUE
dcomplex_reciprocal(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_reciprocal, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#rint ⇒ Numo::DComplex
Unary rint.
3980 3981 3982 3983 3984 3985 3986 3987 3988 |
# File 'ext/numo/narray/types/dcomplex.c', line 3980
static VALUE
dcomplex_rint(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_rint, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#rms(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
rms of self.
4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 |
# File 'ext/numo/narray/types/dcomplex.c', line 4717
static VALUE
dcomplex_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_dcomplex_rms, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_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::DComplex
Unary round.
3728 3729 3730 3731 3732 3733 3734 3735 3736 |
# File 'ext/numo/narray/types/dcomplex.c', line 3728
static VALUE
dcomplex_round(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_round, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#seq([beg,[step]]) ⇒ Numo::DComplex 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.
5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 |
# File 'ext/numo/narray/types/dcomplex.c', line 5083
static VALUE
dcomplex_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_dcomplex_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/dcomplex.c', line 3326
static VALUE
dcomplex_set_imag(VALUE self, VALUE a1)
{
ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{cRT,0}};
ndfunc_t ndf = { iter_dcomplex_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/dcomplex.c', line 3385
static VALUE
dcomplex_set_real(VALUE self, VALUE a1)
{
ndfunc_arg_in_t ain[2] = {{OVERWRITE,0},{cRT,0}};
ndfunc_t ndf = { iter_dcomplex_set_real, FULL_LOOP, 2, 0, ain, 0 };
na_ndloop(&ndf, 2, self, a1);
return a1;
}
|
#sign ⇒ Numo::DComplex
Unary sign.
2831 2832 2833 2834 2835 2836 2837 2838 2839 |
# File 'ext/numo/narray/types/dcomplex.c', line 2831
static VALUE
dcomplex_sign(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_sign, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#square ⇒ Numo::DComplex
Unary square.
2915 2916 2917 2918 2919 2920 2921 2922 2923 |
# File 'ext/numo/narray/types/dcomplex.c', line 2915
static VALUE
dcomplex_square(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_square, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#stddev(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
stddev 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/dcomplex.c', line 4599
static VALUE
dcomplex_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_dcomplex_stddev, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_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::DComplex
Store elements to Numo::DComplex 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/dcomplex.c', line 1118
static VALUE
dcomplex_store(VALUE self, VALUE obj)
{
VALUE r, klass;
klass = CLASS_OF(obj);
if (klass==numo_cDComplex) {
dcomplex_store_dcomplex(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (IS_INTEGER_CLASS(klass) || klass==rb_cFloat || klass==rb_cComplex) {
dcomplex_store_numeric(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cBit) {
dcomplex_store_bit(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cSComplex) {
dcomplex_store_scomplex(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cDFloat) {
dcomplex_store_dfloat(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cSFloat) {
dcomplex_store_sfloat(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cInt64) {
dcomplex_store_int64(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cInt32) {
dcomplex_store_int32(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cInt16) {
dcomplex_store_int16(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cInt8) {
dcomplex_store_int8(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cUInt64) {
dcomplex_store_uint64(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cUInt32) {
dcomplex_store_uint32(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cUInt16) {
dcomplex_store_uint16(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cUInt8) {
dcomplex_store_uint8(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==numo_cRObject) {
dcomplex_store_robject(self,obj);
return self;
}
#line 19 "gen/tmpl/store.c"
if (klass==rb_cArray) {
dcomplex_store_array(self,obj);
return self;
}
if (IsNArray(obj)) {
r = rb_funcall(obj, rb_intern("coerce_cast"), 1, cT);
if (CLASS_OF(r)==cT) {
dcomplex_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::DComplex
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/dcomplex.c', line 4363
static VALUE
dcomplex_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_dcomplex_sum, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_sum_nan);
#line 42 "gen/tmpl/accum.c"
v = na_ndloop(&ndf, 2, self, reduce);
return dcomplex_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/dcomplex.c', line 1598
static VALUE
dcomplex_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_dcomplex_to_a, FULL_LOOP_NIP, 3, 1, ain, aout };
return na_ndloop_cast_narray_to_rarray(&ndf, self, Qnil);
}
|
#trunc ⇒ Numo::DComplex
Unary trunc.
3896 3897 3898 3899 3900 3901 3902 3903 3904 |
# File 'ext/numo/narray/types/dcomplex.c', line 3896
static VALUE
dcomplex_trunc(VALUE self)
{
ndfunc_arg_in_t ain[1] = {{cT,0}};
ndfunc_arg_out_t aout[1] = {{cT,0}};
ndfunc_t ndf = {iter_dcomplex_trunc, FULL_LOOP, 1,1, ain,aout};
return na_ndloop(&ndf, 1, self);
}
|
#var(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex
var 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/dcomplex.c', line 4658
static VALUE
dcomplex_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_dcomplex_var, STRIDE_LOOP_NIP|NDF_FLAT_REDUCE, 2, 1, ain, aout };
reduce = na_reduce_dimension(argc, argv, 1, &self, &ndf, iter_dcomplex_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);
}
|