Learn R Programming

CVXR (version 1.0-14)

scalene: Scalene Function

Description

The elementwise weighted sum of the positive and negative portions of an expression, \(\alpha\max(x_i,0) - \beta\min(x_i,0)\). This is equivalent to alpha*pos(x) + beta*neg(x).

Usage

scalene(x, alpha, beta)

Value

An Expression representing the scalene function evaluated at the input.

Arguments

x

An Expression, vector, or matrix.

alpha

The weight on the positive portion of x.

beta

The weight on othe negative portion of x.

Examples

Run this code
if (FALSE) {
A <- Variable(2,2)
val <- cbind(c(-5,2), c(-3,1))
prob <- Problem(Minimize(scalene(A,2,3)[1,1]), list(A == val))
result <- solve(prob)
result$value
result$getValue(scalene(A, 0.7, 0.3))
}

Run the code above in your browser using DataLab