# What is measure_all function and the vertical dotted line represent in the circuit?

For the following code

qc = QuantumCircuit(2)
qc.cx(0,1)
qc.measure_all()
qc.draw()


Q1: What this vertical dotted line represent in the below circuit diagram?

Q2: 'meas' wire in the circuit is what kind of wire? is this classical wire or qubit wire?

Q3: How qc.measure_all() is different from qc.measure([0,1],[0,1])[couldn't find a simple answer on internet]

Re Q1:

Be careful with vertical dotted line being treated only as visual logical separation of circuits. It looks like it may be interpreted by transpilers:

https://medium.com/arnaldo-gunzi-quantum/what-is-the-barrier-in-qiskit-for-7d1547bebd1

Reference:

https://quantum-computing.ibm.com/composer/docs/iqx/operations_glossary

Barrier operation

To make your quantum program more efficient, the compiler will try to combine gates. The barrier is an instruction to the compiler to prevent these combinations being made. Additionally, it is useful for visualizations.

3. measure_all adds new bits to the circuit ,you don't have to define them, when you use measure you have to first define the classical bits. The 2 examples here show that , in the first one 2 qubits and 2 classical bits are defined , while in the second one 5 qubits are defined  from qiskit import QuantumCircuit qc = QuantumCircuit(2, 2) qc.h(0) qc.cx(0, 1) qc.measure([0, 1], [0, 1]) qc.draw()   from qiskit import QuantumCircuit qc = QuantumCircuit(5) qc.h(0) qc.cx(0, range(1, 5)) qc.measure_all()