quantum_circuit::barrier()← Back to Class quantum_circuit
Add a barrier to the circuit
quantum_circuit::barrier(from = 0, to = -1)
from (number, optional) — The begin qubit to add the barrier to. The default value is 0to (number, optional) — The end qubit to add the barrier to. The default value is -1
boolean — Always returns true
import quantum
qc = quantum_circuit(2)
qc.h(0)
qc.barrier()
qc.h(1)
qc.draw()
' Output:
' ╭───╮ |
' q0 ─┤ H ├──|────────
' ╰───╯ |
' | ╭───╮
' q1 ────────|──┤ H ├─
' | ╰───╯