IonQ Backends#

IonQ provider backends.

class qiskit_ionq.ionq_backend.IonQBackend(configuration, provider=None, **fields)[source]#

IonQ Backend base class.

Initialize a backend class

Parameters:
  • configuration (BackendConfiguration) – A backend configuration object for the backend object.

  • provider (qiskit.providers.Provider) – Optionally, the provider object that this Backend comes from.

  • fields – kwargs for the values to use to override the default options.

Raises:

AttributeError – if input field not a valid options

In addition to the public abstract methods, subclasses should also implement the following private methods:

classmethod _default_options()[source]

Return the default options

This method will return a qiskit.providers.Options subclass object that will be used for the default options. These should be the default parameters to use for the options of the backend.

Returns:

A options object with

default values set

Return type:

qiskit.providers.Options

calibration()[source]#

Fetch the most recent calibration data for this backend.

Returns:

A calibration data wrapper.

Return type:

Calibration

property client#

A lazily populated IonQ API Client.

Returns:

An instance of a REST API client

Return type:

IonQClient

configuration()#

Return the backend configuration.

Returns:

the configuration for the backend.

Return type:

BackendConfiguration

create_client()[source]#

Create an IonQ REST API Client using provider credentials.

Raises:

IonQCredentialsError – If the provider’s credentials does not have a "token" or "url" key, or if their values are None.

Returns:

An instance of a REST API client.

Return type:

IonQClient

abstract gateset()[source]#

Helper method returning the gateset this backend is targeting.

has_valid_mapping(circuit) bool[source]#

checks if the circuit has at least one valid qubit -> bit measurement.

Parameters:

circuit (QuantumCircuit) – A Qiskit QuantumCircuit object.

Returns:

if the circuit has valid mappings

Return type:

boolean

name()#

Return the backend name.

Returns:

the name of the backend.

Return type:

str

property options#

Return the options for the backend

The options of a backend are the dynamic parameters defining how the backend is used. These are used to control the run() method.

properties()#

Return the backend properties.

Returns:

the configuration for the backend. If the backend does not support properties, it returns None.

Return type:

BackendProperties

provider()#

Return the backend Provider.

Returns:

the Provider responsible for the backend.

Return type:

Provider

retrieve_job(job_id)[source]#

get a job from a specific backend, by job id.

retrieve_jobs(job_ids)[source]#

get a list of jobs from a specific backend, job id

run(circuit, **kwargs)[source]#

Create and run a job on an IonQ Backend.

Note

IonQ backends do not support multi-experiment jobs. If circuit is provided as a list with more than one element then this method will raise out with a RuntimeError.

Parameters:

circuit (QuantumCircuit) – A Qiskit QuantumCircuit object.

Returns:

A reference to the job that was submitted.

Return type:

IonQJob

Raises:

RuntimeError – If a multi-experiment circuit was provided.

set_options(**fields)#

Set the options fields for the backend

This method is used to update the options of a backend. If you need to change any of the options prior to running just pass in the kwarg with the new value for the options.

Parameters:

fields – The fields to update the options

Raises:

AttributeError – If the field passed in is not part of the options

status()[source]#

Return a backend status object to the caller.

Returns:

the status of the backend.

Return type:

BackendStatus

abstract with_name(name, **kwargs)[source]#

Helper method that returns this backend with a more specific target system.

class qiskit_ionq.ionq_backend.IonQQPUBackend(provider, name='ionq_qpu', gateset='qis')[source]#

IonQ Backend for running qpu-based jobs.

Initialize a backend class

Parameters:
  • configuration (BackendConfiguration) – A backend configuration object for the backend object.

  • provider (qiskit.providers.Provider) – Optionally, the provider object that this Backend comes from.

  • fields – kwargs for the values to use to override the default options.

Raises:

AttributeError – if input field not a valid options

In addition to the public abstract methods, subclasses should also implement the following private methods:

classmethod _default_options()

Return the default options

This method will return a qiskit.providers.Options subclass object that will be used for the default options. These should be the default parameters to use for the options of the backend.

Returns:

A options object with

default values set

Return type:

qiskit.providers.Options

calibration()#

Fetch the most recent calibration data for this backend.

Returns:

A calibration data wrapper.

Return type:

Calibration

property client#

A lazily populated IonQ API Client.

Returns:

An instance of a REST API client

Return type:

IonQClient

configuration()#

Return the backend configuration.

Returns:

the configuration for the backend.

Return type:

BackendConfiguration

create_client()#

Create an IonQ REST API Client using provider credentials.

Raises:

IonQCredentialsError – If the provider’s credentials does not have a "token" or "url" key, or if their values are None.

Returns:

An instance of a REST API client.

Return type:

IonQClient

gateset()[source]#

Helper method returning the gateset this backend is targeting.

has_valid_mapping(circuit) bool#

checks if the circuit has at least one valid qubit -> bit measurement.

Parameters:

circuit (QuantumCircuit) – A Qiskit QuantumCircuit object.

Returns:

if the circuit has valid mappings

Return type:

boolean

name()#

Return the backend name.

Returns:

the name of the backend.

Return type:

str

property options#

Return the options for the backend

The options of a backend are the dynamic parameters defining how the backend is used. These are used to control the run() method.

properties()#

Return the backend properties.

Returns:

the configuration for the backend. If the backend does not support properties, it returns None.

Return type:

BackendProperties

provider()#

Return the backend Provider.

Returns:

the Provider responsible for the backend.

Return type:

Provider

retrieve_job(job_id)#

get a job from a specific backend, by job id.

retrieve_jobs(job_ids)#

get a list of jobs from a specific backend, job id

run(circuit, **kwargs)#

Create and run a job on an IonQ Backend.

Note

IonQ backends do not support multi-experiment jobs. If circuit is provided as a list with more than one element then this method will raise out with a RuntimeError.

Parameters:

circuit (QuantumCircuit) – A Qiskit QuantumCircuit object.

Returns:

A reference to the job that was submitted.

Return type:

IonQJob

Raises:

RuntimeError – If a multi-experiment circuit was provided.

set_options(**fields)#

Set the options fields for the backend

This method is used to update the options of a backend. If you need to change any of the options prior to running just pass in the kwarg with the new value for the options.

Parameters:

fields – The fields to update the options

Raises:

AttributeError – If the field passed in is not part of the options

status()#

Return a backend status object to the caller.

Returns:

the status of the backend.

Return type:

BackendStatus

with_name(name, **kwargs)[source]#

Helper method that returns this backend with a more specific target system.

class qiskit_ionq.ionq_backend.IonQSimulatorBackend(provider, name='ionq_simulator', gateset='qis')[source]#

IonQ Backend for running simulated jobs.

Attention

When noise_model ideal is specified, the maximum shot-count for a state vector sim is always 1.

Attention

When noise_model ideal is specified, calling get_counts on a job processed by this backend will return counts expressed as probabilites, rather than a multiple of shots.

Base class for interfacing with an IonQ backend

calibration()[source]#

Simulators have no calibration data.

Returns:

None

Return type:

NoneType

property client#

A lazily populated IonQ API Client.

Returns:

An instance of a REST API client

Return type:

IonQClient

configuration()#

Return the backend configuration.

Returns:

the configuration for the backend.

Return type:

BackendConfiguration

create_client()#

Create an IonQ REST API Client using provider credentials.

Raises:

IonQCredentialsError – If the provider’s credentials does not have a "token" or "url" key, or if their values are None.

Returns:

An instance of a REST API client.

Return type:

IonQClient

gateset()[source]#

Helper method returning the gateset this backend is targeting.

has_valid_mapping(circuit) bool#

checks if the circuit has at least one valid qubit -> bit measurement.

Parameters:

circuit (QuantumCircuit) – A Qiskit QuantumCircuit object.

Returns:

if the circuit has valid mappings

Return type:

boolean

name()#

Return the backend name.

Returns:

the name of the backend.

Return type:

str

property options#

Return the options for the backend

The options of a backend are the dynamic parameters defining how the backend is used. These are used to control the run() method.

properties()#

Return the backend properties.

Returns:

the configuration for the backend. If the backend does not support properties, it returns None.

Return type:

BackendProperties

provider()#

Return the backend Provider.

Returns:

the Provider responsible for the backend.

Return type:

Provider

retrieve_job(job_id)#

get a job from a specific backend, by job id.

retrieve_jobs(job_ids)#

get a list of jobs from a specific backend, job id

run(circuit, **kwargs)[source]#

Create and run a job on IonQ’s Simulator Backend.

Parameters:

circuit (QuantumCircuit) – A Qiskit QuantumCircuit object.

Returns:

A reference to the job that was submitted.

Return type:

IonQJob

set_options(**fields)#

Set the options fields for the backend

This method is used to update the options of a backend. If you need to change any of the options prior to running just pass in the kwarg with the new value for the options.

Parameters:

fields – The fields to update the options

Raises:

AttributeError – If the field passed in is not part of the options

status()#

Return a backend status object to the caller.

Returns:

the status of the backend.

Return type:

BackendStatus

with_name(name, **kwargs)[source]#

Helper method that returns this backend with a more specific target system.