##// END OF EJS Templates
Minor changes to text_analysis notebook example.
Minor changes to text_analysis notebook example.

File last commit:

r4328:7877585c
r4329:1ff5a82c
Show More
decompose.ipynb
1 line | 1.6 KiB | text/plain | TextLexer

Gate Decomposition

In [1]:
%load_ext sympy_printing
In [2]:
from sympy import sqrt, symbols, Rational
from sympy import expand, Eq, Symbol, simplify, exp, sin
from sympy.physics.quantum import *
from sympy.physics.quantum.qubit import *
from sympy.physics.quantum.gate import *
from sympy.physics.quantum.grover import *
from sympy.physics.quantum.qft import QFT, IQFT, Fourier
from sympy.physics.quantum.circuitplot import circuit_plot
In [3]:
CY10 = CGate(1, Y(0)); CY10
In [4]:
CY10.decompose()
In [5]:
circuit_plot(CY10.decompose(), nqubits=2)
In [6]:
CZ01 = CGate(0, Z(1)); CZ01
In [7]:
CZ01.decompose()
In [8]:
circuit_plot(CZ01.decompose(), nqubits=2)
In [9]:
SWAP10 = SWAP(1, 0); SWAP10
In [10]:
SWAP10.decompose()
In [11]:
circuit_plot(SWAP10.decompose(), nqubits=2)
In [12]:
gates = [CGate(1,Y(0)), CGate(0,Z(1)), SWAP(1, 0)]
In [16]:
for g in gates:
    dg = g.decompose()
    display(Eq(g, dg))
    circuit_plot(g, nqubits=2)
    circuit_plot(dg, nqubits=2)    
In [30]:
%notebook save decomposition.ipynb