Skip to contents

Symbolic subtraction for LazyTensor objects or default subtraction for otherwise.

Usage

-x
x - y

Arguments

x, y

input for -.default() or -.LazyTensor().

Value

See value of -.default() or -.LazyTensor().

Details

If x or y is a LazyTensor, see -.LazyTensor(), else see -.default().

Note: the - operand can be a binary operator, e.g. x - y, implementing the subtraction, or a unary operator, e.g. - x, implementing the "minus sign", both for LazyTensor objects or other types.

Author

Chloe Serre-Combe, Amelie Vernay

Examples

if (FALSE) {
# R base operation
+5
1 + 3
# LazyTensor symbolic subtraction
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'
Sub_xy <- x_i - y_j                 # symbolic matrix
Minus_x <- -x_i                     # symbolic matrix
}