qft.ipynb
1 line
| 1.2 KiB
| text/plain
|
TextLexer
Teleportation
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]:
fourier = QFT(0,3).decompose(); fourier
In [4]:
circuit_plot(fourier, nqubits=3)
In [12]:
m = represent(fourier, nqubits=3)
In [13]:
m
In [5]:
represent(Fourier(0,3), nqubits=3)*4/sqrt(2)
In [6]:
state = (Qubit('000') + Qubit('010') + Qubit('100') + Qubit('110'))/sqrt(4); state
In [7]:
qapply(fourier*state)
In [23]:
%notebook save qft.ipynb