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 \(\mathcal{K}_i\), i.e., \(s\in\mathbb{V}\) where

\[\mathbb{V} = \mathbb{V}_1 \times \mathbb{V}_2 \times \ldots \times \mathbb{V}_k,\]

and \(\mathcal{K}_i \subset \mathbb{V}_i\). Each of these vector spaces \(\mathbb{V}_i\) are themselves a Cartesian product of vector spaces

\[\mathbb{V}_i = \mathbb{V}_{i,1} \times \mathbb{V}_{i,2} \times \ldots \times \mathbb{V}_{i,k_i},\]

where \(\mathbb{V}_{i,j}\) are defined as either the set of real vectors \(\mathbb{R}^n\), symmetric matrices \(\mathbb{S}^n\), or Hermitian matrices \(\mathbb{H}^n\).

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 \(\mathbb{V}_{i,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 \(\mathbb{V}_{i}\) 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]])