mimiqcircuits.operations.pairmeasure¶
Pair measurement operations (ZZ, XX, YY).
Classes
- class mimiqcircuits.operations.pairmeasure.MeasureZZ[source]¶
Bases:
AbstractMeasurementMeasureZZ operation.
The MeasureZZ operation measures the joint parity of two qubits in the Z-basis. This is achieved by applying a controlled-X (CX) gate, measuring the target qubit, and then applying another CX gate to undo the entanglement. The measurement result indicates whether the qubits are in the same or different states in the Z-basis.
See also
MeasureXX: Measure the joint parity of two qubits in the X-basis.MeasureYY: Measure the joint parity of two qubits in the Y-basis.Examples
>>> from mimiqcircuits import * >>> c = Circuit() >>> c.push(MeasureZZ(), 0, 1, 0) 2-qubit, 1-bit circuit with 1 instruction: └── MZZ @ q[0:1], c[0] >>> c.decompose() 2-qubit, 1-bit circuit with 1 instruction: └── MZZ @ q[0:1], c[0]
- class mimiqcircuits.operations.pairmeasure.MeasureXX[source]¶
Bases:
AbstractMeasurementMeasureXX operation.
The MeasureXX operation measures the joint parity of two qubits in the X-basis, determining whether the qubits are in the same or different states within this basis. The operation begins by applying a controlled-X (CX) gate between the two qubits to entangle them. Following this, a Hadamard (H) gate is applied to the first qubit, rotating it into the X-basis. The second qubit, designated as the target, is then measured to extract the parity information. After the measurement, the Hadamard gate is applied again to the first qubit to reverse the rotation, and a second controlled-X (CX) gate is applied to disentangle the qubits, restoring the system to its original state. Through this sequence, the MeasureXX operation efficiently captures the parity relationship of the qubits in the X-basis.
A result of 0 indicates that the qubits are in the same state, while a result of 1 indicates that they are in different states.
See also
MeasureZZ: Measure the joint parity of two qubits in the Z-basis.MeasureYY: Measure the joint parity of two qubits in the Y-basis.Examples
>>> from mimiqcircuits import * >>> c = Circuit() >>> c.push(MeasureXX(), 0, 1, 0) 2-qubit, 1-bit circuit with 1 instruction: └── MXX @ q[0:1], c[0] >>> c.decompose() 2-qubit, 1-bit circuit with 1 instruction: └── MXX @ q[0:1], c[0]
- class mimiqcircuits.operations.pairmeasure.MeasureYY[source]¶
Bases:
AbstractMeasurementMeasureYY operation.
The MeasureYY operation measures the joint parity of two qubits in the Y-basis, determining whether they are in the same or different states in this basis. This is achieved by first applying an S gate (a π/2 phase shift) to both qubits, followed by a controlled-X (CX) gate. A Hadamard gate (H) is then applied to the first qubit, and the second qubit is measured. To restore the system, a Z gate is applied to the first qubit, followed by another Hadamard gate, another CX gate, and finally another S gate to both qubits. The measurement result reflects whether the qubits are in the same or different states in the Y-basis.
Examples
>>> from mimiqcircuits import * >>> c = Circuit() >>> c.push(MeasureYY(), 0, 1, 0) 2-qubit, 1-bit circuit with 1 instruction: └── MYY @ q[0:1], c[0] >>> c.decompose() 2-qubit, 1-bit circuit with 1 instruction: └── MYY @ q[0:1], c[0]