Applies a reduction to a LazyTensor
.
Arguments
- x
a
LazyTensor
or aComplexLazyTensor
.- opstr
a
string
formula (like "Sum" or "Max").- index
a
character
corresponding to the wanted reduction dimension, either"i"
or"j"
, to specify whether if the reduction is done along the indexi
orj
.- opt_arg
an optional argument: an
integer
(e.g. forKmin
reduction), acharacter
, aLazyTensor
or aComplexLazyTensor
.NULL
if not used (default).
Details
reduction.LazyTensor(x, opstr, index)
will :
if
index = "i"
, return theopstr
reduction ofx
over the "i" indexes;if
index = "j"
, return theopstr
reduction ofx
over the "j" indexes.
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'
red_x <- reduction.LazyTensor(x_i, "Sum", "i")
}