Symbolic element-wise square operation for LazyTensor
objects or
standard element-wise square operation otherwise, i.e. \(x^2\).
Arguments
- x
input for
square.default()
orsquare.LazyTensor()
.
Value
See value of square.default()
or
square.LazyTensor()
Details
If x
is a LazyTensor
, see square.LazyTensor()
, else
see square.default()
.
Examples
if (FALSE) {
# Numerical input
square(4)
square(1:4)
# LazyTensor symbolic element-wise square
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'
Square_x <- square(x_i) # symbolic matrix, 150 rows and 3 columns
}