AzureQuantumService Class

Class for interfacing with the Azure Quantum service using Cirq quantum circuits

AzureQuantumService class

Inheritance
builtins.object
AzureQuantumService

Constructor

AzureQuantumService(workspace: Workspace = None, default_target: str | None = None, **kwargs)

Parameters

Name Description
workspace

Azure Quantum workspace. If missing it will create a new Workspace passing kwargs to the constructor. Defaults to None.

Default value: None
default_target

Default target name, defaults to None

Default value: None

Methods

create_job

Create job to run the given cirq program in Azure Quantum

estimate_cost

Estimate the cost for a given circuit.

get_job

Get Cirq Job by job ID

get_target

Get target with the specified name

run

Run Cirq circuit on specified target, if target not specified then it runs on the default target

targets

Get all quantum computing targets available in the Azure Quantum Workspace.

create_job

Create job to run the given cirq program in Azure Quantum

create_job(program: Circuit, repetitions: int, name: str = 'cirq-job', target: str = None, param_resolver: cirq.ParamResolver | Mapping[cirq.TParamKey, cirq.TParamValComplex] | None = cirq.ParamResolver({})) -> CirqJob | CirqIonqJob

Parameters

Name Description
program
Required
<xref:cirq.Circuit>

Cirq program or circuit

repetitions
Required
int

Number of measurements

name
str

Program name

Default value: cirq-job
target
str

Target name

Default value: None
param_resolver
<xref:cirq.ParamResolverOrSimilarType>

Parameter resolver for cirq program

Default value: cirq.ParamResolver({})

Returns

Type Description
Job

Job

estimate_cost

Estimate the cost for a given circuit.

estimate_cost(program: Circuit, repetitions: int, target: str = None, param_resolver: ParamResolver | Mapping[str | Expr, complex | float | Complex | Expr] | None = cirq.ParamResolver({}), **kwargs)

Parameters

Name Description
program
Required
<xref:cirq.Circuit>

Cirq program or circuit

repetitions
Required
int

Number of measurement repetitions

target
str

Target name, defaults to default_target

Default value: None
param_resolver
<xref:cirq.ParamResolverOrSimilarType>

Cirq parameters, defaults to cirq.ParamResolver({})

Default value: cirq.ParamResolver({})

get_job

Get Cirq Job by job ID

get_job(job_id: str, *args, **kwargs) -> CirqJob | CirqIonqJob

Parameters

Name Description
job_id
Required
str

Job ID

Returns

Type Description
Job

Job

get_target

Get target with the specified name

get_target(name: str = None, **kwargs) -> CirqTarget

Parameters

Name Description
name
str

Target name

Default value: None

Returns

Type Description

Cirq target

run

Run Cirq circuit on specified target, if target not specified then it runs on the default target

run(program: Circuit, repetitions: int, target: str = None, name: str = 'cirq-job', param_resolver: ParamResolver | Mapping[str | Expr, complex | float | Complex | Expr] | None = cirq.ParamResolver({}), seed: Any = None, timeout_seconds: int = 300) -> Result

Parameters

Name Description
program
Required
<xref:cirq.Circuit>

Cirq program or circuit

repetitions
Required
int

Number of measurement repetitions

target
str

Target name, defaults to default_target

Default value: None
name
str

Program name, defaults to "cirq-job"

Default value: cirq-job
param_resolver
<xref:cirq.ParamResolverOrSimilarType>

Cirq parameters, defaults to cirq.ParamResolver({})

Default value: cirq.ParamResolver({})
seed
<xref:cirq.RANDOM_STATE_OR_SEED_LIKE>

Random seed for simulator results, defaults to None

Default value: None
timeout_seconds
int

Timeout in seconds, defaults to None

Default value: 300

Returns

Type Description
<xref:cirq.Result>

Measurement results

targets

Get all quantum computing targets available in the Azure Quantum Workspace.

targets(name: str = None, provider_id: str = None, **kwargs) -> CirqTarget | List[CirqTarget]

Parameters

Name Description
name
str

Target name, defaults to None

Default value: None
provider_id
Default value: None

Returns

Type Description

Target instance or list thereof