^,Expression,numeric-method {CVXR}R Documentation

Elementwise Power

Description

Raises each element of the input to the power p. If expr is a CVXR expression, then expr^p is equivalent to power(expr,p).

Usage

## S4 method for signature 'Expression,numeric'
e1 ^ e2

power(x, p, max_denom = 1024)

Arguments

e1

An Expression object to exponentiate.

e2

The power of the exponential. Must be a numeric scalar.

x

An Expression, vector, or matrix.

p

A scalar value indicating the exponential power.

max_denom

The maximum denominator considered in forming a rational approximation of p.

Details

For p = 0 and f(x) = 1, this function is constant and positive. For p = 1 and f(x) = x, this function is affine, increasing, and the same sign as x. For p = 2,4,8,\ldots and f(x) = |x|^p, this function is convex, positive, with signed monotonicity. For p < 0 and f(x) =

x^p

for x > 0

+\infty

x \leq 0

, this function is convex, decreasing, and positive. For 0 < p < 1 and f(x) =

x^p

for x \geq 0

-\infty

x < 0

, this function is concave, increasing, and positivea. For p > 1, p \neq 2,4,8,\ldots and f(x) =

x^p

for x \geq 0

+\infty

x < 0

, this function is convex, increasing, and positive.

Examples

## Not run: 
x <- Variable()
prob <- Problem(Minimize(power(x,1.7) + power(x,-2.3) - power(x,0.45)))
result <- solve(prob)
result$value
result$getValue(x)

## End(Not run)

[Package CVXR version 1.0-14 Index]