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. Note that Python 3.11 or later may be required for authentication and communication.

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:

In addition to the common client interface, 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.

Method

Return type

Details

get_options()

dict[str, Any]

Gets the execution options explicitly set by set_options.

set_options()

None

Sets execution options.

Backend-specific metadata:

Detailed sampling information is available via QAOA’s sampling_meta.

meta = client_result.history[0].sampling_meta
meta.circuit             # The executed circuit object
Configuration example:
from amplify import QAOA, IonQClient

# Create the client
client = IonQClient(QAOA)

# Specify the device
client.device = "qpu.forte-1"  # When using the Forte-1 QPU

# When using the simulator (the simulator is only available via API token)
# client.device = "simulator"
# client.set_options(noise_model="forte-1")  # Specify the noise model

# 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()