Learn R Programming

CVXR (version 1.0)

pos: Elementwise Positive

Description

The elementwise positive portion of an expression, \(\max(x_i,0)\). This is equivalent to max_elemwise(x,0).

Usage

pos(x)

Arguments

x

An '>Expression, vector, or matrix.

Value

An '>Expression representing the positive portion of the input.

Examples

Run this code
# NOT RUN {
x <- Variable(2)
val <- matrix(c(-3,2))
prob <- Problem(Minimize(pos(x)[1]), list(x == val))
result <- solve(prob)
result$value
# }

Run the code above in your browser using DataLab