IonQ

Uses IonQ’s trapped-ion quantum computers for circuit evaluation.

Available as IonQClient.

Note

The following two methods are available for using IonQ.

  1. Using an API token: Obtain an API token either by registering as a Fixstars Amplify user, or from your own IonQ account.

  2. Using Amazon Braket: Prepare your own AWS account credentials.

Hint

Amplify Quantum v1.2 added API token authentication support for IonQClient. If you are using an older version of the package, run the following command to upgrade to the latest version.

$ pip install -U 'amplify[quantum]'
Solver specification:

Client class

amplify.IonQClient

Execution parameters

Depends on the algorithm

Execution result

Depends on the algorithm

Execution time

Depends on the algorithm

Quantum computer type

Gate-based, trapped-ion

API method

REST API (Amazon Braket)

The variable types and polynomial degree accepted for the input problem depend on the chosen algorithm.

  • When QAOA is specified as the client argument

    Binary

    Ising

    Integer

    Real

    Objective function

    -

    Nth degree*

    -

    -

    Equality constraint

    -

    **

    -

    -

    Inequality constraint

    -

    -

    -

    -

    *: Problems of arbitrary degree are supported. However, depending on the qubit connectivity of the quantum computer, the required number of qubits may increase.

    **: When Constrained QAOA is selected via QAOA type, N-HOT constraints are supported.

  • When RQAOA is specified as the client argument

    Binary

    Ising

    Integer

    Real

    Objective function

    -

    Nth degree*

    -

    -

    Equality constraint

    -

    -

    -

    -

    Inequality constraint

    -

    -

    -

    -

    *: Problems of arbitrary degree are supported. However, depending on the qubit connectivity of the quantum computer, the required number of qubits may increase.

Client class:

The client class has the following attributes and methods.

Attribute

Data type

Details

token

str | None

The API token used for authentication.

url

str | None

The endpoint URL to connect to.

device

str

The IonQ device name or device ARN to use. Default: "Forte1"

provider

braket.aws.aws_session.AwsSession | None

Specifies the provider used to connect to the device. Currently, only Amazon Braket is supported.

Backend-specific metadata:

Detailed sampling information is available via QAOA’s sampling_meta. Uses BraketJobMeta.

meta = client_result.history[0].sampling_meta
meta.circuit             # The executed circuit object
meta.metadata            # Amazon Braket task metadata (task_id, created_at, ended_at)
Configuration example:
from amplify import QAOA, IonQClient

# Create the client
client = IonQClient(QAOA)

# Specify the device
client.device = "Forte-1"

# Set the API token
client.token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# Set QAOA parameters
client.parameters.reps = 1
client.parameters.shots = 100

If you use Amazon Braket, replace the API token configuration with the following.

import boto3
from braket.aws import AwsSession

session = boto3.Session(profile_name="my-profile")
client.provider = AwsSession(boto_session=session)
Execution example:
from amplify import Model, VariableGenerator, solve

# Create decision variables and the objective function
g = VariableGenerator()
q = g.array("Binary", 2)
f = q[0] * q[1] + q[0] - q[1] + 1

# Create a model
model = Model(f)

# Run the solver
result = solve(model, client)

Obtain the backend version:

>>> client.version()