Symbolic element-wise sign operation for LazyTensor
objects or
default element-wise sign operation otherwise.
Arguments
- x
input for
sign.default()
orsign.LazyTensor()
.
Value
See value of sign.default()
or sign.LazyTensor()
.
Details
If x
is a LazyTensor
, see sign.LazyTensor()
, else
see sign.default()
.
The sign function is defined as follows: sign(x)={0if x=0−1if x<01if x>0
Examples
if (FALSE) {
# R base operation
sign(5)
sign(-5)
sign(-10:10)
# LazyTensor symbolic element-wise sign
x <- 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'
Sign_x <- sign(x_i) # symbolic matrix, 150 rows and 3 columns
}