The Power class.
Description
This class represents the elementwise power function f(x)=xp
.
If expr
is a CVXR expression, then expr^p
is equivalent to Power(expr, p)
.
Usage
Power(x, p, max_denom = 1024)
to_numeric(object, values)
sign_from_args(object)
is_atom_convex(object)
is_atom_concave(object)
is_atom_log_log_convex(object)
is_atom_log_log_concave(object)
is_constant(object)
is_incr(object, idx)
is_decr(object, idx)
is_quadratic(object)
is_qpwa(object)
.grad(object, values)
.domain(object)
get_data(object)
copy(object, args = NULL, id_objects = list())
name(x)
Arguments
x |
The Expression to be raised to a power.
|
p |
A numeric value indicating the scalar power.
|
max_denom |
The maximum denominator considered in forming a rational approximation of p .
|
object |
A Power object.
|
values |
A list of numeric values for the arguments
|
idx |
An index into the atom.
|
args |
A list of arguments to reconstruct the atom. If args=NULL, use the current args of the atom
|
id_objects |
Currently unused.
|
Details
For p=0
, f(x)=1
, constant, positive.
For p=1
, f(x)=x
, affine, increasing, same sign as x
.
For p=2,4,8,...
, f(x)=∣x∣p
, convex, signed monotonicity, positive.
For p<0
and f(x)=
xp
-
for x>0
+∞
-
x≤0
, this function is convex, decreasing, and positive.
For 0<p<1
and f(x)=
xp
-
for x≥0
−∞
-
x<0
, this function is concave, increasing, and positive.
For p>1,p=2,4,8,…
and f(x)=
xp
-
for x≥0
+∞
-
x<0
, this function is convex, increasing, and positive.
Methods (by generic)
-
to_numeric(Power)
: Throw an error if the power is negative and cannot be handled.
-
sign_from_args(Power)
: The sign of the atom.
-
is_atom_convex(Power)
: Is p≤0
or p≥1
?
-
is_atom_concave(Power)
: Is p≥0
or p≤1
?
-
is_atom_log_log_convex(Power)
: Is the atom log-log convex?
-
is_atom_log_log_concave(Power)
: Is the atom log-log concave?
-
is_constant(Power)
: A logical value indicating whether the atom is constant.
-
is_incr(Power)
: A logical value indicating whether the atom is weakly increasing.
-
is_decr(Power)
: A logical value indicating whether the atom is weakly decreasing.
-
is_quadratic(Power)
: A logical value indicating whether the atom is quadratic.
-
is_qpwa(Power)
: A logical value indicating whether the atom is quadratic of piecewise affine.
-
.grad(Power)
: Gives the (sub/super)gradient of the atom w.r.t. each variable
-
.domain(Power)
: Returns constraints describng the domain of the node
-
get_data(Power)
: A list containing the output of pow_low, pow_mid
, or pow_high
depending on the input power.
-
copy(Power)
: Returns a shallow copy of the power atom
-
name(Power)
: Returns the expression in string form.
Slots
x
-
The Expression to be raised to a power.
p
-
A numeric value indicating the scalar power.
max_denom
-
The maximum denominator considered in forming a rational approximation of p
.