How to plot a 2-qubit UGate?

16 views Asked by At

How do I plot a custom 2-qubit gate in SymPy?

The following doesn't seem to work for me:

from sympy import *
from sympy.physics.quantum.gate import UGate
from sympy.physics.quantum.circuitplot import circuit_plot

g = UGate((0,1), eye(4), 2)     # define custom 2-qubit gate
circuit_plot(g, 2)              # plot circuit

Output:

I expected the gate to be drawn across the 2 qubit wires.

0

There are 0 answers