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.
linear_inversion¶
- linear_inversion(outcome_data, shot_data, measurement_data, preparation_data, measurement_basis=None, preparation_basis=None, measurement_qubits=None, preparation_qubits=None, conditional_measurement_indices=None, conditional_preparation_indices=None, atol=1e-08)[source]¶
Linear inversion tomography fitter.
- Overview
This fitter uses linear inversion to reconstructs the maximum-likelihood estimate of the least-squares log-likelihood function
where
is the matrix of measured basis elements. is the vector of estimated measurement outcome probabilities for each basis element. is the vectorized density matrix.
- Additional Details
The linear inversion solution is given by
where measurement probabilities
are estimated from the observed count frequencies in shots for each basis element , and is the dual basis element constructed from basis via:
Note
The Linear inversion fitter treats the input measurement and preparation bases as local bases and constructs separate 1-qubit dual basis for each individual qubit.
Linear inversion is only possible if the input bases are local and a spanning set for the vector space of the reconstructed matrix (tomographically complete). If the basis is not tomographically complete the
scipy_linear_lstsq()
orcvxpy_linear_lstsq()
function can be used to solve the same objective function via least-squares optimization.- Parameters:
outcome_data (
ndarray
) – basis outcome frequency data.shot_data (
ndarray
) – basis outcome total shot data.measurement_data (
ndarray
) – measurement basis indice data.preparation_data (
ndarray
) – preparation basis indice data.measurement_basis (
Optional
[MeasurementBasis
]) – the tomography measurement basis.preparation_basis (
Optional
[PreparationBasis
]) – the tomography preparation 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] forN prepared qubits.conditional_measurement_indices (
Optional
[ndarray
]) – Optional, conditional measurement data indices. If set this will return a list of fitted states conditioned on a fixed basis measurement of these qubits.conditional_preparation_indices (
Optional
[ndarray
]) – Optional, conditional preparation data indices. If set this will return a list of fitted states conditioned on a fixed basis preparation of these qubits.atol (
float
) – truncate any probabilities below this value to zero.
- Raises:
AnalysisError – If the fitted vector is not a square matrix
- Return type:
Tuple
[ndarray
,Dict
]- Returns:
The fitted matrix rho.