Pnorm-class function

The Pnorm class.

The Pnorm class.

This class represents the vector p-norm. class

Pnorm(x, p = 2, axis = NA_real_, keepdims = FALSE, max_denom = 1024) ## S4 method for signature 'Pnorm' allow_complex(object) ## S4 method for signature 'Pnorm' to_numeric(object, values) ## S4 method for signature 'Pnorm' validate_args(object) ## S4 method for signature 'Pnorm' sign_from_args(object) ## S4 method for signature 'Pnorm' is_atom_convex(object) ## S4 method for signature 'Pnorm' is_atom_concave(object) ## S4 method for signature 'Pnorm' is_atom_log_log_convex(object) ## S4 method for signature 'Pnorm' is_atom_log_log_concave(object) ## S4 method for signature 'Pnorm' is_incr(object, idx) ## S4 method for signature 'Pnorm' is_decr(object, idx) ## S4 method for signature 'Pnorm' is_pwl(object) ## S4 method for signature 'Pnorm' get_data(object) ## S4 method for signature 'Pnorm' name(x) ## S4 method for signature 'Pnorm' .domain(object) ## S4 method for signature 'Pnorm' .grad(object, values) ## S4 method for signature 'Pnorm' .column_grad(object, value)

Arguments

  • x: An Expression representing a vector or matrix.
  • p: A number greater than or equal to 1, or equal to positive infinity.
  • axis: (Optional) The dimension across which to apply the function: 1 indicates rows, 2 indicates columns, and NA indicates rows and columns. The default is NA.
  • keepdims: (Optional) Should dimensions be maintained when applying the atom along an axis? If FALSE, result will be collapsed into an nx1n x 1 column vector. The default is FALSE.
  • max_denom: (Optional) The maximum denominator considered in forming a rational approximation for pp. The default is 1024.
  • object: A Pnorm object.
  • values: A list of numeric values for the arguments
  • idx: An index into the atom.
  • value: A numeric value

Details

If given a matrix variable, Pnorm will treat it as a vector and compute the p-norm of the concatenated columns.

For p1p \geq 1, the p-norm is given by

xp=(i=1nxip)1/p \|x\|_p = \left(\sum_{i=1}^n |x_i|^p\right)^{1/p}

with domain xRnx \in \mathbf{R}^n. For p<1,p0p < 1, p\neq 0, the p-norm is given by

xp=(i=1nxip)1/p \|x\|_p = \left(\sum_{i=1}^n x_i^p\right)^{1/p}

with domain xR+nx \in \mathbf{R}^n_+.

  • Note that the "p-norm" is actually a norm only when p1p \geq 1 or p=+p = +\infty. For these cases, it is convex.
  • The expression is undefined when p=0p = 0.
  • Otherwise, when p\<1p \< 1, the expression is concave, but not a true norm.

Methods (by generic)

  • allow_complex(Pnorm): Does the atom handle complex numbers?
  • to_numeric(Pnorm): The p-norm of x.
  • validate_args(Pnorm): Check that the arguments are valid.
  • sign_from_args(Pnorm): The atom is positive.
  • is_atom_convex(Pnorm): The atom is convex if p1p \geq 1.
  • is_atom_concave(Pnorm): The atom is concave if p\<1p \< 1.
  • is_atom_log_log_convex(Pnorm): Is the atom log-log convex?
  • is_atom_log_log_concave(Pnorm): Is the atom log-log concave?
  • is_incr(Pnorm): The atom is weakly increasing if p\<1p \< 1 or p1p \> 1 and x is positive.
  • is_decr(Pnorm): The atom is weakly decreasing if p1p \> 1 and x is negative.
  • is_pwl(Pnorm): The atom is not piecewise linear unless p=1p = 1 or p=p = \infty.
  • get_data(Pnorm): Returns list(p, axis).
  • name(Pnorm): The name and arguments of the atom.
  • .domain(Pnorm): Returns constraints describing the domain of the node
  • .grad(Pnorm): Gives the (sub/super)gradient of the atom w.r.t. each variable
  • .column_grad(Pnorm): Gives the (sub/super)gradient of the atom w.r.t. each column variable

Slots

  • x: An Expression representing a vector or matrix.
  • p: A number greater than or equal to 1, or equal to positive infinity.
  • max_denom: The maximum denominator considered in forming a rational approximation for pp.
  • axis: (Optional) The dimension across which to apply the function: 1 indicates rows, 2 indicates columns, and NA indicates rows and columns. The default is NA.
  • keepdims: (Optional) Should dimensions be maintained when applying the atom along an axis? If FALSE, result will be collapsed into an nx1n x 1 column vector. The default is FALSE.
  • .approx_error: (Internal) The absolute difference between pp and its rational approximation.
  • .original_p: (Internal) The original input pp.
  • Maintainer: Anqi Fu
  • License: Apache License 2.0 | file LICENSE
  • Last published: 2024-11-07