Class: Numo::UInt32
- Defined in:
- ext/numo/narray/src/t_uint32.c,
ext/numo/narray/src/t_uint32.c
Overview
32-bit unsinged integer N-dimensional array class.
Constant Summary collapse
- UPCAST =
Upcasting rules of UInt32.
hCast- ELEMENT_BIT_SIZE =
Element size of UINT32 in bits.
INT2FIX(sizeof(dtype) * 8)
- ELEMENT_BYTE_SIZE =
Element size of UINT32 in bytes.
INT2FIX(sizeof(dtype))
- CONTIGUOUS_STRIDE =
Stride size of contiguous UINT32 array.
INT2FIX(sizeof(dtype))
- MAX =
The largest representable value of UINT32.
M_MAX- MIN =
The smallest representable value of UINT32.
M_MIN
Constants inherited from NArray
NArray::ALTERNATIVE, NArray::VERSION
Class Method Summary collapse
- .[] ⇒ Object
-
.cast ⇒ Object
Cast object to Numo::UInt32.
-
.maximum(a1, a2) ⇒ Numo::UInt32
Element-wise maximum of two arrays.
-
.minimum(a1, a2) ⇒ Numo::UInt32
Element-wise minimum of two arrays.
Instance Method Summary collapse
-
#%(other) ⇒ Numo::NArray
Binary mod.
-
#&(other) ⇒ Numo::NArray
Binary bit_and.
-
#*(other) ⇒ Numo::NArray
Binary mul.
-
#**(other) ⇒ Numo::NArray
(also: #pow)
Binary power.
-
#+(other) ⇒ Numo::NArray
Binary add.
-
#-(other) ⇒ Numo::NArray
Binary sub.
-
#-@ ⇒ Numo::UInt32
Unary minus.
-
#/(other) ⇒ Numo::NArray
Binary div.
-
#<<(other) ⇒ Numo::NArray
Binary left_shift.
-
#>>(other) ⇒ Numo::NArray
Binary right_shift.
-
#[](dim0, ..., dimL) ⇒ Numeric, Numo::UInt32
Multi-dimensional element reference.
-
#[]=(dim0, ..., dimL, val) ⇒ Numeric, ...
Multi-dimensional element assignment.
-
#^(other) ⇒ Numo::NArray
Binary bit_xor.
-
#abs ⇒ Numo::UInt32
abs of self.
- #allocate ⇒ Object
-
#argmax(axis: nil) ⇒ Integer, Numo::Int
Index of the maximum value.
-
#argmin(axis: nil) ⇒ Integer, Numo::Int
Index of the minimum value.
-
#bincount([weight], minlength: nil) ⇒ UInt32 or UInt64 or SFloat or DFloat
Count the number of occurrences of each non-negative integer value.
-
#clip(min, max) ⇒ Numo::NArray
Clip array elements by [min,max].
-
#coerce_cast(type) ⇒ nil
return NArray with cast to the type of self.
-
#cumprod(axis: nil, nan: false) ⇒ Numo::UInt32
cumprod of self.
-
#cumsum(axis: nil, nan: false) ⇒ Numo::UInt32
cumsum of self.
-
#divmod(other) ⇒ Numo::NArray
Binary divmod.
-
#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
(also: #nearly_eq)
Comparison eq other.
-
#extract ⇒ Numeric, Numo::NArray
Extract an element only if self is a dimensionless NArray.
-
#eye([element,offset]) ⇒ Numo::UInt32
Eye: Set a value to diagonal components, set 0 to non-diagonal components.
-
#fill(other) ⇒ Numo::UInt32
Fill elements with other.
-
#format(format) ⇒ Numo::RObject
Format elements into strings.
-
#format_to_a(format) ⇒ Array
Format elements into strings.
-
#ge(other) ⇒ Numo::Bit
(also: #>=)
Comparison ge other.
-
#gt(other) ⇒ Numo::Bit
(also: #>)
Comparison gt other.
-
#inspect ⇒ String
Returns a string containing a human-readable representation of NArray.
-
#le(other) ⇒ Numo::Bit
(also: #<=)
Comparison le other.
-
#lt(other) ⇒ Numo::Bit
(also: #<)
Comparison lt other.
-
#map ⇒ Numo::UInt32
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.
-
#max(axis: nil, keepdims: false) ⇒ Numo::UInt32
max of self.
-
#max_index(axis: nil) ⇒ Integer, Numo::Int
Index of the maximum value.
-
#mean(axis: nil, keepdims: false, nan: false) ⇒ Numo::DFloat
mean of self.
-
#median(axis: nil, keepdims: false) ⇒ Numo::UInt32
median of self.
-
#min(axis: nil, keepdims: false) ⇒ Numo::UInt32
min of self.
-
#min_index(axis: nil) ⇒ Integer, Numo::Int
Index of the minimum value.
-
#minmax(axis: nil, keepdims: false) ⇒ Numo::UInt32
minmax of self.
-
#mulsum(other, axis: nil, keepdims: false) ⇒ Numo::NArray
Binary mulsum.
-
#ne(other) ⇒ Numo::Bit
Comparison ne other.
-
#poly(a0, a1, ..., an) ⇒ Numo::UInt32
Calculate polynomial.
-
#prod(axis: nil, keepdims: false) ⇒ Numo::UInt64
prod of self.
-
#ptp(axis: nil, keepdims: false) ⇒ Numo::UInt32
ptp of self.
-
#rand([[low],high]) ⇒ Numo::UInt32
Generate uniformly distributed random numbers on self narray.
-
#reciprocal ⇒ Numo::UInt32
Unary reciprocal.
-
#rms(axis: nil, keepdims: false, nan: false) ⇒ Numo::DFloat
rms of self.
-
#seq([beg,[step]]) ⇒ Numo::UInt32
(also: #indgen)
Set linear sequence of numbers to self.
-
#sign ⇒ Numo::UInt32
Unary sign.
-
#sort(axis: nil) ⇒ Numo::UInt32
sort of self.
-
#sort_index(axis: nil) ⇒ Integer, Numo::Int
sort_index.
-
#square ⇒ Numo::UInt32
Unary square.
-
#stddev(axis: nil, keepdims: false, nan: false) ⇒ Numo::DFloat
stddev of self.
-
#store(other) ⇒ Numo::UInt32
Store elements to Numo::UInt32 from other.
-
#sum(axis: nil, keepdims: false) ⇒ Numo::UInt64
sum of self.
-
#to_a ⇒ Array
Convert self to Array.
-
#var(axis: nil, keepdims: false, nan: false) ⇒ Numo::DFloat
var of self.
-
#|(other) ⇒ Numo::NArray
Binary bit_or.
-
#~ ⇒ Numo::UInt32
Unary bit_not.
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::UInt32
Cast object to Numo::UInt32.
.maximum(a1, a2) ⇒ Numo::UInt32
Element-wise maximum of two arrays.
.minimum(a1, a2) ⇒ Numo::UInt32
Element-wise minimum of two arrays.
Instance Method Details
#%(other) ⇒ Numo::NArray
Binary mod.
#&(other) ⇒ Numo::NArray
Binary bit_and.
#*(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::UInt32
Unary minus.
#/(other) ⇒ Numo::NArray
Binary div.
#<<(other) ⇒ Numo::NArray
Binary left_shift.
#>>(other) ⇒ Numo::NArray
Binary right_shift.
#[](dim0, ..., dimL) ⇒ Numeric, Numo::UInt32
Multi-dimensional element reference.
#[]=(dim0, ..., dimL, val) ⇒ Numeric, ...
Multi-dimensional element assignment.
#^(other) ⇒ Numo::NArray
Binary bit_xor.
#abs ⇒ Numo::UInt32
abs of self.
#allocate ⇒ Object
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'ext/numo/narray/src/t_uint32.c', line 263
static VALUE uint32_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;
}
|
#argmax(axis: nil) ⇒ Integer, Numo::Int
Index of the maximum value.
#argmin(axis: nil) ⇒ Integer, Numo::Int
Index of the minimum value.
#bincount([weight], minlength: nil) ⇒ UInt32 or UInt64 or SFloat or DFloat
Count the number of occurrences of each non-negative integer value. Only Integer-types has this method.
#clip(min, max) ⇒ Numo::NArray
Clip array elements by [min,max]. If either of min or max is nil, one side is clipped.
#coerce_cast(type) ⇒ nil
return NArray with cast to the type of self.
#cumprod(axis: nil, nan: false) ⇒ Numo::UInt32
cumprod of self.
#cumsum(axis: nil, nan: false) ⇒ Numo::UInt32
cumsum of self.
#divmod(other) ⇒ Numo::NArray
Binary divmod.
#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 Also known as: nearly_eq
Comparison eq other.
#extract ⇒ Numeric, Numo::NArray
Extract an element only if self is a dimensionless NArray.
#eye([element,offset]) ⇒ Numo::UInt32
Eye: Set a value to diagonal components, set 0 to non-diagonal components.
#fill(other) ⇒ Numo::UInt32
Fill elements with other.
#format(format) ⇒ Numo::RObject
Format elements into strings.
#format_to_a(format) ⇒ Array
Format elements into strings.
#ge(other) ⇒ Numo::Bit Also known as: >=
Comparison ge other.
#gt(other) ⇒ Numo::Bit Also known as: >
Comparison gt other.
#inspect ⇒ String
Returns a string containing a human-readable representation of NArray.
#le(other) ⇒ Numo::Bit Also known as: <=
Comparison le other.
#lt(other) ⇒ Numo::Bit Also known as: <
Comparison lt other.
#map ⇒ Numo::UInt32
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`.
#max(axis: nil, keepdims: false) ⇒ Numo::UInt32
max of self.
#max_index(axis: nil) ⇒ Integer, Numo::Int
Index of the maximum value.
#mean(axis: nil, keepdims: false, nan: false) ⇒ Numo::DFloat
mean of self.
#median(axis: nil, keepdims: false) ⇒ Numo::UInt32
median of self.
#min(axis: nil, keepdims: false) ⇒ Numo::UInt32
min of self.
#min_index(axis: nil) ⇒ Integer, Numo::Int
Index of the minimum value.
#minmax(axis: nil, keepdims: false) ⇒ Numo::UInt32
minmax of self.
#mulsum(other, axis: nil, keepdims: false) ⇒ Numo::NArray
Binary mulsum.
#ne(other) ⇒ Numo::Bit
Comparison ne other.
#poly(a0, a1, ..., an) ⇒ Numo::UInt32
Calculate polynomial.
`x.poly(a0,a1,a2,...,an) = a0 + a1*x + a2*x**2 + ... + an*x**n`
#prod(axis: nil, keepdims: false) ⇒ Numo::UInt64
prod of self.
#ptp(axis: nil, keepdims: false) ⇒ Numo::UInt32
ptp of self.
#rand([[low],high]) ⇒ Numo::UInt32
Generate uniformly distributed random numbers on self narray.
#reciprocal ⇒ Numo::UInt32
Unary reciprocal.
#rms(axis: nil, keepdims: false, nan: false) ⇒ Numo::DFloat
rms of self.
#seq([beg,[step]]) ⇒ Numo::UInt32 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.
#sign ⇒ Numo::UInt32
Unary sign.
#sort(axis: nil) ⇒ Numo::UInt32
sort of self.
#sort_index(axis: nil) ⇒ Integer, Numo::Int
sort_index. Returns an index array of sort result.
#square ⇒ Numo::UInt32
Unary square.
#stddev(axis: nil, keepdims: false, nan: false) ⇒ Numo::DFloat
stddev of self.
#store(other) ⇒ Numo::UInt32
Store elements to Numo::UInt32 from other.
#sum(axis: nil, keepdims: false) ⇒ Numo::UInt64
sum of self.
#to_a ⇒ Array
Convert self to Array.
#var(axis: nil, keepdims: false, nan: false) ⇒ Numo::DFloat
var of self.
#|(other) ⇒ Numo::NArray
Binary bit_or.
#~ ⇒ Numo::UInt32
Unary bit_not.