Class: Numo::DComplex

Inherits:
NArray
  • Object
show all
Defined in:
ext/numo/narray/types/dcomplex.c

Defined Under Namespace

Modules: Math

Constant Summary collapse

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

NArray::VERSION

Class Method Summary collapse

Instance Method Summary collapse

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, #each_over_axis, #empty?, #expand_dims, eye, #flatten, #fliplr, #flipud, #fortran_contiguous?, #free, 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.

Parameters:

  • elements (Numeric, Array)
  • array (Array)

Returns:

 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440
# File 'ext/numo/narray/types/dcomplex.c', line 1410 static VALUE dcomplex_s_cast(VALUE type, VALUE obj) { VALUE v; narray_t *na; dtype x; if (rb_obj_class(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 "/home/masa/numo/numo-narray/ext/numo/narray/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.

Parameters:

  • elements (Numeric, Array)
  • array (Array)

Returns:

 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440
# File 'ext/numo/narray/types/dcomplex.c', line 1410 static VALUE dcomplex_s_cast(VALUE type, VALUE obj) { VALUE v; narray_t *na; dtype x; if (rb_obj_class(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 "/home/masa/numo/numo-narray/ext/numo/narray/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.

Parameters:

Returns:

 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514
# File 'ext/numo/narray/types/dcomplex.c', line 2499 static VALUE dcomplex_mul(VALUE self, VALUE other) { #line 226 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/binary.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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.

Parameters:

Returns:

 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733
# File 'ext/numo/narray/types/dcomplex.c', line 2719 static VALUE dcomplex_pow(VALUE self, VALUE other) { #line 69 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/pow.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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.

Parameters:

Returns:

 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236
# File 'ext/numo/narray/types/dcomplex.c', line 2221 static VALUE dcomplex_add(VALUE self, VALUE other) { #line 226 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/binary.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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.

Parameters:

Returns:

 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375
# File 'ext/numo/narray/types/dcomplex.c', line 2360 static VALUE dcomplex_sub(VALUE self, VALUE other) { #line 226 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/binary.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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.

Returns:

 2809 2810 2811 2812 2813 2814 2815 2816 2817
# File 'ext/numo/narray/types/dcomplex.c', line 2809 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.

Parameters:

Returns:

 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653
# File 'ext/numo/narray/types/dcomplex.c', line 2638 static VALUE dcomplex_div(VALUE self, VALUE other) { #line 226 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/binary.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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, Numo::DComplex

Multi-dimensional element reference.

Parameters:

Returns:

See Also:

 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466
# File 'ext/numo/narray/types/dcomplex.c', line 1452 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, ...

Multi-dimensional element assignment.

Parameters:

Returns:

  • (Numeric, Numo::NArray, Array)

    returns val (last argument).

See Also:

 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504
# File 'ext/numo/narray/types/dcomplex.c', line 1479 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]; }

#absNumo::DFloat

abs of self.

Returns:

 2089 2090 2091 2092 2093 2094 2095 2096 2097
# File 'ext/numo/narray/types/dcomplex.c', line 2089 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); }

#allocateObject

 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 164 165 166 167
# File 'ext/numo/narray/types/dcomplex.c', line 139 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 "/home/masa/numo/numo-narray/ext/numo/narray/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; }

#argNumo::DFloat Also known as: angle

arg of self.

Returns:

 3412 3413 3414 3415 3416 3417 3418 3419 3420
# File 'ext/numo/narray/types/dcomplex.c', line 3412 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); }

#ceilNumo::DComplex

Unary ceil.

Returns:

 3958 3959 3960 3961 3962 3963 3964 3965 3966
# File 'ext/numo/narray/types/dcomplex.c', line 3958 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.

Returns:

  • (nil)
 1513 1514 1515 1516 1517
# File 'ext/numo/narray/types/dcomplex.c', line 1513 static VALUE dcomplex_coerce_cast(VALUE self, VALUE type) { return Qnil; }

#conjNumo::DComplex Also known as: conjugate

Unary conj.

Returns:

 3145 3146 3147 3148 3149 3150 3151 3152 3153
# File 'ext/numo/narray/types/dcomplex.c', line 3145 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.

Parameters:

Returns:

 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273
# File 'ext/numo/narray/types/dcomplex.c', line 4258 static VALUE dcomplex_copysign(VALUE self, VALUE other) { #line 226 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/binary.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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.

Parameters:

  • axis (Numeric, Array, Range)

    Performs cumprod along the axis.

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN if exists).

Returns:

 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076
# File 'ext/numo/narray/types/dcomplex.c', line 5062 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/cum.c" return na_ndloop(&ndf, 2, self, reduce); }

#cumsum(axis: nil, nan: false) ⇒ Numo::DComplex

cumsum of self.

Parameters:

  • axis (Numeric, Array, Range)

    Performs cumsum along the axis.

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN if exists).

Returns:

 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001
# File 'ext/numo/narray/types/dcomplex.c', line 4987 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/cum.c" return na_ndloop(&ndf, 2, self, reduce); }

#eachNumo::NArray

Calls the given block once for each element in self, passing that element as a parameter. For a block {|x| ... },

Yield Parameters:

  • x (Numeric)

    an element of NArray.

Returns:

See Also:

 1776 1777 1778 1779 1780 1781 1782 1783 1784
# File 'ext/numo/narray/types/dcomplex.c', line 1776 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_indexNumo::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,...| ... },

Yield Parameters:

  • x (Numeric)

    an element

  • i,j,... (Integer)

    multitimensional indices

Returns:

See Also:

 1931 1932 1933 1934 1935 1936 1937 1938 1939
# File 'ext/numo/narray/types/dcomplex.c', line 1931 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.

Parameters:

Returns:

 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599
# File 'ext/numo/narray/types/dcomplex.c', line 3585 static VALUE dcomplex_eq(VALUE self, VALUE other) { #line 46 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/cond_binary.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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); } }

#extractNumeric, 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.

Returns:

 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
# File 'ext/numo/narray/types/dcomplex.c', line 178 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.

Parameters:

  • element (Numeric)

    Diagonal element to be stored. Default is 1.

  • offset (Integer)

    Diagonal offset from the main diagonal. The default is 0. k>0 for diagonals above the main diagonal, and k<0 for diagonals below the main diagonal.

Returns:

 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476
# File 'ext/numo/narray/types/dcomplex.c', line 5426 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.

Parameters:

  • other (Numeric)

Returns:

 1594 1595 1596 1597 1598 1599 1600 1601 1602
# File 'ext/numo/narray/types/dcomplex.c', line 1594 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; }

#floorNumo::DComplex

Unary floor.

Returns:

 3790 3791 3792 3793 3794 3795 3796 3797 3798
# File 'ext/numo/narray/types/dcomplex.c', line 3790 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.

Parameters:

  • format (String)

Returns:

 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665
# File 'ext/numo/narray/types/dcomplex.c', line 1654 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.

Parameters:

  • format (String)

Returns:

  • (Array)

    array of formated strings.

 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715
# File 'ext/numo/narray/types/dcomplex.c', line 1705 static VALUE dcomplex_format_to_a(int argc, VALUE *argv, VALUE self) { 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); }

#imNumo::DComplex

Unary im.

Returns:

 3229 3230 3231 3232 3233 3234 3235 3236 3237
# File 'ext/numo/narray/types/dcomplex.c', line 3229 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); }

#imagNumo::DFloat

imag of self.

Returns:

 3351 3352 3353 3354 3355 3356 3357 3358 3359
# File 'ext/numo/narray/types/dcomplex.c', line 3351 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); }

#inspectString

Returns a string containing a human-readable representation of NArray.

Returns:

  • (String)
 1732 1733 1734 1735 1736
# File 'ext/numo/narray/types/dcomplex.c', line 1732 static VALUE dcomplex_inspect(VALUE ary) { return na_ndloop_inspect(ary, iter_dcomplex_inspect, Qnil); }

#isfiniteNumo::Bit

Condition of isfinite.

Returns:

 4505 4506 4507 4508 4509 4510 4511 4512 4513
# File 'ext/numo/narray/types/dcomplex.c', line 4505 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); }

#isinfNumo::Bit

Condition of isinf.

Returns:

 4361 4362 4363 4364 4365 4366 4367 4368 4369
# File 'ext/numo/narray/types/dcomplex.c', line 4361 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); }

#isnanNumo::Bit

Condition of isnan.

Returns:

 4313 4314 4315 4316 4317 4318 4319 4320 4321
# File 'ext/numo/narray/types/dcomplex.c', line 4313 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); }

#isneginfNumo::Bit

Condition of isneginf.

Returns:

 4457 4458 4459 4460 4461 4462 4463 4464 4465
# File 'ext/numo/narray/types/dcomplex.c', line 4457 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); }

#isposinfNumo::Bit

Condition of isposinf.

Returns:

 4409 4410 4411 4412 4413 4414 4415 4416 4417
# File 'ext/numo/narray/types/dcomplex.c', line 4409 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.

Parameters:

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).

  • axis (Numeric, Array, Range)

    Performs kahan_sum along the axis.

  • keepdims (TrueClass)

    If true, the reduced axes are left in the result array as dimensions with size one.

Returns:

 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690
# File 'ext/numo/narray/types/dcomplex.c', line 4673 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" v = na_ndloop(&ndf, 2, self, reduce); return dcomplex_extract(v); #line 48 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" }

#logseq(beg, step, [base]) ⇒ Numo::DComplex

Set logarithmic sequence of numbers to self. The sequence is obtained from base**(beg+i*step) where i is 1-dimensional index. Applicable classes: DFloat, SFloat, DComplex, SCopmplex.

Examples:

Numo::DFloat.new(5).logseq(4,-1,2) # => Numo::DFloat#shape=[5] # [16, 8, 4, 2, 1]  Numo::DComplex.new(5).logseq(0,1i*Math::PI/3,Math::E) # => Numo::DComplex#shape=[5] # [1+7.26156e-310i, 0.5+0.866025i, -0.5+0.866025i, -1+1.22465e-16i, ...]

Parameters:

  • beg (Numeric)

    The begining of sequence.

  • step (Numeric)

    The step of sequence.

  • base (Numeric)

    The base of log space. (default=10)

Returns:

 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382
# File 'ext/numo/narray/types/dcomplex.c', line 5363 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; }

#mapNumo::DComplex

Unary map.

Returns:

 1860 1861 1862 1863 1864 1865 1866 1867 1868
# File 'ext/numo/narray/types/dcomplex.c', line 1860 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_indexNumo::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,...| ... },

Yield Parameters:

  • x (Numeric)

    an element

  • i,j,... (Integer)

    multitimensional indices

Returns:

See Also:

 2028 2029 2030 2031 2032 2033 2034 2035 2036
# File 'ext/numo/narray/types/dcomplex.c', line 2028 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.

Parameters:

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).

  • axis (Numeric, Array, Range)

    Performs mean along the axis.

  • keepdims (TrueClass)

    If true, the reduced axes are left in the result array as dimensions with size one.

Returns:

 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749
# File 'ext/numo/narray/types/dcomplex.c', line 4732 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" v = na_ndloop(&ndf, 2, self, reduce); return dcomplex_extract(v); #line 48 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" }

#mulsum(other, axis: nil, keepdims: false, nan: false) ⇒ Numo::NArray

Binary mulsum.

Parameters:

  • other (Numo::NArray, Numeric)
  • axis (Numeric, Array, Range)

    Performs mulsum along the axis.

  • keepdims (TrueClass)

    (keyword) If true, the reduced axes are left in the result array as dimensions with size one.

  • nan (TrueClass)

    (keyword) If true, apply NaN-aware algorithm (avoid NaN if exists).

Returns:

 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208
# File 'ext/numo/narray/types/dcomplex.c', line 5189 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum_binary.c" klass = na_upcast(rb_obj_class(self),rb_obj_class(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.

Parameters:

Returns:

 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656
# File 'ext/numo/narray/types/dcomplex.c', line 3642 static VALUE dcomplex_ne(VALUE self, VALUE other) { #line 46 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/cond_binary.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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.

Parameters:

Returns:

  • (Numo::Bit)

    result of self nearly_eq other.

 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713
# File 'ext/numo/narray/types/dcomplex.c', line 3699 static VALUE dcomplex_nearly_eq(VALUE self, VALUE other) { #line 46 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/cond_binary.c" VALUE klass, v; klass = na_upcast(rb_obj_class(self),rb_obj_class(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, ..., an) ⇒ Numo::DComplex

Calculate polynomial. x.poly(a0,a1,a2,...,an) = a0 + a1*x + a2*x**2 + ... + an*x**n

Parameters:

Returns:

 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729
# File 'ext/numo/narray/types/dcomplex.c', line 5706 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.

Parameters:

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).

  • axis (Numeric, Array, Range)

    Performs prod along the axis.

  • keepdims (TrueClass)

    If true, the reduced axes are left in the result array as dimensions with size one.

Returns:

 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631
# File 'ext/numo/narray/types/dcomplex.c', line 4614 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" v = na_ndloop(&ndf, 2, self, reduce); return dcomplex_extract(v); #line 48 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" }

#rand([[low],high]) ⇒ Numo::DComplex

Generate uniformly distributed random numbers on self narray.

Examples:

Numo::DFloat.new(6).rand # => Numo::DFloat#shape=[6] # [0.0617545, 0.373067, 0.794815, 0.201042, 0.116041, 0.344032]  Numo::DComplex.new(6).rand(5+5i) # => Numo::DComplex#shape=[6] # [2.69974+3.68908i, 0.825443+0.254414i, 0.540323+0.34354i, 4.52061+2.39322i, ...]  Numo::Int32.new(6).rand(2,5) # => Numo::Int32#shape=[6] # [4, 3, 3, 2, 4, 2]

Parameters:

  • low (Numeric)

    lower inclusive boundary of random numbers. (default=0)

  • high (Numeric)

    upper exclusive boundary of random numbers. (default=1 or 1+1i for complex types)

Returns:

 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574
# File 'ext/numo/narray/types/dcomplex.c', line 5542 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 142 "/home/masa/numo/numo-narray/ext/numo/narray/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 151 "/home/masa/numo/numo-narray/ext/numo/narray/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 165 "/home/masa/numo/numo-narray/ext/numo/narray/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.

Examples:

Numo::DFloat.new(5,5).rand_norm # => Numo::DFloat#shape=[5,5] # [[-0.581255, -0.168354, 0.586895, -0.595142, -0.802802], # [-0.326106, 0.282922, 1.68427, 0.918499, -0.0485384], # [-0.464453, -0.992194, 0.413794, -0.60717, -0.699695], # [-1.64168, 0.48676, -0.875871, -1.43275, 0.812172], # [-0.209975, -0.103612, -0.878617, -1.42495, 1.0968]]  Numo::DFloat.new(5,5).rand_norm(10,0.1) # => Numo::DFloat#shape=[5,5] # [[9.9019, 9.90339, 10.0826, 9.98384, 9.72861], # [9.81507, 10.0272, 9.91445, 10.0568, 9.88923], # [10.0234, 9.97874, 9.96011, 9.9006, 9.99964], # [10.0186, 9.94598, 9.92236, 9.99811, 9.97003], # [9.79266, 9.95044, 9.95212, 9.93692, 10.2027]]  Numo::DComplex.new(3,3).rand_norm(5+5i) # => Numo::DComplex#shape=[3,3] # [[5.84303+4.40052i, 4.00984+6.08982i, 5.10979+5.13215i], # [4.26477+3.99655i, 4.90052+5.00763i, 4.46607+2.3444i], # [4.5528+7.11003i, 5.62117+6.69094i, 5.05443+5.35133i]]

Parameters:

  • mu (Numeric)

    mean of normal distribution. (default=0)

  • sigma (Numeric)

    standard deviation of normal distribution. (default=1)

Returns:

 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677
# File 'ext/numo/narray/types/dcomplex.c', line 5655 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; }

#realNumo::DFloat

real of self.

Returns:

 3290 3291 3292 3293 3294 3295 3296 3297 3298
# File 'ext/numo/narray/types/dcomplex.c', line 3290 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); }

#reciprocalNumo::DComplex

Unary reciprocal.

Returns:

 2893 2894 2895 2896 2897 2898 2899 2900 2901
# File 'ext/numo/narray/types/dcomplex.c', line 2893 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); }

#rintNumo::DComplex

Unary rint.

Returns:

 4126 4127 4128 4129 4130 4131 4132 4133 4134
# File 'ext/numo/narray/types/dcomplex.c', line 4126 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.

Parameters:

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).

  • axis (Numeric, Array, Range)

    Performs rms along the axis.

  • keepdims (TrueClass)

    If true, the reduced axes are left in the result array as dimensions with size one.

Returns:

 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926
# File 'ext/numo/narray/types/dcomplex.c', line 4909 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" v = na_ndloop(&ndf, 2, self, reduce); #line 46 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" return rb_funcall(v,rb_intern("extract"),0); }

#roundNumo::DComplex

Unary round.

Returns:

 3874 3875 3876 3877 3878 3879 3880 3881 3882
# File 'ext/numo/narray/types/dcomplex.c', line 3874 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.

Examples:

Numo::DFloat.new(6).seq(1,-0.2) # => Numo::DFloat#shape=[6] # [1, 0.8, 0.6, 0.4, 0.2, 0]  Numo::DComplex.new(6).seq(1,-0.2+0.2i) # => Numo::DComplex#shape=[6] # [1+0i, 0.8+0.2i, 0.6+0.4i, 0.4+0.6i, 0.2+0.8i, 0+1i]

Parameters:

  • beg (Numeric)

    begining of sequence. (default=0)

  • step (Numeric)

    step of sequence. (default=1)

Returns:

 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296
# File 'ext/numo/narray/types/dcomplex.c', line 5276 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 87 "/home/masa/numo/numo-narray/ext/numo/narray/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 91 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/seq.c" na_ndloop3(&ndf, g, 1, self); return self; }

#set_imag(a1) ⇒ Object Also known as: imag=

 3472 3473 3474 3475 3476 3477 3478 3479 3480
# File 'ext/numo/narray/types/dcomplex.c', line 3472 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=

 3531 3532 3533 3534 3535 3536 3537 3538 3539
# File 'ext/numo/narray/types/dcomplex.c', line 3531 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; }

#signNumo::DComplex

Unary sign.

Returns:

 2977 2978 2979 2980 2981 2982 2983 2984 2985
# File 'ext/numo/narray/types/dcomplex.c', line 2977 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); }

#squareNumo::DComplex

Unary square.

Returns:

 3061 3062 3063 3064 3065 3066 3067 3068 3069
# File 'ext/numo/narray/types/dcomplex.c', line 3061 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.

Parameters:

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).

  • axis (Numeric, Array, Range)

    Performs stddev along the axis.

  • keepdims (TrueClass)

    If true, the reduced axes are left in the result array as dimensions with size one.

Returns:

 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808
# File 'ext/numo/narray/types/dcomplex.c', line 4791 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" v = na_ndloop(&ndf, 2, self, reduce); #line 46 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" return rb_funcall(v,rb_intern("extract"),0); }

#store(other) ⇒ Numo::DComplex

Store elements to Numo::DComplex from other.

Parameters:

  • other (Object)

Returns:

 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 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253
# File 'ext/numo/narray/types/dcomplex.c', line 1134 static VALUE dcomplex_store(VALUE self, VALUE obj) { VALUE r, klass; klass = rb_obj_class(obj); if (klass==numo_cDComplex) { dcomplex_store_dcomplex(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (IS_INTEGER_CLASS(klass) || klass==rb_cFloat || klass==rb_cComplex) { dcomplex_store_numeric(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cBit) { dcomplex_store_bit(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cSComplex) { dcomplex_store_scomplex(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cDFloat) { dcomplex_store_dfloat(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cSFloat) { dcomplex_store_sfloat(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cInt64) { dcomplex_store_int64(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cInt32) { dcomplex_store_int32(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cInt16) { dcomplex_store_int16(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cInt8) { dcomplex_store_int8(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cUInt64) { dcomplex_store_uint64(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cUInt32) { dcomplex_store_uint32(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cUInt16) { dcomplex_store_uint16(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cUInt8) { dcomplex_store_uint8(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" if (klass==numo_cRObject) { dcomplex_store_robject(self,obj); return self; } #line 19 "/home/masa/numo/numo-narray/ext/numo/narray/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 (rb_obj_class(r)==cT) { dcomplex_store(self,r); return self; } } #line 36 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/store.c" rb_raise(nary_eCastError, "unknown conversion from %s to %s", rb_class2name(rb_obj_class(obj)), rb_class2name(rb_obj_class(self))); return self; }

#sum(axis: nil, keepdims: false, nan: false) ⇒ Numo::DComplex

sum of self.

Parameters:

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).

  • axis (Numeric, Array, Range)

    Performs sum along the axis.

  • keepdims (TrueClass)

    If true, the reduced axes are left in the result array as dimensions with size one.

Returns:

 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572
# File 'ext/numo/narray/types/dcomplex.c', line 4555 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" v = na_ndloop(&ndf, 2, self, reduce); return dcomplex_extract(v); #line 48 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" }

#to_aArray

Convert self to Array.

Returns:

  • (Array)
 1554 1555 1556 1557 1558 1559 1560 1561
# File 'ext/numo/narray/types/dcomplex.c', line 1554 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); }

#truncNumo::DComplex

Unary trunc.

Returns:

 4042 4043 4044 4045 4046 4047 4048 4049 4050
# File 'ext/numo/narray/types/dcomplex.c', line 4042 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.

Parameters:

  • nan (TrueClass)

    If true, apply NaN-aware algorithm (avoid NaN for sum/mean etc, or, return NaN for min/max etc).

  • axis (Numeric, Array, Range)

    Performs var along the axis.

  • keepdims (TrueClass)

    If true, the reduced axes are left in the result array as dimensions with size one.

Returns:

 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867
# File 'ext/numo/narray/types/dcomplex.c', line 4850 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 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" v = na_ndloop(&ndf, 2, self, reduce); #line 46 "/home/masa/numo/numo-narray/ext/numo/narray/gen/tmpl/accum.c" return rb_funcall(v,rb_intern("extract"),0); }