iqm.benchmarks.compressive_gst.mgst.utils_gst.basis_transform#
- iqm.benchmarks.compressive_gst.mgst.utils_gst.basis_transform(matrix: ndarray, in_basis: str = 'std', out_basis: str = 'pp') ndarray#
Transform a matrix or vector between standard and Pauli bases.
- Parameters:
matrix (ndarray) – Input matrix (superoperator) or vector (vectorized density matrix) to transform. For vectors: shape (pdim^2,) For matrices: shape (pdim^2, pdim^2)
in_basis (str) – Input basis, either “std” (standard) or “pp” (Pauli).
out_basis (str) – Output basis, either “std” (standard) or “pp” (Pauli).
- Returns:
Transformed matrix or vector in the output basis. Returns real part for transformations involving Pauli basis.
- Raises:
ValueError – If in_basis or out_basis is not “std” or “pp”.
- Return type: