@@ -179,11 +179,18 @@ def project_psd(matrix):
179
179
def _fit (data : StateTomographyData ) -> StateTomographyResults :
180
180
"""Post-processing for two qubit state tomography.
181
181
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``.
187
194
"""
188
195
rotations = [
189
196
np .kron (rotation_matrix (basis1 ), rotation_matrix (basis2 ))
@@ -296,7 +303,7 @@ def _plot(data: StateTomographyData, fit: StateTomographyResults, target: QubitP
296
303
return [fig_measurements ], fitting_report
297
304
298
305
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 ]
300
307
)
301
308
fig = plot_reconstruction (data .ideal [target ], measured )
302
309
0 commit comments