Name
SPVM::R::OP::String - N-Dimensional Array Operations for R::NDArray::String
Description
R::OP::String class in SPVM has methods for n-dimensional array operations for R::NDArray::String.
Usage
use R::OP::String as STROP;
my $ndarray_scalar = STROP->c((string)"a");
my $ndarray_vector = STROP->c([(string)"a", "b", "c"]);
my $ndarray = STROP->c([(string)"a", "b", "c", "d", "e", "f"], [3, 2]);
my $ndarray2 = STROP->c($ndarray);
Class Methods
c
static method c : R::NDArray::String ($data : object of string|string[]|R::NDArray::String, $dim : int[] = undef);
Creates a new R::NDArray::String object given the data $data and the dimensions $dim.
Implemetation:
If $data is defined and the type of $data is string
, $data is set to [(string)$data]
.
If $data is defined and the type of $data is R::NDArray::String, $dim is set to $data->(R::NDArray::String)->dim
unless $dim is defined and $data is set to $data->(R::NDArray::String)->data
.
And this method calls R::NDArray::String#new method given $dim and $data.
Exceptions:
The type of the data $data must be string, string[], or R::NDArray::String if defined. Othrewise, an exception is thrown.
concat
static method concat : R::NDArray::String ($x_ndarray : R::NDArray::String, $y_ndarray : R::NDArray::String);
Creates a new R::NDArray::String object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs concatnation .
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.
If concatnation .
operation throw an exceptions, the element is set to undef
.
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.
eq
static method eq : R::NDArray::Int ($x_ndarray : R::NDArray::String, $y_ndarray : R::NDArray::String);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs string comparison eq
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::String, $y_ndarray : R::NDArray::String);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs string comparison ne
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::String, $y_ndarray : R::NDArray::String);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs string comparison gt
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::String, $y_ndarray : R::NDArray::String);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs string comparison ge
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::String, $y_ndarray : R::NDArray::String);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs string comparison lt
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::String, $y_ndarray : R::NDArray::String);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs string comparison le
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::String ($x_ndarray : R::NDArray::String, $times : int);
Same as R::OP#rep method, but the return type is different.
rep_length
static method rep_length : R::NDArray::String ($x_ndarray : R::NDArray::String, $length : int);
Same as R::OP#rep_length method, but the return type is different.
See Also
Copyright & License
Copyright (c) 2024 Yuki Kimoto
MIT License