Toolkit for Qiskit Examples from Qiskit Tutorials
Basic Usage
The following examples from qiskit tutorials illustrate how to use the toolkit for qiskit.
Note
Acquiring the Quantum Rings backend
Use the following code snippet to acquire the backend for qiskit usage.
OPTION 1:
# Import QrRuntimeService
from quantumrings.toolkit.qiskit import QrRuntimeService
# Obtain the QrRuntimeService
service = QrRuntimeService( token = <YOUR_TOKEN_HERE>, name = <YOUR_ACCOUNT_NAME_HERE>)
# Obtain the required backend, set precision, select GPU_ID, and set the number of qubits to use
backend = service.backend(name = "amber_quantum_rings", precision = "single", gpu = 0, num_qubits = 10)
OPTION 2:
# Acquire the backend
from quantumrings.toolkit.qiskit import QrBackendV2
backend = backend = QrBackendV2(
token = <YOUR_TOKEN>,
name = <YOUR_ACCOUNT
backend = "amber_quantum_rings",
precision = "single",
gpu = 0,
num_qubits = 10
)
Using Quantum Rings Estimator and Sampler modules
After acquiring the backend, depending upon the application, Quantum Rings Estimator and/or Sampler modules can be used as shown in the following section. You can replace the qiskit provided Estimator and Sampler modules directly using Quantum Rings provided Estimator and Sampler modules. The replacement is usually a single line replacement.
# Using SamplerV2
from quantumrings.toolkit.qiskit import QrSamplerV2 as Sampler
sampler = Sampler(backend=backend, shots = 1000)
# Using EstimatorV2
from quantumrings.toolkit.qiskit import QrEstimatorV2 as Estimator
estimator = Estimator(backend=backend)
estimator.options.default_shots = 1000
If you are using qiskit 1.x, you can use V1 or V2 Sampler/Estimator modules. If you are using qiskit 2.x, you should only use V2 Sampler/Estimator.
Qiskit Examples
The following Qiskit tutorials have been modified to run under Quantum Rings SDK using Qiskit 2.x.
Qiskit Tutorials:
Qiskit Finance Package
The following tutorials illustrate the changes required for you to explore the Qiskit Finance package version 0.4.1 using the Quantum Rings SDK for Qiskit 2.x.
For installation of this package and its usage, please refer to: Qiskit Finance.
Qiskit Finance Tutorials:
Qiskit Nature Package
Only the following tutorial from the Qiskit Nature package version 0.7.2 can be tried using Qiskit 2.x. The remaining tutorials require updates on the package itself. For instructions on installing and using this package, please refer to: Qiskit Nature.
Qiskit Nature Tutorials:
Qiskit Optimization Package
You can now explore the Qiskit Optimization Package tutorials from version 0.6.1 using Qiskit 2.x, with all necessary adjustments already made for the Quantum Rings SDK. For instructions on installing and using this package, please refer to: Qiskit Optimization.
Qiskit Optimization Tutorials: