Skip to contents

Symbolic addition for LazyTensor objects.

Usage

## S3 method for class 'LazyTensor'
+x
x + y

## S3 method for class 'ComplexLazyTensor'
+x
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 addition of x and y. (In case one of the arguments is a vector or a scalar, it is first converted to LazyTensor).

Note: x and y input arguments should have the same inner dimension or be of dimension 1.

See also

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(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'
y_j <- LazyTensor(y, index = 'j')   # creating LazyTensor from matrix y, 
                                    # indexed by 'j'
Sum_xy <- x_i + y_j                 # symbolic matrix, 150 rows and 3 columns
}