The elementwise absolute value.

# S4 method for Expression
abs(x)

Arguments

x

An Expression.

Value

An Expression representing the absolute value of the input.

Examples

A <- Variable(2,2)
prob <- Problem(Minimize(sum(abs(A))), list(A <= -2))
result <- solve(prob)
result$value
#> [1] 8
result$getValue(A)
#>      [,1] [,2]
#> [1,]   -2   -2
#> [2,]   -2   -2