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:
- Attributes:
- vec
ndarray
2D
float64
array of size(q, 1)
representing the full concatenated Cartesian product of vectors.- mats
list
oflist
ofndarray
A nested list of
view
ofvec
wheremats[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 callingself[i][j]
.- vecs
list
ofndarray
A list of
view
ofvec
wherevecs[i]
returns the array corresponding to the vector space \(\mathbb{V}_{i}\) as a vectorized column vector.
- vec
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]])