Learn R Programming

rkeops (version 2.2.2)

preprocess_reduction: Preprocess reduction operation.

Description

Returns a function for a reduction to a LazyTensor and it is called in rkeops::reduction.LazyTensor().

Usage

preprocess_reduction(x, opstr, index, opt_arg = NULL)

Value

A function.

Arguments

x

A LazyTensor or a ComplexLazyTensor.

opstr

A string formula (like "Sum" or "Max").

index

A character that should be either i or j to specify whether if the reduction is indexed by i (rows), or j (columns).

opt_arg

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

Author

Chloe Serre-Combe, Amelie Vernay

Details

preprocess_reduction(x, opstr, index) will:

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

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

See Also

reduction.LazyTensor()

Examples

Run this code
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'

op <- preprocess_reduction(x_i, "Sum", "i")
}

Run the code above in your browser using DataLab