Changing the precision
Starting version 0.11.0, the Quantum Rings SDK supports both single and double precision. The default precision is single.
The precision can be selected while acquiring the backend or while executing the run method.
Once selected, the precision stays fixed, unless overwritten again by either reacquiring the backend or by specifying the precision
in the run method.
If you are using the core SDK
OPTION 1. While acquiring the backend
import QuantumRingsLib
from QuantumRingsLib import QuantumRingsProvider
# Acquire the Quantum Rings Provider and your preferred backend
provider = QuantumRingsProvider(token =<YOUR_TOKEN_HERE>, name=<YOUR_ACCOUNT_NAME_HERE>)
# Select the backend and set the precision.
backend = provider.get_backend(backend = "scarlet_quantum_rings", precision = "double")
# Rest of the code follows.
OPTION 2. While invoking the ``run`` method
import QuantumRingsLib
from QuantumRingsLib import QuantumRingsProvider
from QuantumRingsLib import QuantumRegister, AncillaRegister, ClassicalRegister, QuantumCircuit
# Acquire the Quantum Rings Provider and your preferred backend
provider = QuantumRingsProvider(token =<YOUR_TOKEN_HERE>, name=<YOUR_ACCOUNT_NAME_HERE>)
# Select the backend.
backend = provider.get_backend(backend = "scarlet_quantum_rings")
# Construct a Quantum Circuit
num_qubits = 4
number_of_shots = 1
qc = QuantumCircuit(num_qubits, num_qubits)
qc.x(0);
qc.x(2);
qc.h(3);
qc.h(1);
# Set the precision and execute the circuit.
job = backend.run(qc, shots=number_of_shots, mode="async", precision = "double")
job_monitor(job, quiet=True)
result = job.result()
sv = result.get_statevector()
# Continue further processing
If you are using the toolkit for Qiskit
OPTION 1. Using QrRuntimeService
from quantumrings.toolkit.qiskit import QrRuntimeService
# Acquire the Quantum Rings runtime service
service = QrRuntimeService( token = <YOUR_TOKEN_HERE>, name = <YOUR_ACCOUNT_NAME_HERE> )
# Select the backend and set the precision
backend = service.backend(name = "amber_quantum_rings", precision = "double", gpu = 0, num_qubits = 12)
OPTION 2. Using QrBackendV2
from quantumrings.toolkit.qiskit import QrBackendV2
# Select the backend and set the precision
backend = QrBackendV2(
token = <YOUR_TOKEN_HERE>,
name = <YOUR_ACCOUNT_NAME_HERE>,
backend = "amber_quantum_rings",
precision = "double",
gpu = 0,
num_qubits = 12
)
OPTION 3. While using the Sampler or Estimator classes
This is explained in section Additional Parameters in Sampler and Estimator Classes.