Symbolic element-wise if-else function for LazyTensor
objects or
standard element-wise if-else function otherwise.
Arguments
- test, yes, no
input for
ifelse.default()
orifelse.LazyTensor()
.
Value
See value of ifelse.default()
or
ifelse.LazyTensor()
Details
If test
is a LazyTensor
, see ifelse.LazyTensor()
, else
see ifelse.default()
.
Examples
if (FALSE) {
# R base operation
x <- c(6:-4)
sqrt(ifelse(x >= 0, x, NA))
# LazyTensor symbolic element-wise square
D <- 3
M <- 100
N <- 150
P <- 200
x <- matrix(runif(M * D), M, D)
y <- matrix(runif(N * D), N, D)
z <- matrix(runif(P * D), P, D)
x_i <- LazyTensor(x, index = 'i')
y_j <- LazyTensor(y, index = 'j')
z_i <- LazyTensor(z, index = 'i')
if_else_xyz <- ifelse(x_i, y_j, z_i)
}