CITE THIS NOTEBOOK: Target Probabilities with Quantum Circuits by Akhilesh Dubey. Wolfram Community JAN 13 2023.
Abstract: In this project, we investigate systematic methods to generate a desired probability distribution from a quantum circuit functionality. Using Wolfram quantum framework, we creating a high-level circuit model which produces a desired probability result that matches the desired random probability generator output.
Introduction
Introduction
In quantum computing, state preparation is the problem of synthesizing circuits that initialize quantum systems to specific states. State preparation is needed to prepare input states which encode problem instances on which then a quantum algorithm is applied. Hence, it has attracted considerable attention in the field of computer-aided design(CAD). Quantum mechanical phenomena such as superposition, phase shifts and entanglement all leads to a logic model which poses major problem or challenges to the development of a proper design flow for quantum circuits. However, pure form of logic synthesis of quantum circuits is yet hardly been accomplished. Here we proposed a general method which automatically synthesize a quantum circuit of our desired state. The method which proposed here allows for both, a theoretical determination of upper bounds as well as an computational evaluation of the number of quantum gates needed for this important design step.
In fact, no discrete representations, an infinite space of possible states, or operations working in high-dimensional Hilbert spaces and described by unitary matrices which may include complex numbers pose serious challenges to the development of proper and efficient CAD methods for quantum circuits. Hence, in order to efficiently tackle these obstacles, researchers considered synthesis of quantum circuits not as a single design step,but as a separation of concerns. For example, researchers separately considered:
1. Synthesis of Boolean Components:
Boolean components usually constitute a large building block in many quantum circuits. Since quantum computations is inherently reversible , So first the desired Boolean functionality is realized as reversible circuit. After that the resulting reversible circuit is mapped into a cascade of equivalent quantum gates.
2. Synthesis of Restricted Quantum Functionality: Many design objectives can be realized without employing the full power of arbitrary quantum operations. In this case, the consideration of a subset of quantum functionality.
Boolean components usually constitute a large building block in many quantum circuits. Since quantum computations is inherently reversible , So first the desired Boolean functionality is realized as reversible circuit. After that the resulting reversible circuit is mapped into a cascade of equivalent quantum gates.
2. Synthesis of Restricted Quantum Functionality: Many design objectives can be realized without employing the full power of arbitrary quantum operations. In this case, the consideration of a subset of quantum functionality.
Quantum systems are composed of qubits. Qubits can be in one of the computational basis state |0> and |1>. More formally, a qubit can be described by a two-dimensional Hilbert space where its (quantum) state is given by unit vector so called state vector.
By inverting the resulting circuit , the desired quantum circuit transforming a basis state is synthesized. More precisely three steps are performed.
(a) Unify Phases: transformation of potentially different phases amplitudes to a single (global) phase.
(b) Unify probabilities: transformation of the potentially different moduli of amplitudes to an equal probability distribution.
(c) Remove superposition: transformation of unified amplitudes to a state with a single non-zero amplitude and, by this, generate a basis state (potentially with a negligible global phase).
By inverting the resulting circuit , the desired quantum circuit transforming a basis state is synthesized. More precisely three steps are performed.
(a) Unify Phases: transformation of potentially different phases amplitudes to a single (global) phase.
(b) Unify probabilities: transformation of the potentially different moduli of amplitudes to an equal probability distribution.
(c) Remove superposition: transformation of unified amplitudes to a state with a single non-zero amplitude and, by this, generate a basis state (potentially with a negligible global phase).
In this project, we obtained discrete probability from a random quantum state by generating quantum circuit and tweaking its parameters. We further extended this idea in reverse i.e. generating a quantum state from a discrete probability. The scope of this project also reaches out to the list of numbers.
Note that we will only discuss about amplitudes of quantum state in this paper.
A. One Qubit System
A. One Qubit System
A.1 Initialization
A.1 Initialization
Define quantum state(by default 1 qubit) and show its amplitudes
In[]:=
ψ=QuantumState["RandomPure"];ψ["Amplitudes"]
Out[]=
|0〉-0.442795+0.764259,|1〉-0.243651+0.400593
Verify the statevector after the quantum operations.
In[]:=
RZY[ψ["StateVector"]]
Out[]=
{{RZ,-0.0213279},{RY,0.594771}}
One can also visualize the diagram of the quantum operators used.
In[]:=
QuantumCircuitOperator[RZY[ψ["StateVector"]]]["Diagram"]
Out[]=
Apply the operator defined on quantum state to see the amplitudes.
In[]:=
psi2=QuantumCircuitOperator[RZY[ψ["StateVector"]]][ψ];psi2["Amplitudes"]
Out[]=
|0〉-0.360988+0.60802,|1〉-0.360988+0.60802
Note that amplitudes and phases of qubits are uniformly distributed.
Apply H gate on the initial state and verify the amplitudes.
In[]:=
psi3=QuantumCircuitOperator[{RZY[ψ["StateVector"]],"H"}][ψ];psi3["Amplitudes"]
Out[]=
|0〉-0.510514+0.85987,|1〉0
Plot the summary of the changing probabilities with increasing gate operation.
In[]:=
BarChart[{ψ["Probabilities"],psi2["Probabilities"],psi3["Probabilities"]},ChartLabels{{"Initial state","RY+RZ","RY+RZ+H"},{"|0〉","|1〉"}},ChartLegends{"|0〉","|1〉"}]
Out[]=
The above bar chart corresponds to probabilities pertaining to different steps of the initial quantum state. The first chart has some probability in state which becomes equal in second chart due to appropriate operation of gates. This then is localized completely in after Hadamard operation.
|0〉
|0〉
B. 2-Qubits System
B. 2-Qubits System
We now extend above idea to 2 qubit system. Concept of permutation cycles also shows up here .
Define Quantum state of 2 qubits.
In[]:=
s0=QuantumState[{"RandomPure",2}]["Normalized"]
Out[]=
QuantumState
Note that normalization is done for simplification.
Show the state-vector of above state.
In[]:=
vec0=Normal[s0["StateVector"]]
Out[]=
{0.105659-0.210846,-0.118784-0.193566,0.89569-0.101311,-0.245188+0.141989}
We would partition above state vector in set of two and apply the ‘RZY’ operator defined above separately. The output of the circuit is then swapped and processed for next set of quantum operations.
In[]:=
qc0=QuantumCircuitOperator[{{"Multiplexer",Sequence@@(RZY/@Partition[vec0,2])},{"Permutation",Cycles[{{1,2}}]}}];qc0["Diagram","ShowGateLabels"->False]
Out[]=
Verify the state vector of quantum state generated from the operations on initial state.
In[]:=
vec1=Normal[qc0[s0]["StateVector"]]
Out[]=
{-0.00993626-0.231301,0.209392+0.634473,-0.00993626-0.231301,0.209392+0.634473}
Note that the qubits are in balanced superposition with amplitude here
δ=
1
2√2
iθ
e
Finally balanced superposition is removed by applying Hadamard gates on each qubit resulting in basis 0...0>.
iθ
e
In[]:=
qc1=QuantumCircuitOperator[{{"Multiplexer",Sequence@@(RZY/@Partition[vec1,2])},{"H",2}}];qc1["Diagram","ShowGateLabels"->False]
Out[]=
Concatenate both circuits and visualize.
In[]:=
qcF=qc1@qc0;qcF["Flatten"]["Diagram","ShowGateLabels"->False]
Out[]=
Applying the operator on initial state would give a discrete probability stacked in
|0〉
In[]:=
qcF@s0==QuantumState["00"]
Out[]=
True
Verify the amplitudes to confirm the equality
In[]:=
qcF[s0]["Amplitudes"]
Out[]=
|00〉0.983691-0.179867,|01〉0,|10〉0,|11〉0
Reverse process
Reverse process
We have seen above that a discrete number(probability) can be generated from from four random number which is fed in form of Quantum state having dimension 4(or 2 qubits). The reverse is also true.
This can be realized by reversing the final circuit used above (changing the order or negative sign for rotations). We have defined special function ‘RYZdagger’ in the definitions to realize it.
This can be realized by reversing the final circuit used above (changing the order or negative sign for rotations). We have defined special function ‘RYZdagger’ in the definitions to realize it.
In[]:=
qcGen=QuantumCircuitOperator[{{"H",2},{"Multiplexer",Sequence@@(RZYdagger/@Partition[vec1,2])},{"Permutation",Cycles[{{1,2}}]},{"Multiplexer",Sequence@@(RZYdagger/@Partition[vec0,2])}}];qcGen["Flatten"]["Diagram","ShowGateLabels"->False]
Verify the equality.
C. 3-Qubits system
C. 3-Qubits system
One way to generate quantum state is by generating random numbers equal to required dimensions of quantum state.
Note that Random complex numbers is used here. (Real numbers generate JordanDecomposition error)
Visualize the state vector of above state
Note that the number of permutation cycles used for swapping outputs are (n-1) which in this case is 2.
Create the circuit operator and swap the output (here 1 with 3)
Generate the output state vector by the applying the operator on initial state
We follow the same procedure as shown above and swapping different sets (in this case 2 with 3)
Concatenate the above circuits and visualize.
We now create the circuits with Hadamard gates on each qubits.
Concatenate all above circuits.
Verify using the amplitudes of the final state.
Reversing order of Circuits
Reversing order of Circuits
We can apply same set of principles as done in case of 2 qubits case for getting back the quantum state here.
Create the required quantum circuit.
Verify the equality with the initial quantum state generated from random numbers.
D. 4-Qubit System
D. 4-Qubit System
We will apply everything as discussed in above sections for four qubits system.
Generate 4 qubits quantum state.
Generate required circuits one-by-one and apply the outputs (generated by operating on initial state sequentially).
Apply circuit operators along with H gate at last.
Concatenate all the above circuits and visualize.
Note that the swapping cycle for this circuits are {3,4},{2,4} and {1,4} sequentially.
Apply the operators on initial state and verify the equality.
Plot the obtained probabilities.
Generalization to n-Qubit system
Generalization to n-Qubit system
Generalizing methods for solving in n-qubit system follows:
(a) Multiplexer function followed by swapping {n,n-1}
(b) Multiplexer function followed by swapping {n,n-2}
(c) Multiplexer function followed by swapping {n,n-3}
.
.
.
.
(d) Multiplexer function followed by swapping {n,1}
(e) Finally apply Hadamard for realizing non-zero amplitude
(a) Multiplexer function followed by swapping {n,n-1}
(b) Multiplexer function followed by swapping {n,n-2}
(c) Multiplexer function followed by swapping {n,n-3}
.
.
.
.
(d) Multiplexer function followed by swapping {n,1}
(e) Finally apply Hadamard for realizing non-zero amplitude
Note that ‘RZY’ definitions are used in the above codes.
Verification
Verification
Define the quantum state required as input in the above functions.
Implement the function on above state and visualize.
Verify the equality as claimed.
Extension to lists
Extension to lists
We extend above ideas to a list of numbers i. e. we may generate a quantum circuit preserving the list of numbers.
Generate the quantum circuit from the above defined function (for n qubits) and apply the measurement operator.
Verify the probabilities generated from the measurement with the initial list of numbers.
Concluding remarks
Concluding remarks
1) In this work we account synthesis of circuits realizing arbitrary quantum states together with other tasks, such as the synthesis of Boolean components or synthesis of restricted subsets of quantum functionality, which constitutes an important subsets in computer-aided design.
2) From our implementations approach, we concluded states can be “described” by some efficiently computable function, measurements allow state preparation with small quantum circuits. From synthesis approach theoretical bounds on the number of required gates have been derived. The computational evaluation confirmed that, for many dedicated quantum states, significantly less gates are required.
2) From our implementations approach, we concluded states can be “described” by some efficiently computable function, measurements allow state preparation with small quantum circuits. From synthesis approach theoretical bounds on the number of required gates have been derived. The computational evaluation confirmed that, for many dedicated quantum states, significantly less gates are required.
Future Plans and Ideas
Future Plans and Ideas
My future plans involve implementing these things in technologies such as quantum dots, ion traps or superconducting qubits and ultimately on real quantum computers.
Keywords
Keywords
◼
Quantum States
◼
Quantum Circuits
◼
qubits
◼
Superposition
◼
Gates
◼
Probability
◼
Discrete
◼
Boolean Synthesis
◼
Functional Synthesis
Acknowledgment
Acknowledgment
Mentor: Shivam Sawarn and Eric James Parfitt
Thanks to my mentors for their help and guiding throughout in my project relentlessly and for bearing my lame questions and codes. Special thanks to Mads Bahrami for sorting out the codes along with valuable ideas in designing this project and Stefan Wolfram for suggesting the project and inspiring for it.
Last but not the least the fellow student from whom I learned a lot and the friendly supporting staff of winter school.
Last but not the least the fellow student from whom I learned a lot and the friendly supporting staff of winter school.
References
References
◼
Logic Synthesis for Quantum State Generation paper by Philipp Niemann, Rhitam Datta,Robert Wille (2016 IEEE 46th International Symposium on Multiple-Valued Logic)
◼
Quantum state preparation with optimal circuits depth: Implementations and Applications by Xiao-Ming Zhang, Tongyang Li and Xiao Yuan (arXiv:2201.11495v3 [quant-ph] 5 Dec 2022
◼
Circuits for measurement based quantum state preparation paper by Niels Gleinig and Torsten Hoefler
Initialization cells
Initialization cells