Learn R Programming

CVXR (version 0.99-7)

Power-class: The Power class.

Description

This class represents the elementwise power function \(f(x) = x^p\). If expr is a CVXR expression, then expr^p is equivalent to Power(expr, p).

Usage

Power(x, p, max_denom = 1024)

# S4 method for Power validate_args(object)

# S4 method for Power get_data(object)

# S4 method for Power to_numeric(object, values)

# S4 method for Power sign_from_args(object)

# S4 method for Power is_atom_convex(object)

# S4 method for Power is_atom_concave(object)

# S4 method for Power is_constant(object)

# S4 method for Power is_incr(object, idx)

# S4 method for Power is_decr(object, idx)

# S4 method for Power is_quadratic(object)

# S4 method for Power graph_implementation(object, arg_objs, size, data = NA_real_)

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 arguments to the atom.

idx

An index into the atom.

arg_objs

A list of linear expressions for each argument.

size

A vector with two elements representing the size of the resulting expression.

data

A list of additional data required by the atom.

Methods (by generic)

  • validate_args: Verification of arguments happens during initialization.

  • get_data: A list containing the output of pow_low, pow_mid, or pow_high depending on the input power.

  • to_numeric: Throw an error if the power is negative and cannot be handled.

  • sign_from_args: The sign of the atom.

  • is_atom_convex: Is \(p \leq 0\) or \(p \geq 1\)?

  • is_atom_concave: Is \(p \geq 0\) or \(p \leq 1\)?

  • is_constant: A logical value indicating whether the atom is constant.

  • is_incr: A logical value indicating whether the atom is weakly increasing.

  • is_decr: A logical value indicating whether the atom is weakly decreasing.

  • is_quadratic: A logical value indicating whether the atom is quadratic.

  • graph_implementation: The graph implementation of the atom.

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.

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) = \)

  • \(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 positive. 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.