that offers quantum simulations. The Framework brings quantum experimentation to anyone and opens the door for more research and development of quantum algorithms.
This can also be used to connect with external cloud services such as
[“IBMQ”] the next time that you want to connect on the same system.
To make sure you are connected, request your account info:
In[15]:=
ibmq["Account"][3;;6]
Out[15]=
userType
Standard
firstName
Sebastian
lastName
Rodriguez
institution
WolframResearch
If the outcome was not what you expected, it means you are not connected. Try repeating the same steps.
Amazon Braket Connection
Let’s jump in and explore how to utilize the power of Amazon Braket’s quantum computing resources using Wolfram Language.
Connect to AWS using your credentials (using your access key ID and secret access key) so the following code will evaluate correctly in your own notebook.
In[6]:=
aws=ServiceConnect["AWS","New"]
Out[6]=
ServiceObject
AWS
NotConnected
If you choose to save the connection, you can simply use
At this point, you will be connected to Amazon Braket and able to run quantum algorithms on both simulators and QPUs. To make sure you are connected, request devices info:
There are two methods in order to run a circuit in a QPU using Wolfram Quantum Framework, using the ServiceConnect or QuantumCircuitOperator object. First of all, we need a quantum circuit:
In[1256]:=
qc=
QuantumCircuitOperator
"H"{1,2,3},"CZ"{1,2},"CZ"{2,3},"RZ"
π
3
2,"RZ"
2π
3
3,"H"{1,2,3},{1,2,3};qc["Diagram"]
Out[1257]=
Users should pay attention to specification of each QPUs, for example:
◼
Accepted gates
◼
Number of qubits
ServiceConnect
Transform the circuit into qiskit object, then decompose it:
In[137]:=
qiskit=qc["Qiskit"]["Decompose"];
Out[138]=
QiskitCircuit
Qubits:3
Depth:9
Check the qiskit circuit Diagram:
In[140]:=
qiskit["Diagram"]
Turn the Qiskit object into bytes by specifying the corresponding provider and backend on the IBM system:
Send the circuit to an IBM QPU:
QuantumCircuitOperator
Jobs
ServiceConnect offers multiple options to explore QPU's requested jobs:
Check all the jobs requested in your service:
Job Status
Job Results
Once the job is done, you can also check on results using the service connection and the appropriate job ID:
Results
If you already know the job is done and want to store the results, you can use the appropriate job ID and perform some post-processing to get the data into shape:
Calculate the theoretical results using the defined QuantumCircuitOperator:
Plot the results and compare:
As observed, there have been some errors in the hardware, possibly due to environmental noise or other factors.
AWS-Bracket
Using your token, you can connect to AWS:
Devices
Gather information about the various devices available through your service:
Verify the device status of each QPU:
QPU Properties
Check the specifications of a specific QPU device:
Run Quantum Circuit
There are two methods in order to run a circuit in a QPU using Wolfram Quantum Framework, using the ServiceConnect or QuantumCircuitOperator object. First of all, we need a quantum circuit:
Users should pay attention to specification of each QPUs, for example:
◼
Accepted gates
◼
Number of qubits
ServiceConnect
Transform the quantum circuit into Qiskit and find its OpenQASM code using AWSProvider:
Using this OpenQASM code, we can send the query to the Amazon simulator and our personal "OutputS3Bucket":
Task
Check all the jobs requested in your service:
Check the status of the task:
Job Results
Once the job is done, you can also check on results:
Results
The results of the requested updates are saved in S3. We can find these by locating their directories:
Given the previous directory, the measurement result can be obtained as follows:
Based on the generated results for IonQ, we can then calculate the probabilities:
We can then chart results for the IonQ QPU (100 shots) and the Wolfram Quantum Framework (exact probabilities as predicted by quantum theory):
As observed, there have been some errors in the hardware, possibly due to environmental noise or other factors.