Exploring Wolfram Quantum Computation Framework​
​by Subhojit Pal​
​Indian Institute of Science Education and Research, Bhopal
Wolfram Quantum Framework Computation Framework performs high-level analytic and numeric computations in Quantum Information Theory, allowing simulation of quantum circuits and quantum algorithms. In this essay, I explore a few quantum algorithms and explore their implementation in the Wolfram Quantum Computation Framework

Installing the paclet

Paclet is a library of Mathematica whose purpose to simulate quantum circuits and solve problems of quantum computation and quantum mechanics. Using this library, we can introduce high-level analytic and numerical computations in quantum information theory. Here I have come across quantum operators, quantum states, measurements etc. I have installed this library using the code below. This code will perfectly work on Mathematica V.13 and version 12.3. It will not work on V.12.
In[]:=
PacletUninstall/@PacletFind["Quantum*"];​​ClearAll["*QuantumFramework*","Wolfram`QuantumFramework`*","Wolfram`QuantumFramework`**`*"];​​PacletInstall[CloudObject["https://wolfr.am/DevWQCF"],ForceVersionInstall->True]​​<<Wolfram`QuantumFramework`
Out[]=
PacletObject
Name: Wolfram/QuantumFramework
Version: 1.0.2


Decomposition of some quantum gates

When working with quantum gates, a very important feature is if and how one can decompose a quantum gate into sequences of such simpler (or universal) gates. In this section, I will explore a few examples and show such decomposition. Of course, at this level, I have done the decomposition manually and only showed the equivalency of results. But a future plan would be doing the decomposition automatically.
For each example in the following, I showed what I plan to test as the heading, then I construct the left and then right side of relationship, and finally I test they are identical.

NOT≡
R
x
(π).Ph(π/2)

In[]:=
ph[angle_]:=QuantumOperator[{"GlobalPhase",angle}];​​qc1=QuantumOperator[{"XRotation",π}]@ph
π
2
;​​QuantumOperator["NOT"]==qc1​​
Out[]=
True

NOT≡
R
y
(π).
R
z
(π).Ph
π
2

In[]:=
Ry[angle_]:=QuantumOperator[{"YRotation",angle}]​​Rz[angle_]:=QuantumOperator[{"ZRotation",angle}]​​qc2=Ry[π]@Rz[π]@ph
π
2
;​​QuantumOperator["PauliX"]==qc2
Out[]=
True

NOT
≡
R
x
π
2
.Ph
π
4

In[]:=
Rx[angle_]:=QuantumOperator[{"XRotation",angle}]​​qc3=Rx
π
2
@ph
π
4
;​​QuantumOperator["RootNOT"]["Matrix"]==ComplexExpand@qc3["Matrix"]
Out[]=
True
Note I used ComplexExpand to expand
ϕ


NOT
≡
R
z
-π
2
.
R
y
π
2
.
R
z
π
2
.Ph
π
4

In[]:=
qc4=Rz
-π
2
@Ry
π
2
@Rz
π
2
@ph
π
4
;​​QuantumOperator["RootNOT"]["Matrix"]==ComplexExpand@qc4["Matrix"]
Out[]=
True

H≡
R
x
(π).
R
y
π
2
.Ph
π
2

In[]:=
qc5=Rx[π]@Ry
π
2
@ph
π
2
;​​QuantumOperator["H"]==qc5
Out[]=
True

H≡
R
y
π
2
.
R
z
(π).Ph
π
2

In[]:=
qc6=Ry
π
2
@Rz[π]@ph
π
2
;​​QuantumOperator["H"]==qc6
Out[]=
True

R
x
(θ)≡
R
z
-π
2
.
R
y
(θ).
R
z
π
2

In[]:=
Rx[theta_]:=QuantumOperator[{"XRotation",theta}]​​qc7[theta_]:=Rz
-π
2
@Ry[theta]@Rz
π
2
;​​Rx[θ]["Matrix"]==Map[FullSimplify[#,θ∈Reals]&,ComplexExpand@qc7[θ]["Matrix"],{2}]
Out[]=
True
Note I used ComplexExpand to expand
ϕ

and also simplify it, to test equality.

R
x
(θ)≡
R
y
π
2
.
R
z
(θ).
R
y
-π
2

In[]:=
Rz[theta_]:=QuantumOperator[{"ZRotation",theta}]​​qc8[theta_]:=Ry
π
2
@Rz[theta]@Ry
-π
2
;​​Rx[θ]["Matrix"]==Map[FullSimplify[#,θ∈Reals]&,ComplexExpand@qc8[θ]["Matrix"],{2}]
Out[]=
True

Controlled-0 gate with two control qubits

In[]:=
qc1=QuantumCircuitOperator[{QuantumOperator["NOT"],QuantumOperator["NOT",{2}],QuantumOperator["Toffoli"],QuantumOperator["NOT"],QuantumOperator["NOT",{2}]}];​​qc1["Diagram"]
Out[]=
In[]:=
u=QuantumOperator["NOT",{3}];​​qc2=QuantumCircuitOperator[{QuantumOperator[{"Controlled0",u,{1,2}}]}];​​qc2["Diagram"]
Out[]=
In[]:=
qc1["CircuitOperator"]==qc2["CircuitOperator"]​​
Out[]=
True

SWAP combined with an arbitrary controlled-U

In[]:=
u=QuantumOperator["RandomUnitary"];​​qc=QuantumCircuitOperator[QuantumOperator[{"ControlledU",u}]];​​qc["Diagram"]
Out[]=
In[]:=
qc1=QuantumCircuitOperator[{QuantumOperator["SWAP",{1,2}],QuantumOperator[{"ControlledU",u},{1,2}],QuantumOperator["SWAP",{1,2}]}];​​qc1["Diagram"]
Out[]=
In[]:=
qc1["CircuitOperator"]==qc["CircuitOperator"]
Out[]=
True

Controlled0-U

In[]:=
qc2=QuantumCircuitOperator[{QuantumOperator["X",{1}],QuantumOperator[{"ControlledU",u},{1,2}],QuantumOperator["X",{1}]}];​​qc2["Diagram"]
Out[]=
In[]:=
qc3=QuantumCircuitOperator[QuantumOperator[{"Controlled0",u},{1,2}]];​​qc3["Diagram"]
Out[]=
In[]:=
qc2["CircuitOperator"]==qc3["CircuitOperator"]​​
Out[]=
True

CNOT and modified CSIGN

In[]:=
qc4=QuantumCircuitOperator[QuantumOperator["CNOT",{1,2}]];​​qc4["Diagram"]
Out[]=
In[]:=
Roty[angle_]:=QuantumOperator[{"YRotation",angle},{2}];​​qc5=QuantumCircuitOperatorRoty
-π
2
,QuantumOperator["CZ",{1,2}],Roty
π
2
;​​qc5["Diagram"]
Out[]=
In[]:=
qc4["CircuitOperator"]==qc5["CircuitOperator"]
Out[]=
True

Decomposition of CNOT

In[]:=
Roty[angle_]:=QuantumOperator[{"YRotation",angle},{2}]​​Rotz[angle_]:=QuantumOperator[{"ZRotation",angle},{2}]​​Rottz[angle_]:=QuantumOperator[{"ZRotation",angle},{1}]​​qc6=QuantumCircuitOperatorRoty
π
2
,Sqrt[QuantumOperator["SWAP",{1,2}]],Rottz[π],Sqrt[QuantumOperator["SWAP",{1,2}]],Rotz
-π
2
,Rottz
-π
2
,Roty
-π
2
;​​qc6["Diagram"]
Out[]=
In[]:=
qc4["CircuitOperator"]==qc6["CircuitOperator"]
Out[]=
True

Superdense coding

Here in this protocol we will send two classical bit of information by one qubit. First we have to create a Bell pair by “H” and “CNOT” gate which will be shared by two parties as Alice and Bob. Now Alice encodes her messages as “00”, “01”, “10” and “11”. And she performs some quantum operation according to the encoded information like she does I for “00” , “X” for “01”, “Z” for “10” and “ZX” for “11”. Then she sends this to Bob. Bod has done first “CNOT” operation and then “H” to get the actual information send by Alice. Here We have used four qubits two for Alice and two for Bob. At the third qubit “H” and “CNOT” create Bell pair which will depend on bit structure of qubit 3 and 4. And then done some operations(I, X, Z, ZX) and the performs “ CNOT” and “H”. And then measure the qubit 3 and and 4.
In[]:=
superdensecoding=QuantumCircuitOperator[{QuantumOperator["H",{3}],QuantumOperator["CNOT",{3,4}],QuantumOperator["CX",{2,3}],QuantumOperator["CZ",{1,3}],QuantumOperator["CNOT",{3,4}],QuantumOperator["H",{3}],QuantumMeasurementOperator[{3,4}]}];​​superdensecoding["Diagram"]
Out[]=
Let’s take qubit 3 and 4 are |00> state. Here 1st Quantum Operator creates a “H” operation on the 3rd qubit |+0>and the 2nd Quantum Operator creates a “CNOT” on qubit 3 and 4 where qubit 3 is control and qubit 4 is target
|00>+|11>
2
. Then some quantum operation has done by Alice here I and then after applying “CNOT” we get
|00>+|10>
2
and after applying “H” on the first qubit we get we get |00>. So we finally get the result.
In[]:=
state[{x_,y_}]:=QuantumTensorProduct[QuantumState[<|{x,y}->1|>,QuantumBasis[2,2]],QuantumState[{"Register",2}]];​​Multicolumn[superdensecoding[state[#]]["ProbabilityPlot"]&/@Tuples[{0,1},2]]
Out[]=
Here the state function is initial state and the list {x,y} is the bit what Alice wants to send to Bob. And Tuples create the four states as 00, 01, 10 and 11 and probability plot shows the probability of each state in different cases separately with 100% probability.

Keywords

◼
  • Quantum Computation
  • ◼
  • Superdense Coding
  • Acknowledgment

    Firstly and foremost, I would like to thank Mads Bahrami for his unequivocal help without whom this essay could not have been completed. His positive and nurturing attitude made the school very fun and possible to cope even with difficult C-19 circumstances. ​I also express my gratitude to Rahul Sharma, TA, for helping me resolve bugs and explain me things through the duration of this winter experience. My sincere regards to Tuseeta Banerjee for being understanding, Mads and the entire Organising Team for taking us on this educational journey. Lastly, I will not forget my Physics professor, Dr Arnab Rudra, who had told me about this amazing school.

    References

    ◼
  • https://wolfr.am/wolfram-quantum
  • ◼
  • https://qiskit.org/textbook/ch-algorithms/index.html
  • ◼
  • http://theory.caltech.edu/~preskill/ph229/
  • ◼
  • https://arxiv.org/vc/quant-ph/papers/0511/0511061v1.pdf
  • ◼
  • https://www.elsevier.com/solutions/scopus/who-uses/research-and-development/quantum-computing-report