Name
SPVM::R::OP::DoubleComplex - N-Dimensional Array Operations for R::NDArray::DoubleComplex
Description
R::OP::DoubleComplex class in SPVM has methods for n-dimensional array operations for R::NDArray::DoubleComplex.
Usage
use R::OP::DoubleComplex as DCOP;
# 1+10i
my $ndarray_scalar = DCOP->c([(double)1,10]);
# 1+10i, 2+20i, 3+30i
my $ndarray_vector = DCOP->c([(double)1,10, 2,20, 3,30]);
my $ndarray = DCOP->c([(double)1,10, 2,20, 3,30, 4,40, 5,50, 6,60], [3, 2]);
my $ndarray2 = DCOP->c($ndarray);
Class Methods
c
static method c : R::NDArray::DoubleComplex ($data : object of double[]|Complex_2d[]|R::NDArray::DoubleComplex, $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[], it is interpreted as pairs of a real number and a complex number and is converted to an array of Complex_2d, $data is set to the array.
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 length of pairs \$data must be an even number if the type of \$data is double[]. Othrewise, an exception is thrown.
The type of the data $data must be double[], Complex_2d[] or R::NDArray::DoubleComplex.
add
static method add : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cadd method 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#csub method 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_ndarrayy if $y_ndarray is not a scalar. Otherwise, an exception is thrown.
mul
static method mul : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cmul method 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cdiv method 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cneg 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.
abs
static method abs : R::NDArray::Double ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cabs 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.
re
static method re : R::NDArray::Double ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, gets the real number 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.
im
static method im : R::NDArray::Double ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, gets the image number 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.
i
static method i : R::NDArray::DoubleComplex ();
Creates a new R::NDArray::DoubleComplex object of the dimensions [1]
for a return value, sets the element of the new n-dimensional array to the return value of Math->complex(0, 1)
, and returns the new n-dimensional array.
conj
static method conj : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#conj 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.
arg
static method arg : R::NDArray::Double ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::Double object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#carg 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::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs AND operation &&
on the results of numeric comparison ==
operation on the real number and image number of 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::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::Int object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs NOT operation !
on the reust of AND operation &&
on the results of numeric comparison ==
operation on the real number and image number of 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $times : int);
Same as R::OP#rep method, but the return type is different.
rep_length
static method rep_length : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $length : int);
Same as R::OP#rep_length method, but the return type is different.
sin
static method sin : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#csin 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#ccos 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#ctan 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#csinh 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#ccosh 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#ctanh 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cacos 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#casin 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#catan 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#casinh 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cacosh 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#catanh 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cexp 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#clog 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#csqrt 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.
pow
static method pow : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex object of the same dimensions as the n-dimensional array $x_ndarray for a return value, performs Math#cpow 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.
sum
static method sum : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex 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.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
prod
static method prod : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex 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.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
diff
static method diff : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex 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.
Exceptions:
The n-dimensional array $x_ndarray must be defined. Otherwise, an exception is thrown.
mean
static method mean : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex 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::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex 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.
The dot product in this implementation is conjugate-linear in the first variable and linear in the second variable.
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.
outer
static method outer : R::NDArray::DoubleComplex ($x_ndarray : R::NDArray::DoubleComplex, $y_ndarray : R::NDArray::DoubleComplex);
Creates a new R::NDArray::DoubleComplex 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.
pi
static method pi : R::NDArray::DoubleComplex ();
Creates a new R::NDArray::DoubleComplex object of the dimensions [1]
for a return value, sets the real number of 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