cirq.experiments.two_qubit_state_tomography(sampler:, first_qubit: cirq.devices.grid_qubit.GridQubit, second_qubit: cirq.devices.grid_qubit.GridQubit, circuit: cirq.circuits.circuit.Circuit, repetitions: int = 1000) → cirq.experiments.qubit_characterizations.TomographyResult[source]

Two-qubit state tomography.

To measure the density matrix of the output state of a two-qubit circuit,
different combinations of I, X/2 and Y/2 operations are applied to the
two qubits before measurements in the z-basis to determine the state
probabilities P_00, P_01, P_10.
The density matrix rho is decomposed into an operator-sum representation
\sum_{i, j} c_ij * sigma_i \bigotimes sigma_j, where i, j = 0, 1, 2,
3 and sigma_0 = I, sigma_1 = sigma_x, sigma_2 = sigma_y, sigma_3 =
sigma_z are the single-qubit Identity and Pauli matrices.
Based on the measured probabilities probs and the transformations of the
measurement operator by different basis rotations, one can build an
overdetermined set of linear equations.
As an example, if the identity operation (I) is applied to both qubits,
the measurement operators are (I +/- sigma_z) \bigotimes (I +/- sigma_z).
The state probabilities P_00, P_01, P_10 thus obtained contribute to the
following linear equations (setting c_00 = 1):
c_03 + c_30 + c_33 = 4P_00 - 1 -c_03 + c_30 - c_33 = 4P_01 - 1
c_03 - c_30 - c_33 = 4*P_10 - 1
And if a Y/2 rotation is applied to the first qubit and a X/2 rotation
is applied to the second qubit before measurement, the measurement
operators are (I -/+ sigma_x) \bigotimes (I +/- sigma_y). The probabilities
obtained instead contribute to the following linear equations:
c_02 - c_10 - c_12 = 4P_00 - 1 -c_02 - c_10 + c_12 = 4P_01 - 1
c_02 + c_10 + c_12 = 4*P_10 - 1
Note that this set of equations has the same form as the first set under
the transformation c_03 <-> c_02, c_30 <-> -c_10 and c_33 <-> -c_12.
Since there are 9 possible combinations of rotations (each producing 3
independent probabilities) and a total of 15 unknown coefficients c_ij,
one can cast all the measurement results into a overdetermined set of
linear equations, c) = probs. Here c is of length 15 and
contains all the c_ij’s (except c_00 which is set to 1), and mat is a 27
by 15 matrix having three non-zero elements in each row that are either
1 or -1.
The least-square solution to the above set of linear equations is then
used to construct the density matrix rho.
See Vandersypen and Chuang, Rev. Mod. Phys. 76, 1037 for details and
Steffen et al, Science 313, 1423 for a related experiment.
  • sampler – The quantum engine or simulator to run the circuits.

  • first_qubit – The first qubit under test.

  • second_qubit – The second qubit under test.

  • circuit – The circuit to execute on the qubits before tomography.

  • repetitions – The number of measurements for each basis rotation.


A TomographyResult object that stores and plots the density matrix.