Skip to contents

Applies a reduction to a LazyTensor.

Usage

reduction.LazyTensor(x, opstr, index, opt_arg = NULL)

Arguments

x

a LazyTensor or a ComplexLazyTensor.

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 index i or j.

opt_arg

an optional argument: an integer (e.g. for Kmin reduction), a character, a LazyTensor or a ComplexLazyTensor. NULL if not used (default).

Value

an array storing the result of the specified reduction.

Details

reduction.LazyTensor(x, opstr, index) will :

  • if index = "i", return the opstr reduction of x over the "i" indexes;

  • if index = "j", return the opstr reduction of x over the "j" indexes.

Author

Chloe Serre-Combe, Amelie Vernay

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")
}