In[]:=
PacletInstall["https://wolfr.am/DevWQCF",ForceVersionInstall->True]<<Wolfram`QuantumFramework`
Out[]=
PacletObject
Some problem-solving (QuantumState and QuantumBasis)
Some problem-solving (QuantumState and QuantumBasis)
QuantumOperators
QuantumOperators
Problem solving (QuantumOperator)
Problem solving (QuantumOperator)
- create a uniform superposition of 8-qubits using QuantumState only
- create the same state, by applying Hadamard operators on a register state
- create the same state, by applying Hadamard operators on a register state
In[]:=
QuantumState[{"UniformSuperposition",8}]
Out[]=
QuantumState
In[]:=
QuantumState[{"Register",0}]
Out[]=
|0〉
In[]:=
QuantumOperator[{"H",8}]@QuantumState[{"Register",Table[2,8]}]
Out[]=
QuantumState
In[]:=
QuantumOperator[{"H",8}][]
Out[]=
QuantumState
In[]:=
QuantumOperator[{"H",9}][]
Out[]=
QuantumState
In[]:=
QuantumOperator["H",{1,2,3,4,5,6,7,8}]
Out[]=
QuantumOperator
- Explore why Pauli-Z is also called phase flip
In[]:=
QuantumOperator["Z"]
Out[]=
|0〉〈0|-|1〉〈1|
In[]:=
QuantumOperator["Z"]@QuantumState[{a,b}]
Out[]=
a|0〉-b|1〉
- Create the rotation in the Bloch sphere, around an arbitrary unit vector (usually this gate is denoted as (θ)=Exp[-θ/2.]
n
R
n
n
σ
In[]:=
n={nx,ny,nz};
In[]:=
n.{"X","Y","Z"}
Out[]=
Xnx+Yny+Znz
In[]:=
QuantumOperator[{"R",θ,n.{"X","Y","Z"}}]
Out[]=
Failure
In[]:=
Exp[-Iθ/2n.Table[QuantumOperator[pauli],{pauli,{"X","Y","Z"}}]]["Simplify"]
Out[]=
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
--1+(nx+ny)(|1〉〈0|)+-1+nz+1+++(|1〉〈1|)
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
In[]:=
QuantumOperator[{"R",θ,nx"X"+ny"Y"+nz"Z"}]["Simplify"]
Out[]=
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
--1+(nx+ny)(|1〉〈0|)+-1+nz+1+++(|1〉〈1|)
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
In[]:=
QuantumOperator[{"R",θ,n.{"X","Y","Z"}}]["Simplify"]
Out[]=
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
--1+(nx+ny)(|1〉〈0|)+-1+nz+1+++(|1〉〈1|)
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
-++θ
1
2
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
++θ
2
nx
2
ny
2
nz
2
nx
2
ny
2
nz
2++
2
nx
2
ny
2
nz
- create a canonical gate, which is a 3-parameter quantum logic gate that acts on two qubitsExp[- π/2 )]
(XX+YY+ZZ
t
x
t
y
t
z
In[]:=
Exp[-IPi/2QuantumOperator[tx"XX"+ty"YY"+tz"ZZ"]]
Out[]=
1
2
1
2
1
2
-π(tx-ty+tz)
1
2
1
2
1
2
1
2
-π(tx-ty+tz)
1
2
1
2
-π(tx+ty-tz)
1
2
1
2
1
2
1
2
-π(tx+ty-tz)
1
2
1
2
1
2
1
2
-π(tx+ty-tz)
1
2
1
2
1
2
1
2
-π(tx+ty-tz)
1
2
1
2
1
2
1
2
1
2
1
2
-π(tx-ty+tz)
1
2
〈00|)+π(tx-ty-tz)+(|11〉〈11|)
1
2
1
2
1
2
-π(tx-ty+tz)
1
2
In[]:=
QuantumOperator[{"R",Pi,tx"XX"+ty"YY"+tz"ZZ"}]
Out[]=
1
2
1
2
1
2
-π(tx-ty+tz)
1
2
1
2
1
2
1
2
-π(tx-ty+tz)
1
2
1
2
-π(tx+ty-tz)
1
2
1
2
1
2
1
2
-π(tx+ty-tz)
1
2
1
2
1
2
1
2
-π(tx+ty-tz)
1
2
1
2
1
2
1
2
-π(tx+ty-tz)
1
2
1
2
1
2
1
2
1
2
1
2
-π(tx-ty+tz)
1
2
〈00|)+π(tx-ty-tz)+(|11〉〈11|)
1
2
1
2
1
2
-π(tx-ty+tz)
1
2
In[]:=
QuantumOperator["XX"]==QuantumOperator[{"X"->1,"X"->2}]
Out[]=
True
- create Givens gate: Exp[- θ/2 (YX-XY)]
In[]:=
QuantumOperator[{"R",θ,"YX"-"XY"}]
Out[]=
|00〉〈00|++(|01〉〈01|)+-+(|01〉〈10|)+-(|10〉〈01|)++(|10〉〈10|)+|11〉〈11|
-θ
2
θ
2
1
2
-θ
1
2
θ
1
2
-θ
1
2
θ
-θ
2
θ
2
- Pauli power gates are . Show that they are the same as corresponding rotation with the angle π t
t
σ
i
(* up-to a phase Exp[I Pi/2 t] *)
In[]:=
t
QuantumOperator["X"]
Out[]=
True
- given a [fractional] phase shift gate (ie a phase operator an angle ), show that =Z,=Sand=T
2π/
n
2
P
1
P
2
P
3
In[]:=
QuantumOperator[{"Phase",2π/2^n}]==QuantumOperator[{"PhaseShift",n}]
Out[]=
True
In[]:=
QuantumOperator[{"PhaseShift",1}]==QuantumOperator["Z"]QuantumOperator[{"PhaseShift",2}]==QuantumOperator["S"]QuantumOperator[{"PhaseShift",3}]==QuantumOperator["T"]
Out[]=
True
Out[]=
True
Out[]=
True
In[]:=
QuantumCircuitOperator["Fourier"]
Out[]=
- a global phase in front of a quantum state is not observable. Apply a global phase to a 2D random quantum state, and test if it is the same as the original one
States equality testing is up-to a phase, but not for operators
Find ZYZ decomposition of a random unitary operator
Create Berkeley B operator: Exp[ π/8 (2 XX + YY)]
QuantumMeasurementOperator
QuantumMeasurementOperator
Either usual PVMs or generic POVMs
Think of it very similar to quantum operator (given basis, and order)
Think of it very similar to quantum operator (given basis, and order)
POVM: