Note
This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.
cvxpy_gaussian_lstsq¶
- cvxpy_gaussian_lstsq(outcome_data, shot_data, measurement_data, preparation_data, measurement_basis=None, preparation_basis=None, measurement_qubits=None, preparation_qubits=None, conditional_measurement_indices=None, trace='auto', psd=True, trace_preserving='auto', partial_trace=None, outcome_prior=0.5, max_weight=10000000000.0, **kwargs)[source]¶
Constrained Gaussian linear least-squares tomography fitter.
Note
This function calls
cvxpy_linear_lstsq()
with a Gaussian weights vector. Refer to its documentation for additional details.- Overview
This fitter reconstructs the maximum-likelihood estimate by using
cvxpy
to minimize the constrained least-squares negative log likelihood function- Additional Details
The Gaussian weights are estimated from the observed frequency and shot data via a Bayesian update of a Dirichlet distribution with observed outcome data frequences
, and Dirichlet prior for tomography basis index i and measurement outcome s.The mean posterior probabilities are computed as
where
is the total number of shots, and is the norm of the prior.
- Parameters:
outcome_data (
ndarray
) – measurement outcome frequency data.shot_data (
ndarray
) – basis measurement total shot data.measurement_data (
ndarray
) – measurement basis indice data.preparation_data (
ndarray
) – preparation basis indice data.measurement_basis (
Optional
[MeasurementBasis
]) – Optional, measurement matrix basis.preparation_basis (
Optional
[PreparationBasis
]) – Optional, preparation matrix basis.measurement_qubits (
Optional
[Tuple
[int
,...
]]) – Optional, the physical qubits that were measured. If None they are assumed to be[0, ..., M-1]
for M measured qubits.preparation_qubits (
Optional
[Tuple
[int
,...
]]) – Optional, the physical qubits that were prepared. If None they are assumed to be[0, ..., N-1]
for N preparated qubits.conditional_measurement_indices (
Optional
[Tuple
[int
,...
]]) – Optional, conditional measurement data indices. If set this will return a list of conditional fitted states conditioned on a fixed basis measurement of these qubits.trace (
Union
[None
,float
,str
]) – trace constraint for the fitted matrix. If “auto” this will be set to 1 for QST or the input dimension for QST (default: “auto”).psd (
bool
) – If True rescale the eigenvalues of fitted matrix to be positive semidefinite (default: True)trace_preserving (
Union
[None
,bool
,str
]) – Enforce the fitted matrix to be trace preserving when fitting a Choi-matrix in quantum process tomography. If “auto” this will be set to True for QPT and False for QST (default: “auto”).partial_trace (
Optional
[ndarray
]) – Enforce conditional fitted Choi matrices to partial trace to POVM matrices.outcome_prior (
Union
[ndarray
,int
]) – The Baysian prior to use computing Gaussian weights. See additional information.max_weight (
float
) – Set the maximum value allowed for weights vector computed from tomography data variance.kwargs – kwargs for cvxpy solver.
- Raises:
QiskitError – If CVXPY is not installed on the current system.
AnalysisError – If analysis fails.
- Return type:
Dict
- Returns:
The fitted matrix rho that maximizes the least-squares likelihood function.