Skip to content

Commit

Permalink
shorten it a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
1ucian0 committed Mar 10, 2023
1 parent 1a474f6 commit 7bc4849
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions qiskit/circuit/quantumcircuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,7 @@ def reset(self, qubit: QubitSpecifier) -> InstructionSet:
return self.append(Reset(), [qubit], [])

def measure(self, qubit: QubitSpecifier, cbit: ClbitSpecifier) -> InstructionSet:
"""Measure a quantum bit (``qubit``) into a classical bit (``cbit``).
"""Measure in Z basis a quantum bit (``qubit``) into a classical bit (``cbit``).
When quantum state is measured a qubit is project in the computational (Pauli Z) basis to
either :math:`|0\rangle` or :math:`|1\rangle`. The classical bit ``cbit`` indicates the result
Expand Down Expand Up @@ -2302,8 +2302,8 @@ def measure(self, qubit: QubitSpecifier, cbit: ClbitSpecifier) -> InstructionSet
c: 1/══════╩═
0
It is possible to call ``measure`` with lists of qubits and cbits of the same size, as a
shortcut. These two forms produce identical output::
It is possible to call ``measure`` with lists of ``qubits`` and ``cbits`` as a shortcut
for one-to-one measurement. These two forms produce identical results::
.. code-block::
Expand All @@ -2316,27 +2316,13 @@ def measure(self, qubit: QubitSpecifier, cbit: ClbitSpecifier) -> InstructionSet
circuit.measure(0, 0)
circuit.measure(1, 1)
It is also possible to do a one-to-many readout. These two forms produce identical output::
.. code-block::
circuit = QuantumCircuit(2,2)
circuit.measure(0, [0,1])
.. code-block::
circuit = QuantumCircuit(2, 2)
circuit.measure(0, 0)
circuit.measure(0, 1)
Instead of lists, you can use :class:`~qiskit.circuit.QuantumRegister` and
:class:`~qiskit.circuit.ClassicalRegister` under the same logic.
.. code-block::
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
qreg = QuantumRegister(1, "qreg")
qreg = QuantumRegister(2, "qreg")
creg = ClassicalRegister(2, "creg")
circuit = QuantumCircuit(qreg, creg)
circuit.measure(qreg, creg)
Expand All @@ -2347,7 +2333,7 @@ def measure(self, qubit: QubitSpecifier, cbit: ClbitSpecifier) -> InstructionSet
circuit = QuantumCircuit(qreg, creg)
circuit.measure(qreg[0], creg[0])
circuit.measure(qreg[0], creg[1])
circuit.measure(qreg[1], creg[1])
"""
return self.append(Measure(), [qubit], [cbit])
Expand Down

0 comments on commit 7bc4849

Please sign in to comment.