Skip to contents

Symbolic power binary operation for LazyTensor objects.

Usage

# S3 method for LazyTensor
^(x, y)

Arguments

x, y

a LazyTensor, a ComplexLazyTensor, a vector of numeric values, or a scalar value.

Value

An object of class LazyTensor.

Details

If x or y is a LazyTensor, x^y returns a LazyTensor that encodes, symbolically, the element-wise value of x to the power of y. (In case one of the arguments is a vector or a scalar, it is first converted to LazyTensor).

Note:

  • if y = 2, x^y relies on the "Square" KeOps operation;

  • if y = 0.5, x^y uses on the "Sqrt" KeOps operation;

  • if y = -0.5, x^y uses on the "Rsqrt" KeOps operation.

Author

Chloe Serre-Combe, Amelie Vernay

Examples

if (FALSE) {
x <- matrix(runif(150 * 3), 150, 3) # arbitrary R matrix, 150 rows, 3 columns
y <- matrix(runif(250 * 3), 250, 3) # arbitrary R matrix, 250 rows, 3 columns
x_i <- LazyTensor(x, index = 'i')   # creating LazyTensor from matrix x, 
                                    # indexed by 'i'
y_j <- LazyTensor(y, index = 'j')   # creating LazyTensor from matrix y, 
                                    # indexed by 'j'
x_pow_y <- x_i^y_j                  # symbolic matrix
}