picos.expressions.exp_norm

Implements Norm.

Outline

Classes

Norm

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

NuclearNorm

The nuclear norm of a matrix.

SpectralNorm

The spectral norm of a matrix.

Classes

Norm

class picos.expressions.exp_norm.Norm(**kwargs)[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").

__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.

property p

The parameter p.

This is a limited precision version of the paramter 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 paramter 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.

NuclearNorm

class picos.expressions.exp_norm.NuclearNorm(**kwargs)[source]

Bases: picos.expressions.expression.Expression

The nuclear norm of a matrix.

This class can represent the nuclear norm of a matrix-affine expression (real- or complex valued). The nuclear norm is convex, so we can form expressions of the form NuclearNorm(X) <= t which are typically reformulated as LMIs that can be handled by SDP solvers.

Definition

If the normed expression is a matrix X, then its nuclear norm is

\|X\|_* =  \operatorname{trace}\ (X^*X)^{1/2}
        = \sum_{i=1}^{\min(n,m)} \sigma_i(X)

where the \sigma_i(X) denote the singular values of a X, and X^* denotes the adjoint matrix of X (i.e., the transposed matrix X^T if X is real-valued).

Special cases:

  • If X is scalar, then \|X\|_* reduces to the the absolute value (or modulus) |X|.

  • If X is scalar, then \|X\|_* coincides with the Euclidean norm of X.

__init__(x)[source]

Construct a NuclearNorm.

Parameters

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

property x

Real expression whose norm equals that of the original expression.

SpectralNorm

class picos.expressions.exp_norm.SpectralNorm(**kwargs)[source]

Bases: picos.expressions.expression.Expression

The spectral norm of a matrix.

This class can represent the spectral norm of a matrix-affine expression (real- or complex valued). The spectral norm is convex, so we can form expressions of the form SpectralNorm(X) <= t which are typically reformulated as LMIs that can be handled by SDP solvers.

Definition

If the normed expression is a matrix X, then its spectral norm is

\|X\|_2 = \max \{  \|Xu\|_2 : \|u\| \leq  1\}
        = \sqrt{\lambda_{\max}(XX^*)},

where \lambda_{\max}(\cdot) denotes the largest eigenvalue of a matrix, and X^* denotes the adjoint matrix of X (i.e., the transposed matrix X^T if X is real-valued).

Special cases:

  • If X is scalar, then \|X\|_2 reduces to the the absolute value (or modulus) |X|.

  • If X is scalar, then \|X\|_2 coincides with the Euclidean norm of X.

__init__(x)[source]

Construct a SpectralNorm.

Parameters

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

property x

Real expression whose norm equals that of the original expression.