In quantum computing, traditional methods like bra/ket notations and square matrices for operators are often impractical. Instead, researchers use abstractions like tensor networks, matrix-product states/operators, stabilizer formalism, or the ZX formalism. The Wolfram quantum framework has a unique abstraction based on a collection of fundamental quantum objects, built on tensors and some meta data, and some combination of tensor networks for computations. We’re actively exploring and implementing various abstractions, with some support for MPS/MPO, ZX, and stabilizers, and plans for graph-rewriting. In this essay, we’ll discuss quantum state concepts and probability calculations in more details.
Wolfram Quantum Team: quantum AT wolfram.com
Wolfram Quantum Team: quantum AT wolfram.com
How to perform quantum computation? A quantum computing expert would likely inform you that the traditional physics textbook methods involving bra/ket notation, square matrices for operators, and the like, are not the most practical or feasible approaches for quantum computing. This is why researchers have developed various abstractions to theoretically carry out quantum operations, encompassing everything from unitaries to channels and measurements. Some of these abstractions include tensor networks, matrix-product states and operators, stabilizer formalism, or the ZX formalism.
The Wolfram quantum framework primarily relies on the concept of tensor networks as its foundational abstraction, of course both symbolically and numerically. In essence, for us, quantum computing translates into sophisticated tensor manipulations and contractions that adhere to the principles of quantum theory. Here at the Wolfram quantum team, we are actively engaged in exploring different abstractions and incorporating them into the Wolfram Language. At the present moment, we offer partial support for matrix-product states/operators, ZX, and stabilizers, and we have future plans to integrate a graph-rewriting approach into our framework. In this concise computational essay, we will delve into the concept of quantum states and how to compute their associated probabilities using various approaches.
The Wolfram quantum framework primarily relies on the concept of tensor networks as its foundational abstraction, of course both symbolically and numerically. In essence, for us, quantum computing translates into sophisticated tensor manipulations and contractions that adhere to the principles of quantum theory. Here at the Wolfram quantum team, we are actively engaged in exploring different abstractions and incorporating them into the Wolfram Language. At the present moment, we offer partial support for matrix-product states/operators, ZX, and stabilizers, and we have future plans to integrate a graph-rewriting approach into our framework. In this concise computational essay, we will delve into the concept of quantum states and how to compute their associated probabilities using various approaches.
Our main goal with this essay is to expose our users with a different semantic, conceptualization or abstraction with respect to quantum state, in particular, and what one can extract from it. Anyone who wants to learn quantum computation should first open their mind, and peacefully say goodbye to bra/ket/matrix approach of computation. It might not be easy, but once you get used to it by some computational experiment (yes, you have the best environment to perform it: a Wolfram notebook), you would appreciate the alternative abstractions more.
Quantum states, spider, bend, and double
Quantum states, spider, bend, and double
Install quantum paclet:
In[]:=
PacletInstall["https://wolfr.am/DevWQCF",ForceVersionInstall->True]<<Wolfram`QuantumFramework`
Out[]=
PacletObject
Since we want to explore some symbolic quantum states in different dimensions, let’s define a function that takes dimension as input argument and return the corresponding symbolic quantum state
In[]:=
state[dim_:{2}]:=QuantumState[Flatten@Array[&,dim,{0,#-1}&/@dim],dim,"Label"->"ψ"]
c
##
In the following I will show the traditional form of some outputs (by ctrl+shift+T in Mac), because it may help readers if they’ve seen the Dirac notation of states
A symbolic state in 2D
In[]:=
state[]
Out[]=
c
0
c
1
A symbolic state in 2Dx2D
In[]:=
state[{2,3}]
Out[]=
c
0,0
c
0,1
c
0,2
c
1,0
c
1,1
c
1,2
A symbolic state in 2Dx2Dx2D:
In[]:=
state[{3,2,2}]
Out[]=
c
0,0,0
c
0,0,1
c
0,1,0
c
0,1,1
c
1,0,0
c
1,0,1
c
1,1,0
c
1,1,1
c
2,0,0
c
2,0,1
c
2,1,0
c
2,1,1
Now let’s focus on their circuit visualizations.
A qubit state’s circuit diagram (no input, one output); pay attention to wire dimensions
In[]:=
QuantumCircuitOperator[{state[]}]["Diagram","ShowWireDimensions"->True]
Out[]=
Evaluate the circuit (as expected the result will be the original state)
In[]:=
QuantumCircuitOperator[{state[]}]["Amplitudes"]
Out[]=
|0〉,|1〉
c
0
c
1
The circuit diagram of a 2-qudit state of dimensions {2,3}; pay attention to wire dimensions:
In[]:=
QuantumCircuitOperator[{state[{2,3}]}]["Diagram","ShowWireDimensions"->True]
Out[]=
The circuit diagram of a 3-qudit state of dimensions {2,3,2}; pay attention to wire dimensions:
In[]:=
QuantumCircuitOperator[{state[{2,3,2}]}]["Diagram","ShowWireDimensions"->True]
Out[]=
Conjugate transpose of a 1-qubit state of the dimension {2} (note, one input and no output):
In[]:=
QuantumCircuitOperator[{state[]["Dagger"]}]["Diagram","ShowWireDimensions"->True]
Out[]=
Now let’s turn the input of a conjugate transpose of a state into output, which means we deal with complex of amplitudes
In[]:=
QuantumCircuitOperator[{"Cup"->{1,2},state[]["Dagger"],"I"->2->1}]["Diagram","ShowWireDimensions"->True]
Out[]=
Look at the output of the circuit; as expected, the conjugate of state vector is stored in the output wire
In[]:=
QuantumCircuitOperator[{"Cup"->{1,2},state[]["Dagger"],"I"->2->1}]["Amplitudes"]
Out[]=
|0〉Conjugate[],|1〉Conjugate[]
c
0
c
1
So let’s have density matrix of a 2D state in the circuit as outputs:
In[]:=
QuantumCircuitOperator[{"Cup"->{1,2},state[]["Dagger"],state[],"I"->2}]["Diagram","ShowWireDimensions"->True]
Out[]=
In this circuit, the amplitudes can correspond to probabilities:
In[]:=
QuantumCircuitOperator[{"Cup"->{1,2},state[]["Dagger"],state[],"I"->2}]["Amplitudes"]
Out[]=
|00〉Conjugate[],|01〉Conjugate[],|10〉Conjugate[],|11〉Conjugate[]
c
0
c
0
c
1
c
0
c
0
c
1
c
1
c
1
The above circuit can be obtained directly by using “Bend” of the corresponding state
In[]:=
QuantumCircuitOperator[{state[]["Bend"]}]["Diagram","ShowWireDimensions"->True]
Out[]=
In[]:=
QuantumCircuitOperator[{state[]["Bend"]}]["Amplitudes"]
Out[]=
|00〉Conjugate[],|01〉Conjugate[],|10〉Conjugate[],|11〉Conjugate[]
c
0
c
0
c
1
c
0
c
0
c
1
c
1
c
1
Test that Bend is the same of state and its dagger, which the dagger input wire is turned into output:
In[]:=
QuantumCircuitOperator[{"Cup"->{1,2},state[]["Dagger"],state[],"I"->2}]==QuantumCircuitOperator[{state[]["Bend"]}]
Out[]=
True
Another approach would be to double the state, where the number of output wires remain the same, but only higher dimension (note it is thicker). The thicker wires are usually referred to as quantum wires. The double works if one curry/merge wires of a bend (look at above diagram of a bend). Pay attention to the wire dimension:
In[]:=
QuantumCircuitOperator[{"Double"[state[]]}]["Diagram","ShowWireDimensions"->True]
Out[]=
In[]:=
QuantumCircuitOperator[{"Double"[state[]]}]["Amplitudes"]
Out[]=
|0〉Conjugate[],|1〉Conjugate[],|2〉Conjugate[],|3〉Conjugate[]
c
0
c
0
c
1
c
0
c
0
c
1
c
1
c
1
If one cares only about probabilities, they can be recovered by “Measure”
In[]:=
QuantumOperator["Measure"]
Out[]=
QuantumOperator
It projects 4D into 2D, with remaining amplitudes as probabilities. Note the dimensions, from 4D as input to 2D as output, by ignoring the odd-diagonal terms
In[]:=
QuantumCircuitOperator["Measure"]["Diagram","ShowWireDimensions"->True]
Out[]=
So by doubling a state, and then measuring it, the probabilities will be stored in the 2D wire as amplitudes in those wires:
In[]:=
QuantumCircuitOperator[{"Double"[state[]],"Measure"}]["Diagram","ShowWireDimensions"->True]
Out[]=
In[]:=
FullSimplify/@QuantumCircuitOperator[{"Double"[state[]],"Measure"}]["Amplitudes"]
Out[]=
0,1
2
Abs[]
c
0
2
Abs[]
c
1
Another way of looking at double, and measure:
In[]:=
QuantumCircuitOperator[{state[]["Bend"],"Copy"->{1,2}->1}]["Diagram"]
Out[]=
Note what bend does, which is practically storing the density matrix in a higher-dimensional state (here in 2-qubit state):
In[]:=
FullSimplify/@state[]["Bend"]["Amplitudes"]
Out[]=
00,01Conjugate[],10Conjugate[],11
2
Abs[]
c
0
c
1
c
0
c
0
c
1
2
Abs[]
c
1
In[]:=
state[]["Bend"]["StateVector"]==ArrayReshape[state[]["DensityMatrix"],{4}]
Out[]=
True
In[]:=
QuantumCircuitOperator[{state[]["Bend"],"Copy"->{1,2}->1}]==QuantumCircuitOperator[{"Double"[state[]],"Measure"}]
Out[]=
True
Note one can implement above circuit using “Uncurry” followed by “Measure”, too:
In[]:=
QuantumCircuitOperator[{state[]["Bend"],"Uncurry"->{1,2}->1,"Measure"}]["Diagram","ShowWireDimensions"->True]
Out[]=
A copy circuit:
Amplitudes after applying copy circuit:
Now let’s explore how a measurement resembles copy circuit. Note in our framework, the measurement is done in a non-demolishing approach. For example, let’s consider a simple measurement:
The info of measurement is in fact stored in an extra quantum system. We label them from zero to negative numbers, and by convention, they are not usually shown; but one can see them explicitly as follows:
Therefore, the extra qudit wire (numbered as 0) can be rewired into another qudit (here, numbered as 2).
The above circuit is the same as copy circuit
Probabilities stored in amplitudes
Probabilities stored in amplitudes
We now explore how convention measurement can be reproduced differently
Consider a 2-qubit state, and measure them:
Corresponding probabilities
Now let’s make two copies of a state, but the 2nd one with conjugate amplitudes, and then combine them with spiders (here, inverse of a Copy) to store probabilities in amplitudes of state.
Amplitudes stored in wires, then normalize them:
As expected, it is the same as probabilities we obtained conventionally by measurements:
Let’s create the same circuit, with more compact representation, using the double
Note above circuit is the same as the one we created explicitly:
So let’s get normalized amplitudes
As expected, it is the same as probabilities
Post-selection
Post-selection
Let’s consider two copies of a 2-qubit state where first state is sent through wire 1 and 3, and the 2nd qubit through wires 2 and 4. The observer #1 (call it Alice) measures on 1st and 2nd wites, while the observer #2 (call it Bob) measures the 3rd and 4th ones.
Calculate probabilities of measurements:
Let’s find the double version of above circuit.
As expected, it is the same as original probabilities (after re-normalization)
Now let’s focus on the post-selection. Consider the circuit without doubling, again:
Now merge the lower part with the top part, as if overlaying wire a1 on a2, and b1 on b2. This is equivalent of getting same results for a1 and a2, and likewise b1 and b2. In other words, if Alice gets same results, she will report it (consider them in her statistics), otherwise she discards them; likewise similar scenario for Bob.
Select only the cases that Alice gets the same results (a1=a2) and likewise Bob (b1=b2); then given outcomes, normalize them:
The above calculation and post-selection correspond to this case. Take the following double circuit:
Merge them together, which means to double two times (note the above circuit is already a double, and once overlaid, it will be another double).
Let’s consider the case of double-double, followed by corresponding measures:
Find probabilities (from amplitudes) and normalize them:
As expected, it is the same as post-selected probabilities (after re-normalization)
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Quantum, tensors, spiders: different approach to quantum computation
by Mads Bahrami
Wolfram Community, STAFF PICKS, October 19, 2023
https://community.wolfram.com/groups/-/m/t/3051666
by Mads Bahrami
Wolfram Community, STAFF PICKS, October 19, 2023
https://community.wolfram.com/groups/-/m/t/3051666