qics.point.VecProduct

class qics.point.VecProduct(cones, vec=None)[source]

A class for a Cartesian product of vectors corresponding to a list of cones Ki, i.e., sV where

V=V1×V2××Vk,

and KiVi. Each of these vector spaces Vi are themselves a Cartesian product of vector spaces

Vi=Vi,1×Vi,2××Vi,ki,

where Vi,j are defined as either the set of real vectors Rn, symmetric matrices Sn, or Hermitian matrices Hn.

Parameters:
coneslist of cones

List of cones defining a Cartesian product of vector spaces.

vecndarray, optional

If specified, then this class is initialized as a view of vec. Otherwise, the class is initialized using a newly allocated ndarray.

Attributes:
vecndarray

2D float64 array of size (q, 1) representing the full concatenated Cartesian product of vectors.

matslist of list of ndarray

A nested list of view of vec where mats[i][j] returns the array corresponding to the vector space Vi,j. This attribute can also be called using __getitem__, i.e., by directly calling self[i][j].

vecslist of ndarray

A list of view of vec where vecs[i] returns the array corresponding to the vector space Vi as a vectorized column vector.

Examples

Below we show an example of how to initialize a VecProduct and how to access the vectors corresponding to each cone and variable.

>>> import qics
>>> cones = [                                       \
...     qics.cones.PosSemidefinite(2),              \
...     qics.cones.QuantRelEntr(3, iscomplex=True)  \
... ]
>>> x = qics.point.VecProduct(cones)
>>> x[0][0]  # Matrix corresponding to PosSemidefinite cone
array([[0., 0.],
       [0., 0.]])
>>> x[1][0]  # Value corresponding to t of QuantRelEntr cone
array([[0.]])
>>> x[1][1]  # Matrix corresponding to X of QuantRelEntr cone
array([[0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j]])
>>> x[1][2]  # Matrix corresponding to Y of QuantRelEntr cone
array([[0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j]])