Symbolically applies opstr
operation to x
.
Arguments
- x
A
LazyTensor
, aComplexLazyTensor
, a vector of numeric values, or a scalar value.- opstr
A text string corresponding to an operation.
- opt_arg
An optional argument which can be a scalar value.
- opt_arg2
An optional argument which can be a scalar value.
- res_type
NA (default) or a character string among "LazyTensor" and "ComplexLazyTensor", to specify if a change of class is required for the result. (Useful especially when dealing with complex-to-real or real-to-complex functions).
- dim_res
NA
(default) or an integer corresponding to the inner dimension of the outputLazyTensor
. IfNA
,dim_res
is set to the inner dimension of the inputLazyTensor
.
Examples
if (FALSE) {
x <- matrix(runif(150 * 3), 150, 3) # arbitrary R matrix, 150 rows, 3 columns
x_i <- LazyTensor(x, index = 'i') # creating LazyTensor from matrix x,
# indexed by 'i'
una_x <- unaryop.LazyTensor(x_i, "Minus") # symbolic matrix
una2_x <- unaryop.LazyTensor(x_i, "Pow", opt_arg = 3) # symbolic matrix
# example with not NA dim_res:
## set dim_res to 1 because the "Norm2" operation results on a (symbolic) scalar
una3_x <- unaryop.LazyTensor(x, "Norm2",
res_type = "LazyTensor",
dim_res = 1)
}