gate_rules.ipynb
1 line
| 1.4 KiB
| text/plain
|
TextLexer
Gate rules and circuit simplification
In [1]:
%load_ext sympyprinting
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
from sympy.physics.quantum.gaterules import *
In [5]:
h0 = match_gate_rules(H(0))
for rule in h0:
display(Eq(H(0),rule))
In [7]:
z0 = match_gate_rules(Z(0))
for rule in z0:
display(Eq(Z(0),rule))
In [9]:
x0 = match_gate_rules(X(0))
for rule in x0:
display(Eq(X(0),rule))
In [10]:
circuit_plot(CNOT(1,0), nqubits=2)
In [12]:
c10 = match_gate_rules(CNOT(1,0))
In [13]:
circuit_plot(c10[8], nqubits=2)
In [16]:
%notebook save gate_rules.ipynb
In [25]: