Implements Ellipsoid.


class picos.expressions.set_ellipsoid.Ellipsoid(n, A='I', c=0)[source]

Bases: Set

An affine transformation of the Euclidean unit ball.


For n \in \mathbb{Z}_{\geq 1}, A \in \mathbb{R}^{n \times n} invertible and c \in \mathbb{R}^n, an instance of this class represents the set

& \{Ax + c \mid \lVert x \rVert_2 \leq 1\} \\
=~& \{x \mid \lVert A^{-1}(x - c) \rVert_2 \leq 1\} \\
=~& \{x \mid \lVert x - c \rVert_{(A^{-1})^T A^{-1}} \leq 1\}.

Unlike most sets, instances of this class offer a limited set of algebraic operations that are generalized from expressions to sets in the natural way. In particular, you can add or substract constant vectors of matching dimension and apply matrix multiplication from the left hand side, both of which will act on the term Ax + c in the definition above.


>>> from picos import Ellipsoid, RealVariable
>>> Ellipsoid(3)  # Three-dimensional Euclidean unit ball.
<Centered Unit Ball: {I·x : ‖x‖ ≤ 1}>
>>> Ellipsoid(3, range(9))  # Linear transformation of the unit ball.
<Centered Ellipsoid: {[3×3]·x : ‖x‖ ≤ 1}>
>>> Ellipsoid(3, "2I", 1)  # Offset ball of radius two.
<Offset Ellipsoid: {2·I·x + [1] : ‖x‖ ≤ 1}>
>>> 2*Ellipsoid(3) + 1  # The same using algebraic operations.
<Offset Ellipsoid: {2·I·x + [1] : ‖x‖ ≤ 1}>
>>> x = RealVariable("x", 3)
>>> (2*x + range(3)) << (4*Ellipsoid(3) + 5)  # Constraint creation.
<4×1 SOC Constraint: ‖(4·I)^(-1)·(2·x + [3×1] - [5])‖ ≤ 1>


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

__init__(n, A='I', c=0)[source]

Construct an ellipsoid.



Invertibility of A is not checked on instanciation. If A is singular, a RuntimeError is raised once the inverse is needed.

property A

The linear operator matrix A.

property Ainv[source]

The inverse linear operator matrix A^{-1}.

property c

The center point c.

property dim

The dimensionality n.