Name
SPVM::R::OP::Float - N-Dimensional Array Operations for R::NDArray::Float
Description
R::OP::Float class in SPVM has methods for n-dimensional array operations for R::NDArray::Float.
Usage
use R::OP::Float as FOP;
my $ndarray_scalar = FOP->c((float)1);
my $ndarray_vector = FOP->c([(float)1, 2, 3]);
my $ndarray = FOP->c([(float)1, 2, 3, 4, 5, 6], [3, 2]);
my $ndarray2 = FOP->c($ndarray);
Class Methods
c
static method c : R::NDArray::Float ($data : object of Float|float[]|R::NDArray::Float, $dim : int[] = undef);
Creates a new R::NDArray::Float object given the data $data and the dimensions $dim.
Implemetation:
If $data is defined and the type of $data is Float, $data is set to [(float)$data-
(Float)]>.
If $data is defined and the type of $data is R::NDArray::Float, $dim is set to $data->(R::NDArray::Float)->dim
unless $dim is defined and $data is set to $data->(R::NDArray::Float)->data
.
And this method calls R::NDArray::Float#new method given $dim and $data.
Exceptions:
The type of the data $data must be Float, float[], or R::NDArray::Float if defined. Othrewise, an exception is thrown.
add
static method add : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs addition +
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
$y_ndarray allows to be a scalar. In that case, each element used in the operation is the element at index 0.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray if $y_ndarray is not a scalar. Otherwise, an exception is thrown.
sub
static method sub : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs subtraction -
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
$y_ndarray allows to be a scalar. In that case, each element used in the operation is the element at index 0.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray if $y_ndarray is not a scalar. Otherwise, an exception is thrown.
mul
static method mul : R::NDArray::Float ($y_ndarray : R::NDArray::Float, $x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs multiplication *
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
$y_ndarray allows to be a scalar. In that case, each element used in the operation is the element at index 0.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray if $y_ndarray is not a scalar. Otherwise, an exception is thrown.
div
static method div : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs division /
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
$y_ndarray allows to be a scalar. In that case, each element used in the operation is the element at index 0.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray if $y_ndarray is not a scalar. Otherwise, an exception is thrown.
neg
static method neg : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs negation -
operation on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
abs
static method abs : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#fabsf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
eq
static method eq : R::NDArray::Int ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs numeric comparison ==
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray. Otherwise, an exception is thrown.
ne
static method ne : R::NDArray::Int ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs numeric comparison !=
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray. Otherwise, an exception is thrown.
gt
static method gt : R::NDArray::Int ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs numeric comparison >
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray. Otherwise, an exception is thrown.
ge
static method ge : R::NDArray::Int ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs numeric comparison >=
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray. Otherwise, an exception is thrown.
lt
static method lt : R::NDArray::Int ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs numeric comparison <
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray. Otherwise, an exception is thrown.
le
static method le : R::NDArray::Int ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs numeric comparison <=
operation on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray. Otherwise, an exception is thrown.
rep
static method rep : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $times : int);
Same as R::OP#rep method, but the return type is different.
rep_length
static method rep_length : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $length : int);
Same as R::OP#rep_length method, but the return type is different.
seq
static method seq : R::NDArray::Float ($begin : float, $end : float, $by : float = 1);
Creates a R::NDArray::Float object from $bigin to $end at intervals of $by.
Exceptions:
$by must not be 0. Otherwise, an exception is thrown.
If $by is greater than 0 and $end is not greater than or equal to $begin, an exception is thrown.
If $by is less than 0 and $end Is not greater than or equal to $begin, an exception is thrown.
seq_length
static method seq_length : R::NDArray::Float ($begin : float, $end : float, $length : int);
Creates a R::NDArray::Float object from $bigin to $end up to length $length.
An interval $by is calcurated by (($end - $begin + 1) / $length)
.
This method calls "seq" method given $by.
Exceptions:
Exceptions thrown by "seq" method could be thronw.
sin
static method sin : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#sinf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
cos
static method cos : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cosf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array. Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
tan
static method tan : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#tanf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array. Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
sinh
static method sinh : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#sinhf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
cosh
static method cosh : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#coshf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
tanh
static method tanh : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#tanhf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
acos
static method acos : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#acosf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
asin
static method asin : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#asinf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
atan
static method atan : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#atanf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
asinh
static method asinh : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#asinhf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
acosh
static method acosh : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#acoshf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
atanh
static method atanh : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#atanhf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
exp
static method exp : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#expf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
expm1
static method expm1 : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#expm1f method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
log
static method log : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#logf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array. Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
logb
static method logb : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#logbf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
log2
static method log2 : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#log2f method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
log10
static method log10 : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#log10f method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
sqrt
static method sqrt : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#sqrtf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
isinf
static method isinf : R::NDArray::Int ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#isinff method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
is_infinite
static method is_infinite : R::NDArray::Int ($x_ndarray : R::NDArray::Float);
Same as "isinf" method.
is_finite
static method is_finite : R::NDArray::Int ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, checks if the value is finite on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Implementation:
Returns R::OP::Int->and(R::OP::Int->not(&isnan($x_ndarray)), R::OP::Int->not(&is_infinite($x_ndarray)))
.
isnan
static method isnan : R::NDArray::Int ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#isnanf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
is_nan
static method is_nan : R::NDArray::Int ($x_ndarray : R::NDArray::Float);
Same as "isnan" method.
pow
static method pow : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#powf method given each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
$y_ndarray allows to be a scalar. In that case, each element used in the operation is the element at index 0.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray if $y_ndarray is not a scalar. Otherwise, an exception is thrown.
atan2
static method atan2 : R::NDArray::Float ($y_ndarray : R::NDArray::Float, $x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#atan2f method given each element of the n-dimensional array $y_ndarray and $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray. Otherwise, an exception is thrown.
modf
static method modf : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $intpart_ndarray_ref : R::NDArray::Float[]);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#modff method given each element of the n-dimensional array $x_ndarray and $intpart_ndarray_ref, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The array of the n-dimensional array $intpart_ndarray_ref must be defined. Otherwise, an exception is thrown.
The integer part n-dimensional array $intpart_ndarray_ref must be defined. Otherwise, an exception is thrown.
The length of integer part n-dimensional array $intpart_ndarray_ref must be 1. Otherwise, an exception is thrown.
ceil
static method ceil : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#ceilf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
ceiling
static method ceiling : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Same as "ceil" method.
floor
static method floor : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#floorf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
round
static method round : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#roundf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
lround
static method lround : R::NDArray::Long ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Long object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#lroundf method on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
remainder
static method remainder : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#remainderf method on on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
$y_ndarray allows to be a scalar. In that case, each element used in the operation is the element at index 0.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray if $y_ndarray is not a scalar. Otherwise, an exception is thrown.
fmod
static method fmod : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#fmodf method on on each element of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
$y_ndarray allows to be a scalar. In that case, each element used in the operation is the element at index 0.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The dimensions of $x_ndarray must be equal to the dimensions of $y_ndarray if $y_ndarray is not a scalar. Otherwise, an exception is thrown.
sum
static method sum : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object with the dimenstion [1]
for a return value, calculates the sum of all elements of the n-dimensional array $x_ndarray, and sets the element of the new n-dimensional array to the result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
cumsum
static method cumsum : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, calculates the cumulative sum on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Examples are
# data
[(float)3, 1, 4, 1, 5, 9, 2, 6, 5]
# result
[(float)0, 3, 4, 8, 9, 14, 23, 25, 31, 36]
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
prod
static method prod : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object with the dimenstion [1]
for a return value, calculates the production of all elements of the n-dimensional array $x_ndarray, and sets the element of the new n-dimensional array to the result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
cumprod
static method cumprod : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, calculates the cumulative product on each element of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Examples are
# data
[(float)2, 3, 4, 5]
# result
[(float)2, 6, 24, 120]
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
diff
static method diff : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the dimensions as the n-dimensional array $x_ndarray minus 1 for a return value, calculats the difference of adjacent elements of the n-dimensional array $x_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Examples are
# data
[(float)2, 4, 7]
# result
[(float)2, 3]
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
max
static method max : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object with the dimenstion [1]
for a return value, calculates the maximum value of all elements of the n-dimensional array $x_ndarray, and sets the element of the new n-dimensional array to the result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
min
static method min : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object with the dimenstion [1]
for a return value, calculates the minimum value of all elements of the n-dimensional array $x_ndarray, and sets the element of the new n-dimensional array to the result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
mean
static method mean : R::NDArray::Float ($x_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object with the dimenstion [1]
for a return value, calculates the mean of all elements of the n-dimensional array $x_ndarray, and sets the element of the new n-dimensional array to the result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
dot
static method dot : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs dot product of elements of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $x_ndarray must be a vector. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be a vector. Otherwise, an exception is thrown.
The length of the n-dimensional array $x_ndarray must be equal to the length of the n-dimensional array $y_ndarray. Otherwise, an exception is thrown.
cross
static method cross : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs cross product of elements of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array. Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $x_ndarray must be a vector. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be a vector. Otherwise, an exception is thrown.
The length of the n-dimensional array $x_ndarray must be equal to the length of the n-dimensional array $y_ndarray. Otherwise, an exception is thrown.
The length of n-dimensional array $x_ndarray must be 3.
The length of n-dimensional array $y_ndarray must be 3.
outer
static method outer : R::NDArray::Float ($x_ndarray : R::NDArray::Float, $y_ndarray : R::NDArray::Float);
Creates a new R::NDArray::Float object of the dimensions [$x_dim, $y_dim]
($x_dim is the dimensions of $x_ndarray and $y_dim is the dimensions of $y_ndarray) for a return value, performs outer product of elements of the n-dimensional array $x_ndarray and $y_ndarray, and sets each element of the new n-dimensional array to the each operation result, and returns the new n-dimensional array.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $x_ndarray must be a vector. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be defined. Otherwise, an exception is thrown.
The n-dimensional array $y_ndarray must be a vector. Otherwise, an exception is thrown.
runif
static method runif : R::NDArray::Float ($length : int, $options : object[]);
Same as R::OP::Double#runif method, but the return type is different.
pi
static method pi : R::NDArray::Float ();
Same as R::OP::Double#pi method, but the return type is different.
See Also
Copyright & License
Copyright (c) 2024 Yuki Kimoto
MIT License