Skip to content

Commit 39e5d3c

Browse files
Merge pull request #1035 from qiboteam/fix-2q-tomography
Fix 2q tomography
2 parents 74d2625 + 720a73e commit 39e5d3c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/qibocal/protocols/two_qubit_state_tomography.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,18 @@ def project_psd(matrix):
179179
def _fit(data: StateTomographyData) -> StateTomographyResults:
180180
"""Post-processing for two qubit state tomography.
181181
182-
Uses the standard linear inversion algorithm described in
183-
https://en.wikipedia.org/wiki/Quantum_tomography#Linear_inversion
184-
to reconstruct the density matrix.
185-
The matrix is also post projected after the linear inversion
186-
using ``project_psd``.
182+
Uses a linear inversion algorithm to reconstruct the density matrix
183+
from measurements, with the following steps:
184+
1. Construct a linear transformation M, from density matrix
185+
to Born-probabilities in the space of all two-qubit measurement bases
186+
(in our case XX, XY, XZ, YX, YY, YZ, ZX, ZY, ZZ).
187+
2. Invert M to get the transformation from Born-probabilities to
188+
density matrices.
189+
3. Calculate vector of Born-probabilities from experimental measurements (frequencies).
190+
4. Map this vector to a density matrix (``measured_raw_density_matrix``) using the
191+
inverse of M from step 2.
192+
5. Project the calculated density matrix to the space of positive semidefinite
193+
matrices (``measured_density_matrix``) using the function ``project_psd``.
187194
"""
188195
rotations = [
189196
np.kron(rotation_matrix(basis1), rotation_matrix(basis2))
@@ -296,7 +303,7 @@ def _plot(data: StateTomographyData, fit: StateTomographyResults, target: QubitP
296303
return [fig_measurements], fitting_report
297304

298305
measured = np.array(fit.measured_density_matrix_real[target]) + 1j * np.array(
299-
fit.measured_raw_density_matrix_imag[target]
306+
fit.measured_density_matrix_imag[target]
300307
)
301308
fig = plot_reconstruction(data.ideal[target], measured)
302309

0 commit comments

Comments
 (0)