picos.expressions.exp_norm

Implements Norm.

Classes

class picos.expressions.exp_norm.Norm(x, p=2, q=None, denominator_limit=1000)[source]

Bases: picos.expressions.expression.Expression

Entrywise p-norm or L_{p,q}-norm of an expression.

This class can represent the absolute value, the modulus, a vector p-norm and an entrywise matrix L_{p,q}-norm of a (complex) affine expression. In addition to these convex norms, it can represent the concave generalized vector p-norm with 0 < p \leq 1.

Not all of these norms are available on the complex field; see the definitions below to learn more.

Definition

If q is not given (None), then it is set equal to p.

  1. If the normed expression is a real scalar x, then this is the absolute value

    |x| = \begin{cases}
   x, &\text{if }x \geq 0,\\
   -x, &\text{otherwise.}
\end{cases}

    The parameters p and q are ignored in this case.

  2. If the normed expression is a complex scalar z, then this is the modulus

    |z| = \sqrt{\operatorname{Re}(z)^2 + \operatorname{Im}(z)^2}.

    The parameters p and q are ignored in this case.

  3. If the normed expression is a real vector x and p = q, then this is the (generalized) vector p-norm

    \lVert x \rVert_p = \left(\sum_{i=1}^n |x_i|^p\right)^{\frac{1}{p}}

    for p \in \mathbb{Q} \cup \{\infty\} with p > 0 and |x_i| the absolute value of the i-th entry of x.

    Note that for p < 1 the expression is not convex and thus not a proper norm. However, it is concave over the nonnegative orthant and posing a lower bound on such a generalized norm yields a convex constraint for x \geq 0.

    Warning

    When you pose a lower bound on a concave generalized norm (p < 1), then PICOS enforces x \geq 0 through an auxiliary constraint during solution search.

    Special cases:

    • For p = 1, this is the Manhattan or Taxicab norm \lVert x \rVert_{\text{sum}}.

    • For p = 2, this is the Euclidean norm \lVert x \rVert = \lVert x \rVert_2.

    • For p = \infty, this is the Maximum, Chebyshev, or Infinity norm \lVert x \rVert_{\text{max}}.

  4. If the normed expression is a real vector x and p \neq q, then it is treated as a matrix with a single row or a single column, depending on the shape associated with x. See case (5).

  5. If the normed expression is a complex vector z and p = q, then the definition is the same as in case (3) but with x = z, |x_i| the modulus of the i-th entry of x, and p \geq 1.

  6. If the normed expression is a real m \times n matrix X, then this is the L_{p,q}-norm

    \lVert X \rVert_{p,q} =
\left(\sum_{j = 1}^n \left(\sum_{i = 1}^m
    |X_{ij}|^p
\right)^{\frac{q}{p}} \right)^{\frac{1}{q}}

    for p, q \in \mathbb{Q} \cup \{\infty\} with p,q \geq 1.

    If p = q, then this is equal to the (generalized) vector p-norm of the the vectorized matrix, that is \lVert X \rVert_{p,p} = \lVert \operatorname{vec}(X) \rVert_p. In this case, the requirement p \geq 1 is relaxed to p > 0 and X may be a complex matrix. See case (3).

    Special cases:

    • For p = q = 2, this is the Frobenius norm \lVert X \rVert = \lVert X \rVert_F.

    • For p = 1, q = \infty, this is the maximum absolute column sum

      \lVert X \rVert_{1,\infty} =
\max_{j=1 \ldots n} \sum_{i=1}^m |X_{ij}|.

      This equals the operator norm induced by the vector 1-norm. You can obtain the maximum absolute row sum (the operator norm induced by the vector \infty-norm) by first transposing X.

  7. Complex matrix norms are not supported.

Note

You can write \infty in Python as float("inf").

__ge__(other)[source]

Return a constraint that the expression is lower-bounded.

__init__(x, p=2, q=None, denominator_limit=1000)[source]

Construct a Norm.

Parameters
  • x (ComplexAffineExpression) – The affine expression to take the norm of.

  • p (float) – The value for p, which is cast to a limited precision fraction.

  • q (float) – The value for q, which is cast to a limited precision fraction. The default of None means equal to p.

  • denominator_limit (int) – The largest allowed denominator when casting p and q to a fraction. Higher values can yield a greater precision at reduced performance.

__le__(other)[source]

Return a constraint that the expression is upper-bounded.

__mul__(other)[source]

Denote multiplication with another expression on the right.

__pow__(other)[source]

Denote exponentiation with another, scalar expression.

__rmul__(other)[source]

Denote multiplication with another expression on the left.

property p

The parameter p.

This is a limited precision version of the parameter used when the norm was constructed.

property pden

The limited precision fraction denominator of p.

property pnum

The limited precision fraction numerator of p.

property q

The parameter q.

This is a limited precision version of the parameter used when the norm was constructed.

property qden

The limited precision fraction denominator of q.

property qnum

The limited precision fraction numerator of q.

property x

Real expression whose norm equals that of the original expression.