Class: Numo::SComplex
- Defined in:
- ext/numo/narray/src/t_scomplex.c,
ext/numo/narray/src/t_scomplex.c
Overview
Single precision floating point (32bit) complex number N-dimensional array class.
Defined Under Namespace
Modules: Math
Constant Summary collapse
- UPCAST =
Upcasting rules of SComplex.
hCast- ELEMENT_BIT_SIZE =
Element size of SComplex in bits.
INT2FIX(sizeof(dtype) * 8)
- ELEMENT_BYTE_SIZE =
Element size of SComplex in bytes.
INT2FIX(sizeof(dtype))
- CONTIGUOUS_STRIDE =
Stride size of contiguous SComplex array.
INT2FIX(sizeof(dtype))
- EPSILON =
Machine epsilon of SComplex
M_EPSILON- MAX =
The largest representable value of SComplex
M_MAX- MIN =
The smallest representable value of SComplex
M_MIN
Constants inherited from NArray
NArray::ALTERNATIVE, NArray::VERSION
Class Method Summary collapse
- .[] ⇒ Object
-
.cast ⇒ Object
Cast object to Numo::SComplex.
Instance Method Summary collapse
-
#*(other) ⇒ Numo::NArray
Binary mul.
-
#**(other) ⇒ Numo::NArray
(also: #pow)
Binary power.
-
#+(other) ⇒ Numo::NArray
Binary add.
-
#-(other) ⇒ Numo::NArray
Binary sub.
-
#-@ ⇒ Numo::SComplex
Unary minus.
-
#/(other) ⇒ Numo::NArray
Binary div.
-
#[](dim0, ..., dimL) ⇒ Numeric, Numo::SComplex
Multi-dimensional element reference.
-
#[]=(dim0, ..., dimL, val) ⇒ Numeric, ...
Multi-dimensional element assignment.
-
#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 {|x| ... } ⇒ Numo::NArray
Calls the given block once for each element in self, passing that element as a parameter.
-
#each_with_index {|x, i,j,...| ... } ⇒ 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 {|x, i,j,...| ... } ⇒ 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, ..., an) ⇒ Numo::SComplex
Calculate polynomial.
-
#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::SFloat
rms of self.
-
#round ⇒ Numo::SComplex
Unary round.
-
#seq([beg,[step]]) ⇒ Numo::SComplex
(also: #indgen)
Set linear sequence of numbers to self.
- #set_imag ⇒ Object (also: #imag=)
- #set_real ⇒ Object (also: #real=)
-
#sign ⇒ Numo::SComplex
Unary sign.
-
#square ⇒ Numo::SComplex
Unary square.
-
#stddev(axis: nil, keepdims: false, nan: false) ⇒ Numo::SFloat
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::SFloat
var of self.
Methods inherited from NArray
#==, alternative?, #append, #argsort, 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, #percentile, profile, profile=, #rad2deg, #repeat, #reshape, #reshape!, #reverse, #rot90, #row_major?, #shape, #size, #split, #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
.[] ⇒ Object
.[](elements) ⇒ Object .cast(array) ⇒ Numo::SComplex
Cast object to Numo::SComplex.
Instance Method Details
#*(other) ⇒ Numo::NArray
Binary mul.
#**(other) ⇒ Numo::NArray Also known as: pow
Binary power.
#+(other) ⇒ Numo::NArray
Binary add.
#-(other) ⇒ Numo::NArray
Binary sub.
#-@ ⇒ Numo::SComplex
Unary minus.
#/(other) ⇒ Numo::NArray
Binary div.
#[](dim0, ..., dimL) ⇒ Numeric, Numo::SComplex
Multi-dimensional element reference.
#[]=(dim0, ..., dimL, val) ⇒ Numeric, ...
Multi-dimensional element assignment.
#abs ⇒ Numo::SFloat
abs of self.
#allocate ⇒ Object
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 |
# File 'ext/numo/narray/src/t_scomplex.c', line 279
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);
NA_DATA_PTR(na) = ptr;
NA_DATA_OWNED(na) = TRUE;
}
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.
#ceil ⇒ Numo::SComplex
Unary ceil.
#coerce_cast(type) ⇒ nil
return NArray with cast to the type of self.
#conj ⇒ Numo::SComplex Also known as: 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 {|x| ... } ⇒ Numo::NArray
Calls the given block once for each element in self, passing that element as a parameter.
#each_with_index {|x, i,j,...| ... } ⇒ 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. The sequence is obtained from
`base**(beg+i*step)`
where i is 1-dimensional index. Applicable classes: DFloat, SFloat, DComplex, SCopmplex.
#map ⇒ Numo::SComplex
Unary map.
#map_with_index {|x, i,j,...| ... } ⇒ 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`.
#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 known as: close_to
Comparison nearly_eq other.
#poly(a0, a1, ..., an) ⇒ Numo::SComplex
Calculate polynomial.
`x.poly(a0,a1,a2,...,an) = a0 + a1*x + a2*x**2 + ... + an*x**n`
#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::SFloat
rms of self.
#round ⇒ Numo::SComplex
Unary round.
#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.
#set_imag ⇒ Object Also known as: imag=
#set_real ⇒ Object Also known as: real=
#sign ⇒ Numo::SComplex
Unary sign.
#square ⇒ Numo::SComplex
Unary square.
#stddev(axis: nil, keepdims: false, nan: false) ⇒ Numo::SFloat
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::SFloat
var of self.