picos.expressions.set_ellipsoid¶
Implements Ellipsoid
.
Classes
- class picos.expressions.set_ellipsoid.Ellipsoid(n, A='I', c=0)[source]¶
Bases:
Set
An affine transformation of the Euclidean unit ball.
- Definition
For
,
invertible and
, an instance of this class represents the set
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
in the definition above.
- Example
>>> 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>
Note
Due to significant differences in scope,
Ellipsoid
is not a superclass ofBall
even though both classes can represent Euclidean balls around the origin.- __init__(n, A='I', c=0)[source]¶
Construct an ellipsoid.
- Parameters
n (int) – Dimensionality
of the ellipsoid.
A (
AffineExpression
or recognized byload_data
) – Invertible linear transformation matrix.
c (
AffineExpression
or recognized byload_data
) – The centerof the ellispoid.
Warning
Invertibility of
is not checked on instanciation. If
is singular, a
RuntimeError
is raised once the inverse is needed.
- property A¶
The linear operator matrix
.
- property c¶
The center point
.
- property dim¶
The dimensionality
.