Skip to contents

Symbolic element-wise absolute value (or modulus) operation for LazyTensor objects or default element-wise absolute value (or modulus) operation otherwise, i.e. \(\vert x \vert\).

Usage

abs(x)

Arguments

x

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

Value

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

Details

If x is a LazyTensor, see abs.LazyTensor(), else see abs.default().

Note: for complex input argument z, then the absolute value corresponds to the complex modulus abs(z) = Mod(z).

Author

Chloe Serre-Combe, Amelie Vernay

Examples

if (FALSE) {
# R base operation
abs(5)
abs(-5)
abs(-10:10)
# LazyTensor symbolic element-wise absolute value
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'
Abs_x <- abs(x_i)                   # symbolic matrix, 150 rows and 3 columns
}