Implements Ball.


class picos.expressions.set_ball.Ball(radius=<1×1 Real Constant: 1>, p=2, denominator_limit=1000)[source]

Bases: picos.expressions.set.Set

A ball of radius r according to a (generalized) p-norm.


In the following, \lVert \cdot \rVert_p refers to the vector p-norm or to the entrywise matrix p-norm, depending on the argument. See Norm for definitions.

Let r \in \mathbb{R}.

  1. For p \in [1, \infty) or p = \infty (input as float("inf")), this is the convex set

    \{x \in \mathbb{K} \mid \lVert x \rVert_p \leq r\}

    for any

    \mathbb{K} \in \bigcup_{m, n \in \mathbb{Z}_{\geq 1}}
    \left( \mathbb{C}^n \cup \mathbb{C}^{m \times n} \right).

  2. For a generalized p-norm with p \in (0, 1), this is the convex set

    \{x \in \mathbb{K} \mid \lVert x \rVert_p \geq r \land x \geq 0\}

    for any

    \mathbb{K} \in \bigcup_{m, n \in \mathbb{Z}_{\geq 1}}
    \left( \mathbb{R}^n \cup \mathbb{R}^{m \times n} \right).

Note that x may not be complex if p < 1 due to the implicit x \geq 0 constraint in this case, which is not meaningful on the complex field.

Note further that r may be any scalar affine expression, it does not need to be constant.


Due to significant differences in scope, Ball is not a subclass of Ellipsoid even though both classes can represent Euclidean balls around the origin.

__init__(radius=<1×1 Real Constant: 1>, p=2, denominator_limit=1000)[source]

Construct a p-norm ball of given radius.

  • radius (float or AffineExpression) – The ball’s radius.

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

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

property p

The value p defining the p-norm used.

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

property r

The ball’s radius r.