qrunch.quantum.backends.backends_creators
Creators for quantum backends.
Module Attributes
Default backend is |
Classes
Creator for backends. |
|
Finalizer for the creation of backends. |
|
SubCreator for creating backends. |
- class BackendCreator
Bases:
objectCreator for backends.
- static amazon_braket(device: _IQM | _IonQ | _Rigetti | _Amazon | DeviceData, *, layout_synthesizer: LayoutSynthesizer | None = None, max_cost: float = 10000) BackendCreatorFinalizer[AmazonBraketBackend]
Create a Amazon Braket backend.
This is a facade around the amazon-braket-sdk’s AwsDevice device. The backend can be used to launch quantum circuits to quantum devices on Amazon Braket, or to run (noisy) simulators on Amazon Braket.
See https://aws.amazon.com/braket/pricing/ for pricing information.
- Parameters:
device (_IQM | _IonQ | _Rigetti | _Amazon | DeviceData) – Device to run circuit on.
layout_synthesizer (LayoutSynthesizer | None) – Synthesizer to create device-specific circuit topology. A synthesizer can be created using the
layout_synthesizer_creator(). Defaults to QubitDependentLayoutSynthesizer if None is given.max_cost (float) – Maximum price of a single run-method in USD, only limits QPUs. Defaults to $10,000.
- Return type:
- static create() LocalAmazonBraketBackend
Create an instance of
LocalAmazonBraketBackend.- Return type:
- static ibm_quantum_platform(*, device: Literal['kingston', 'pittsburgh', 'fez', 'marrakesh', 'torino', 'brisbane', 'aachen', 'strasbourg', 'brussels', 'least_busy', 'fake_fez', 'fake_marrakesh', 'fake_torino', 'fake_brisbane'] | IbmQuantumPlatformDevices = IbmQuantumPlatformDevices.LEAST_BUSY, token: str | None = None, compiler: Compiler | None = None) BackendCreatorFinalizer[IbmQuantumPlatformBackend]
Create an IBM quantum platform backend for running on real and fake IBM devices.
The backend can be used to launch quantum circuits to quantum devices on IBM’s cloud.
- Parameters:
device (Literal['kingston', 'pittsburgh', 'fez', 'marrakesh', 'torino', 'brisbane', 'aachen', 'strasbourg', 'brussels', 'least_busy', 'fake_fez', 'fake_marrakesh', 'fake_torino', 'fake_brisbane'] | ~qrunch.quantum.backends.ibm.ibm_quantum_platform_backend.IbmQuantumPlatformDevices) – Device to run circuit on. Defaults to FAKE_KINGSTON.
token (str | None) – Token used to access IBM’s cloud. All hardware devices require a token.
compiler (Compiler | None) – Compiler for changing into universal gates. the compiler must implement the to_universal_gates method.
- Return type:
- static iqm_resonance(token: str, device: Literal['garnet', 'sirius', 'emerald', 'garnet:mock', 'sirius:mock', 'emerald:mock'] | IqmResonanceDevices = IqmResonanceDevices.GARNET, *, layout_synthesizer: LayoutSynthesizer | None = None, iqm_options: CircuitCompilationOptions | None = None) BackendCreatorFinalizer[IqmResonanceBackend]
Create an IQM resonance backend wrapping the iqm client.
The backend can be used to launch quantum circuits to quantum devices on IQM’s cloud.
- Parameters:
token (str) – Token used to access IQM’s cloud.
device (Literal['garnet', 'sirius', 'emerald', 'garnet:mock', 'sirius:mock', 'emerald:mock'] | ~qrunch.quantum.backends.iqm_resonance.iqm_resonance_backend.IqmResonanceDevices) – Device to run circuit on. Defaults to GARNET.
layout_synthesizer (LayoutSynthesizer | None) – Layout synthesizer to use if the device is not all-to-all connected. A synthesizer can be created using the
layout_synthesizer_creator(). Defaults to QubitDependentLayoutSynthesizer if None is given.iqm_options (CircuitCompilationOptions | None) – Options to be passed to the IQM backend, from :
iqm.iqm_client. Defaults to None.
- Return type:
- static local_amazon_braket(device_to_simulate: DeviceData | None = None, *, layout_synthesizer: LayoutSynthesizer | None = None) BackendCreatorFinalizer[LocalAmazonBraketBackend]
Create a local Amazon Braket backend.
This is a facade around the amazon-braket-sdk’s LocalSimulator device. The backend calculates the full state vector or density matrix of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
The simulator runs locally on your own machine, but may connect to AWS to get the noise model of a specific device.
- Parameters:
device_to_simulate (DeviceData | None) – Device to simulate noise from. If None, no noise is applied.
layout_synthesizer (LayoutSynthesizer | None) – Synthesizer to change into topology. A synthesizer can be created using the
layout_synthesizer_creator(). Defaults to None.
- Return type:
- static local_qiskit_aer(method: Literal['automatic', 'statevector', 'density_matrix', 'stabilizer', 'extended_stabilizer', 'matrix_product_state'] | QiskitAerMethods = QiskitAerMethods.AUTOMATIC, *, device_to_simulate: DeviceData | None = None, seed: int | None = None) BackendCreatorFinalizer[QiskitAerBackend]
Create a Qiskit Aer backend wrapping Qiskit’s local AerSimulator.
The AerSimulator is a noisy quantum circuit simulator backend supporting multiple simulation methods.
- Parameters:
method (Literal['automatic', 'statevector', 'density_matrix', 'stabilizer', 'extended_stabilizer', 'matrix_product_state'] | ~qrunch.quantum.backends.ibm.qiskit_aer_backend.QiskitAerMethods) – The method to use for the backend. Defaults to AUTOMATIC.
device_to_simulate (DeviceData | None) – Data for the device to simulate. Defaults to None.
seed (int | None) – The seed for the random number generator. Defaults to None.
- Return type:
- static local_quimb(*, seed: int | None = None) BackendCreatorFinalizer[QuimbBackend]
Create a Quimb backend wrapping the Quimb local tensor-network simulator.
- Parameters:
seed (int | None) – Seed for the sampler. Defaults to None.
- Return type:
- static local_qulacs() BackendCreatorFinalizer[QulacsBackend]
Create a Qulacs backend wrapping the Qulacs local simulator.
The backend calculates the full state vector of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
- Return type:
- static oqc_cloud(token: str, device: Literal['OQC Toshiko Tokyo-1'] | OqcCloudDevices = OqcCloudDevices.TOKYO, *, error_mitigation: Any | None = None) BackendCreatorFinalizer[OqcCloudBackend]
Create an OQC cloud backend wrapping the qcaas_client.
The backend can be used to launch quantum circuits to quantum devices on OQC’s cloud.
- Parameters:
token (str) – Token used to access OQC’s cloud.
device (Literal['OQC Toshiko Tokyo-1'] | ~qrunch.quantum.backends.oqc_cloud.oqc_cloud.OqcCloudDevices) – Device to run circuit on.
error_mitigation (Any | None) – Optional OQC error mitigation to use. Defaults to None.
- Return type:
- static qiskit(*, qiskit_provider_backend: None = None, seed: int | None = None) BackendCreatorFinalizer[QiskitFakeBackend]
- static qiskit(*, qiskit_provider_backend: qiskit.providers.BackendV2, seed: int | None = None) BackendCreatorFinalizer[QiskitRealBackend]
Create a Qiskit backend wrapping Qiskit’s State Vector simulator.
The backend calculates the full state vector of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
- Parameters:
qiskit_provider_backend – Qiskit backend as implemented through the qiskit package. If None, the state vector simulator will be used. Defaults to None.
seed – The seed for the random number generator. Defaults to None.
- class BackendCreatorFinalizer
Bases:
Generic[B]Finalizer for the creation of backends.
- __init__(backend: B) None
Initialize the finalizer.
- Parameters:
backend (B)
- Return type:
None
- create() B
Create the chosen backend.
- Return type:
B
- class BackendSubCreator
Bases:
Generic[T]SubCreator for creating backends.
- __init__(parent: T, field_name: str) None
Initialize the sub-creator.
- Parameters:
parent (T) – The parent object to which the backend will be added.
field_name (str) – The name of the field in the parent object to which the backend will be
- Return type:
None
- amazon_braket(device: _IQM | _IonQ | _Rigetti | _Amazon | DeviceData, *, layout_synthesizer: LayoutSynthesizer | None = None, max_cost: float = 10000) T
Create a Amazon Braket backend.
This is a facade around the amazon-braket-sdk’s AwsDevice device. The backend can be used to launch quantum circuits to quantum devices on Amazon Braket, or to run (noisy) simulators on Amazon Braket.
See https://aws.amazon.com/braket/pricing/ for pricing information.
- Parameters:
device (_IQM | _IonQ | _Rigetti | _Amazon | DeviceData) – Device to run circuit on.
layout_synthesizer (LayoutSynthesizer | None) – Synthesizer to create device-specific circuit topology. A synthesizer can be created using the
layout_synthesizer_creator(). Defaults to QubitDependentLayoutSynthesizer if None is given.max_cost (float) – Maximum price of a single run-method in USD, only limits QPUs. Defaults to $10,000.
- Return type:
T
- custom(backend: Backend) T
Use a custom backend.
- Parameters:
backend (Backend) – The custom backend to use.
- Return type:
T
- ibm_quantum_platform(*, device: Literal['kingston', 'pittsburgh', 'fez', 'marrakesh', 'torino', 'brisbane', 'aachen', 'strasbourg', 'brussels', 'least_busy', 'fake_fez', 'fake_marrakesh', 'fake_torino', 'fake_brisbane'] | IbmQuantumPlatformDevices = IbmQuantumPlatformDevices.LEAST_BUSY, token: str | None = None, compiler: Compiler | None = None) T
Create an IBM quantum platform backend for running on real and fake IBM devices.
The backend can be used to launch quantum circuits to quantum devices on IBM’s cloud.
- Parameters:
device (Literal['kingston', 'pittsburgh', 'fez', 'marrakesh', 'torino', 'brisbane', 'aachen', 'strasbourg', 'brussels', 'least_busy', 'fake_fez', 'fake_marrakesh', 'fake_torino', 'fake_brisbane'] | ~qrunch.quantum.backends.ibm.ibm_quantum_platform_backend.IbmQuantumPlatformDevices) – Device to run circuit on. Defaults to FAKE_KINGSTON.
token (str | None) – Token used to access IBM’s cloud. All hardware devices require a token.
compiler (Compiler | None) – Compiler for changing into universal gates. the compiler must implement the to_universal_gates method.
- Return type:
T
- iqm_resonance(token: str, device: Literal['garnet', 'sirius', 'emerald', 'garnet:mock', 'sirius:mock', 'emerald:mock'] | IqmResonanceDevices = IqmResonanceDevices.GARNET, *, layout_synthesizer: LayoutSynthesizer | None = None, iqm_options: CircuitCompilationOptions | None = None) T
Create an IQM resonance backend wrapping the iqm client.
The backend can be used to launch quantum circuits to quantum devices on IQM’s cloud.
- Parameters:
token (str) – Token used to access IQM’s cloud.
device (Literal['garnet', 'sirius', 'emerald', 'garnet:mock', 'sirius:mock', 'emerald:mock'] | ~qrunch.quantum.backends.iqm_resonance.iqm_resonance_backend.IqmResonanceDevices) – Device to run circuit on. Defaults to GARNET.
layout_synthesizer (LayoutSynthesizer | None) – Layout synthesizer to use if the device is not all-to-all connected. A synthesizer can be created using the
layout_synthesizer_creator(). Defaults to QubitDependentLayoutSynthesizer if None is given.iqm_options (CircuitCompilationOptions | None) – Options to be passed to the IQM backend, from :
iqm.iqm_client. Defaults to None.
- Return type:
T
- local_amazon_braket(device_to_simulate: DeviceData | None = None, *, layout_synthesizer: LayoutSynthesizer | None = None) T
Create a local Amazon Braket backend.
This is a facade around the amazon-braket-sdk’s LocalSimulator device. The backend calculates the full state vector or density matrix of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
The simulator runs locally on your own machine, but may connect to AWS to get the noise model of a specific device.
- Parameters:
device_to_simulate (DeviceData | None) – Device to simulate noise from. If None, no noise is applied.
layout_synthesizer (LayoutSynthesizer | None) – Synthesizer to change into topology. A synthesizer can be created using the
layout_synthesizer_creator(). Defaults to None.
- Return type:
T
- local_qiskit_aer(method: Literal['automatic', 'statevector', 'density_matrix', 'stabilizer', 'extended_stabilizer', 'matrix_product_state'] | QiskitAerMethods = QiskitAerMethods.AUTOMATIC, *, device_to_simulate: DeviceData | None = None, seed: int | None = None) T
Create a Qiskit Aer backend wrapping Qiskit’s local AerSimulator.
The AerSimulator is a noisy quantum circuit simulator backend supporting multiple simulation methods.
- Parameters:
method (Literal['automatic', 'statevector', 'density_matrix', 'stabilizer', 'extended_stabilizer', 'matrix_product_state'] | ~qrunch.quantum.backends.ibm.qiskit_aer_backend.QiskitAerMethods) – The method to use for the backend. Defaults to AUTOMATIC.
device_to_simulate (DeviceData | None) – Data for the device to simulate. Defaults to None.
seed (int | None) – The seed for the random number generator. Defaults to None.
- Return type:
T
- local_quimb(*, seed: int | None = None) T
Create a Quimb backend wrapping the Quimb local tensor-network simulator.
- Parameters:
seed (int | None) – Seed for the sampler. Defaults to None.
- Return type:
T
- local_qulacs() T
Create a Qulacs backend wrapping the Qulacs local simulator.
The backend calculates the full state vector of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
- Return type:
T
- oqc_cloud(token: str, device: Literal['OQC Toshiko Tokyo-1'] | OqcCloudDevices = OqcCloudDevices.TOKYO, *, error_mitigation: Any | None = None) T
Create an OQC cloud backend wrapping the qcaas_client.
The backend can be used to launch quantum circuits to quantum devices on OQC’s cloud.
- Parameters:
token (str) – Token used to access OQC’s cloud.
device (Literal['OQC Toshiko Tokyo-1'] | ~qrunch.quantum.backends.oqc_cloud.oqc_cloud.OqcCloudDevices) – Device to run circuit on.
error_mitigation (Any | None) – Optional OQC error mitigation to use. Defaults to None.
- Return type:
T
- qiskit(*, qiskit_provider_backend: qiskit.providers.BackendV2 | None = None, seed: int | None = None) T
Create a Qiskit backend wrapping Qiskit’s State Vector simulator.
The backend calculates the full state vector of the given circuit, and uses this to find the probabilities for each possible state in the Hilbert space.
- Parameters:
qiskit_provider_backend (qiskit.providers.BackendV2 | None) – Qiskit backend as implemented through the qiskit package. If None, the state vector simulator will be used. Defaults to None.
seed (int | None) – The seed for the random number generator. Defaults to None.
- Return type:
T
- DEFAULT_BACKEND = <qrunch.quantum.backends.amazon.local_amazon_braket_backend.LocalAmazonBraketBackend object>
Default backend is
qrunch.quantum.backends.amazon.local_braket.LocalBraketBackend.
- backend_creator() BackendCreator
Start creating a backend.
- Return type: