mqt.yaqs.characterization.memory.backends.tomography.basis

Discrete Choi basis and dual frame utilities for tomography estimation.

Module Contents

TomographyBasis
get_basis_states(*, basis: TomographyBasis = 'tetrahedral', seed: int | None = None) list[tuple[str, numpy.typing.NDArray[numpy.complex128], numpy.typing.NDArray[numpy.complex128]]][source]

Return the 4 single-qubit basis states used for the 16-map CP basis.

Parameters:
  • basis – Basis choice.

  • seed – Optional seed used when basis="random".

Returns:

List of 4 tuples (name, psi, rho) where psi is a ket and rho = |psi><psi|.

Raises:

TypeError – If basis is not recognized.

get_choi_basis(*, basis: TomographyBasis = 'tetrahedral', seed: int | None = None) tuple[list[numpy.typing.NDArray[numpy.complex128]], list[tuple[int, int]]][source]

Generate the 16 CP-map Choi basis matrices.

Parameters:
  • basis – Basis choice for the underlying 4 states.

  • seed – Optional seed used when basis="random".

Returns:

  • choi_matrices is a list of 16 complex 4x4 Choi matrices.

  • indices gives the corresponding (prep_index, meas_index) pairs.

Return type:

Tuple (choi_matrices, indices) where

assemble_fixed_basis(*, basis: TomographyBasis | str, basis_seed: int | None = None) tuple[list[tuple[str, numpy.typing.NDArray[numpy.complex128], numpy.typing.NDArray[numpy.complex128]]], list[numpy.typing.NDArray[numpy.complex128]], list[tuple[int, int]], ndarray][source]

Build the discrete basis bundle for tomography and surrogate feature encoding.

Parameters:
  • basis – Basis name ("standard", "tetrahedral", "random").

  • basis_seed – Optional seed used when basis="random".

Returns:

Tuple (basis_set, choi_mats, choi_idx, choi_features) where choi_features has shape (16, 32).

compute_dual_choi_basis(basis_matrices: list[numpy.typing.NDArray[numpy.complex128]]) list[numpy.typing.NDArray[numpy.complex128]][source]

Compute the dual frame for a Choi basis.

Parameters:

basis_matrices – List of basis Choi matrices.

Returns:

List of dual-frame matrices with the same shapes as basis_matrices.