Name

SPVM::R::OP::Double - N-Dimensional Array Operations for R::NDArray::Double

Description

R::OP::Double class in SPVM has methods for n-dimensional array operations for R::NDArray::Double.

Usage

use R::OP::Double as DOP;

my $ndarray_scalar = DOP->c((double)1);

my $ndarray_vector = DOP->c([(double)1, 2, 3]);

my $ndarray = DOP->c([(double)1, 2, 3, 4, 5, 6], [3, 2]);

my $ndarray2 = DOP->c($ndarray);

Class Methods

c

static method c : R::NDArray::Double ($data : object of Double|double[]|R::NDArray::Double, $dim : int[] = undef);

Creates a new R::NDArray::Double object given the data $data and the dimensions $dim.

Implemetation:

If $data is defined and the type of $data is Double, $data is set to [(double)$data-(Double)]>.

If $data is defined and the type of $data is R::NDArray::Double, $dim is set to $data->(R::NDArray::Double)->dim unless $dim is defined and $data is set to $data->(R::NDArray::Double)->data.

And this method calls R::NDArray::Double#new method given $dim and $data.

Exceptions:

The type of the data $data must be Double, double[], or R::NDArray::Double if defined. Othrewise, an exception is thrown.

add

static method add : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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.

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.

sub

static method sub : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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.

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.

mul

static method mul : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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.

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.

scamul

static method scamul : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $scalar_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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 sets each element of the new n-dimensional array and the n-dimensional array $scalar_ndarray at data index 0 to the each operation result, and returns the new n-dimensional array.

Exceptions:

The n-dimensional array $scalar_ndarray must be defined. Otherwise, an exception is thrown.

The n-dmension array $scalar_ndarray must be a scalar.

The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.

div

static method div : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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.

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.

scadiv

static method scadiv : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $scalar_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs division / operations on the n-dimensional array $scalar_ndarray at data index 0 and 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 $scalar_ndarray must be defined. Otherwise, an exception is thrown.

The n-dmension array $scalar_ndarray must be a scalar.

The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.

neg

static method neg : R::NDArray::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#fabs 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::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

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::Double, $y_ndarray : R::NDArray::Double);

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::Double, $y_ndarray : R::NDArray::Double);

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::Double, $y_ndarray : R::NDArray::Double);

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::Double, $y_ndarray : R::NDArray::Double);

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::Double, $y_ndarray : R::NDArray::Double);

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::Double ($x_ndarray : R::NDArray::Double, $times : int);

Same as R::OP#rep method, but the return type is different.

rep_length

static method rep_length : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $length : int);

Same as R::OP#rep_length method, but the return type is different.

seq

static method seq : R::NDArray::Double ($begin : double, $end : double, $by : double = 1);

Creates a R::NDArray::Double 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::Double ($begin : double, $end : double, $length : int);

Creates a R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#sin 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cos 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#tan 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#sinh 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cosh 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#tanh 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#acos 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#asin 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#atan 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#asinh 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#acosh 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#atanh 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#exp 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#expm1 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#log 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#logb 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#log2 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#log10 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#sqrt 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::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#isinf 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::Double);

Same as "isinf" method.

is_finite

static method is_finite : R::NDArray::Int ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#isnan 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::Double);

Same as "isnan" method.

pow

static method pow : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#pow 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.

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.

atan2

static method atan2 : R::NDArray::Double ($y_ndarray : R::NDArray::Double, $x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#atan2 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::Double ($x_ndarray : R::NDArray::Double, $intpart_ndarray_ref : R::NDArray::Double[]);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#modf 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#ceil 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::Double ($x_ndarray : R::NDArray::Double);

Same as "ceil" method.

floor

static method floor : R::NDArray::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#floor 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#round 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::Double);

Creates a new R::NDArray::Long object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#lround 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::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#remainder 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.

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.

fmod

static method fmod : R::NDArray::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#fmod 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.

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.

sum

static method sum : R::NDArray::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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
[(double)3, 1, 4, 1, 5, 9, 2, 6, 5]

# result
[(double)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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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
[(double)2, 3, 4, 5]

# result
[(double)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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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
[(double)2, 4, 7]

# result
[(double)2, 3]

Exceptions:

The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.

max

static method max : R::NDArray::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($x_ndarray : R::NDArray::Double, $y_ndarray : R::NDArray::Double);

Creates a new R::NDArray::Double 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::Double ($length : int, $options : object[]);

Creates a new R::NDArray::Double object of the dimensions [$length] for a return value, generates random numbers from a uniform distribution between a specified minimum value min option and maximum value max option.

seed_ref option for a seed can be available.

Examples:

my $length = 10;
my $ret_ndarray = R::OP::Double->runif($length, {min => 0, max => 100});

my $seed_ref = [(int)(Sys->time * Sys->process_id)];
my $length = 10;
my $ret_ndarray = R::OP::Double->runif($length, {min => 0, max => 100, seed_ref => $seed_ref});

Exceptions:

If non-available options are specified, an exception is thrown.

pi

static method pi : R::NDArray::Double ();

Creates a new R::NDArray::Double object of the dimensions [1] for a return value, sets the element of the new n-dimensional array to the return value os Math#PI method, and returns the new n-dimensional array.

See Also

Copyright & License

Copyright (c) 2024 Yuki Kimoto

MIT License