Install Wolfram quantum framework paclet, and load it:
In[]:=
PacletInstall["Wolfram/QuantumFramework"]Needs["Wolfram`QuantumFramework`"]
Out[]=
PacletObject
Wolfram quantum framework
Wolfram quantum framework
The Wolfram Quantum Framework is a software tool that enables the development and simulation of quantum algorithms using the Wolfram Language. Its key features include a library of pre-built quantum functions (such as QFT, or Grover’s search algorithm), integration with the Wolfram Cloud, simulating quantum systems symbolically and also numerically, and the ability for users to send queries to, e.g., Amazon Braket for quantum computing tasks. With this integration, users can leverage the power of Amazon Braket to perform quantum tasks that require more resources than local simulations. Here are some built-in named examples:
In[]:=
QuantumCircuitOperator[{"Grover",a&&!b||c},"Grover"]["Diagram"]
Out[]=
In[]:=
QuantumCircuitOperator[{"Fourier",4}]["Diagram"]
Out[]=
In[]:=
QuantumCircuitOperator[{"Multiplexer","X","Y","Z"}]["Diagram"]
Out[]=
Wolfram Language is an exceptional computational tool that offers users a wide range of features to perform complex calculations with ease. However, did you know that it also allows for seamless integration with quantum functionalities? By harnessing the power of Wolfram Language and quantum computing, users can perform a variety of quantum tasks on QPUs, including the generation of highly entangled graph states, also known as cluster states.
These graph states are essential for measurement-based quantum computing and offer a multitude of benefits for researchers and scientists alike. By using the cutting-edge tools provided by Wolfram Language, users can perform quantum simulations, optimize quantum circuits, and analyze experimental results with unparalleled ease and efficiency.
But why stop there? With the addition of Amazon Braket, a fully managed quantum computing service, Wolfram Language users can take their quantum computing endeavors to new heights. By utilizing the power of Braket’s quantum computing resources, Wolfram Language users can scale their quantum applications to solve problems that were once impossible to tackle with classical computing methods.
In summary, the combination of Wolfram Language and quantum computing offers an unparalleled opportunity to perform complex calculations, generate highly entangled graph states, and perform quantum tasks on QPUs with unparalleled ease and efficiency. With the addition of Amazon Braket, this powerful combination can take on even the most challenging computational problems. So let’s jump in and explore Wolfram quantum framework and connect it with Amazon Braket through AWS service.
These graph states are essential for measurement-based quantum computing and offer a multitude of benefits for researchers and scientists alike. By using the cutting-edge tools provided by Wolfram Language, users can perform quantum simulations, optimize quantum circuits, and analyze experimental results with unparalleled ease and efficiency.
But why stop there? With the addition of Amazon Braket, a fully managed quantum computing service, Wolfram Language users can take their quantum computing endeavors to new heights. By utilizing the power of Braket’s quantum computing resources, Wolfram Language users can scale their quantum applications to solve problems that were once impossible to tackle with classical computing methods.
In summary, the combination of Wolfram Language and quantum computing offers an unparalleled opportunity to perform complex calculations, generate highly entangled graph states, and perform quantum tasks on QPUs with unparalleled ease and efficiency. With the addition of Amazon Braket, this powerful combination can take on even the most challenging computational problems. So let’s jump in and explore Wolfram quantum framework and connect it with Amazon Braket through AWS service.
Generate a graph with 4 vertexes and 5 edges:
In[]:=
g=Graph[{12,13,23,24,34},VertexLabels"Name",PlotLabel->"Graph of qubits, with edges as coupling (eg controlled gates)"]
Out[]=
Generate the corresponding quantum state of above graph, which is usually called as graph or cluster state:
In[]:=
graphState=QuantumState[{"Graph",g}]
Out[]=
QuantumState
Note the output is a quantum object, with some interesting features (such as type, dimensions etc)
Return formula of above state in the computational basis:
In[]:=
graphState["Formula"]
Out[]=
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
1
4
Note that graph states are highly entangled.
Test if the above graph state is entangled:
Test if the above graph state is entangled:
In[]:=
QuantumEntangledQ[graphState]
Out[]=
True
Test if the qubit-1 and -4 are entangled (meaning after tracing out 2 and 3):
In[]:=
QuantumEntangledQ[graphState,{{1},{4}}]
Out[]=
False
Same test, but explicitly tracing out 2 and 3 and test the entanglement
In[]:=
QuantumEntangledQ@QuantumPartialTrace[graphState,{2,3}]
Out[]=
False
Calculate EntanglementMonotone using different measures:
In[]:=
AssociationMap[QuantumEntanglementMonotone[N@graphState,#]&,{"Concurrence","Negativity","LogNegativity","EntanglementEntropy","RenyiEntropy","Realignment"}]
Out[]=
Concurrence0.323042,Negativity0.5,LogNegativity1.,EntanglementEntropy,RenyiEntropy1.,Realignment1.
Given a vertex of the graph, find list of vertices adjacent to it:
In[]:=
verAdj=Transpose[Through[{VertexList,AdjacencyList}[g]]]
Out[]=
{{1,{2,3}},{2,{1,3,4}},{3,{1,2,4}},{4,{2,3}}}
Now let’s find stabilizers, which simply are are a set of operators that represents the symmetries of a quantum state.
Given above the list of vertices and their adjacencies, find corresponding stabilizer, which can be obtain by Pauli-X on vertex and Pauli-Z on adjacencies:
Given above the list of vertices and their adjacencies, find corresponding stabilizer, which can be obtain by Pauli-X on vertex and Pauli-Z on adjacencies:
In[]:=
stabilizers=QuantumOperator[{"X"->#1,"Z"->#2}]&@@@verAdj
Out[]=
QuantumOperator,QuantumOperator,QuantumOperator,QuantumOperator
Apply above list of stabilizers and show that the result (graph state being transformed by a stabilizer) is still the same as the original state (that is why it is called stabilizer)
In[]:=
Thread[Through[stabilizers[graphState]]==graphState]
Out[]=
{True,True,True,True}
Now let’s see how we can generate the graph state using a quantum circuit. In other word, we design a quantum circuit that transforms a register state into a desired graph state.
To do so, one can use the built-in graph circuit in Wolfram quantum framework.
To do so, one can use the built-in graph circuit in Wolfram quantum framework.
Corresponding circuit for generating the same graph state
In[]:=
qc=QuantumCircuitOperator[{"Graph",g}];
In[]:=
qc["Diagram"]
Out[]=
Test the result is the same as expected (ie the circuit acting on register state produces the desired graph state):
In[]:=
qc[]==graphState
Out[]=
True
There are some interesting features one can extract from the above circuit.
TensorNetwork of circuit which is just a graph annotated with tensors and contraction indices, where “Initial” vertex (index 0) is pre-initialized with as register tensor.
|0000..〉
In[]:=
tensor=qc["TensorNetwork",EdgeLabels->Automatic,GraphLayout->{"LayeredDigraphEmbedding","Orientation"->Left}]
Out[]=
Another tensor network representation uses indices as graph vertices with tensors as cliques:
Given the circuit for generating a graph state, let’s now measure each qubit in a specific direction on xy-plane. For the qubit-1, the measurement will be done along x-axis (corresponding to Pauli-X measurement) and then for next qubits, we will rotate the basis of measurement by π/4 around z-axis.
From computational basis, we can apply Hadamard, which makes the measurement of qubits along x-axis (ie Pauli-X measurement). Then we apply z-rotation gates, to rotate the measurement basis within xy-plane by a given angle.
Now let’s find what quantum theory predicts as the probability distribution one gets from above circuit. In Wolfram framework, whenever there is a quantum measurement, the output will be quantum measurement object:
There are many interesting features that one can get from a quantum measurement object. For example, the probabilities are calculated exactly using statical functionalities in the Wolfram Language:
Or one can directly ask for the corresponding plot:
Additionally, one can also simulate measurements for a given number of shots. It means repeating measurement and counting what outcome one gets in each run (which is practically one realization of the expected result from a noiseless QPU):
The Wolfram quantum framework provides an excellent starting point for those interested in exploring quantum computing. Users can leverage the framework to design and simulate quantum circuits, while also gaining access to a suite of features and tools for quantum programming. Moreover, by connecting a Wolfram notebook to Amazon Braket via AWS service, researchers can further extend their quantum computing capabilities by accessing a wide range of quantum functionalities, including the ability to send queries to QPUs and utilize available simulators.
Amazon Braket
Amazon Braket
Connect to AWS using your credentials (using Access Key ID, and Secret Access Key):
Execute Braket on AWS
Let’s look at the template for calling AWS API:
So now you are connect to Amazon Braket, and you run quantum algorithms on simulated and actual quantum computers.
Fetch available devices:
For example, let’s get the dataset for SV1, which is a simulator
Also, let’s consider one QPU, for example IonQ:
One can look into supported operation in IonQ QPU:
Now let’s feed the OPENQASM code we generated before into SV1 simulator:
Generate the corresponding OpenQASM3 using AWSBraket provider:
Look at operations/gates supported in the simulator:
Generate OpenQASM code for IonQ device:
Also, feed the OPENQASM code we generated before into IonQ QPU:
Get detailed information on a task:
As one can see, the status of SV1 task is “completed”:
As one can see, the status of SV1 task is “completed”:
For IonQ, it will take longer
Results are saved in S3 and one can get their directory as follows:
Given above directories, the measurement results can be obtained as follows. Note that SV1 returns counts per measurement result, and IonQ the corresponding probabilities, directly. Later on, for the sake of comparison, we will calculate probabilities for SV1, too
From SV1 and IonQ results, one can calculate the probabilities:
Now we have results from SV1 simulator (100 shots), IonQ QPU (100 shots) and Wolfram quantum framework (exact probabilities as predicted by quantum theory).
In conclusion, Wolfram Language’s integration with quantum functionalities provides users with a powerful tool for quantum computing tasks, including the generation of highly entangled graph states. The addition of Amazon Braket allows users to scale their quantum applications to tackle complex computational problems with ease. By combining the capabilities of Wolfram Language and Amazon Braket, researchers and scientists can explore new frontiers in quantum computing and push the boundaries of what is possible with classical computing methods.