Function quantum_circuit::draw()

← Back to Class quantum_circuit



Module quantumClass quantum_circuit → draw()

Description

Draw the circuit in ASCII art form

quantum_circuit::draw(debug = false)


Parameters


Return Value


Usage Example

import quantum
 
qc = quantum_circuit(2)
 
qc.x(0)
qc.barrier(0, 1)
qc.h(1)
qc.cp(pi / 2, 0, 1)
qc.h(0)
qc.swap(0, 1)
 
qc.draw()
 
 
' Output:
'      ╭───╮  |                   ╭───╮
'  q0 ─┤ X ├──|────────────●──────┤ H ├──X──
'      ╰───╯  |            │      ╰───╯  │
'             |  ╭───╮ ╭───┴────╮        │
'  q1 ────────|──┤ H ├─┤ P(π/2) ├────────X──
'             |  ╰───╯ ╰────────╯