Skip to contents

Symbolic element extraction operation for LazyTensor objects.

Usage

elem(x, m)

Arguments

x

a LazyTensor or a ComplexLazyTensor.

m

an integer corresponding to the index (starting from 0) of the element of x that will be extracted.

Value

a LazyTensor or a ComplexLazyTensor.

Details

If x is a LazyTensor, elem(x, m) returns a LazyTensor that encodes, symbolically, the m+1-th element of x, i.e. x[m+1] in standard R notation.

IMPORTANT: IN THIS CASE, INDICES START AT ZERO, therefore, m should be in [0, n), where n is the inner dimension of x.

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')   # LazyTensor from matrix x, indexed by 'i'
m <- 2

elem_x <- elem(x_i, m)  # symbolic `m+1`-th element of `x_i`.
}