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
, i.e., whereand
. Each of these vector spaces are themselves a Cartesian product of vector spaceswhere
are defined as either the set of real vectors , symmetric matrices , or Hermitian matrices .- 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 . 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 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]])