Name
SPVM::R::OP::AnyObject - N-Dimensional Array Operations for R::NDArray::AnyObject
Description
R::OP::AnyObject class in SPVM has methods for n-dimensional array operations for R::NDArray::AnyObject.
Usage
use R::OP::AnyObject as AOP;
my $ndarray_scalar = AOP->c((object)1);
my $ndarray_vector = AOP->c([(object)1, 2, 3]);
my $ndarray = AOP->c([(object)1, 2, 3, 4, 5, 6], [3, 2]);
my $ndarray2 = AOP->c($ndarray);
Class Methods
c
static method c : R::NDArray::AnyObject ($data : object of AnyObject|AnyObject[]|R::NDArray::AnyObject, $dim : int[] = undef);
Creates a new R::NDArray::AnyObject object given the data $data and the dimensions $dim.
Implemetation:
If $data is defined and the type of $data is R::NDArray::AnyObject, $dim is set to $data->(R::NDArray::AnyObject)->dim
unless $dim is defined and $data is set to $data->(R::NDArray::AnyObject)->data
.
And this method calls R::NDArray::AnyObject#new method given $dim and $data.
Exceptions:
The type of the data $data must be AnyObject, AnyObject[], or R::NDArray::AnyObject if defined. Othrewise, an exception is thrown.
See Also
Copyright & License
Copyright (c) 2024 Yuki Kimoto
MIT License