acquantum_qiskit package

Submodules

acquantum_qiskit.acquantumbackend module

class acquantum_qiskit.acquantumbackend.AcQuantumBackend(configuration, provider, credentials, api)

Bases: qiskit.providers.basebackend.BaseBackend

run(qobj, job_name=None)

Run a Qobj on the the backend.

properties()

Return backend properties.

Returns:
BackendProperties: the configuration for the backend. If the backend does not support properties, it returns None.
status()

Return backend status.

Returns:
BackendStatus: the status of the backend.
jobs(limit=50, skip=0)
Parameters:
  • limit – number of jobs to retrieve
  • skip – starting index of retrieval
Returns:

list of AcQuantumJob instances

Raises:

AcQuantumRequestError

retrieve_job(job_id)
Parameters:job_id – job id of the job to retrieve
Returns:job: AcQuantum Job
Raises:AcQuantumBackendError: if retrieval fails
backend_type()

acquantum_qiskit.acquantumerrors module

exception acquantum_qiskit.acquantumerrors.AcQuantumError(*message)

Bases: qiskit.qiskiterror.QISKitError

exception acquantum_qiskit.acquantumerrors.AcQuantumAccountError(*message)

Bases: acquantum_qiskit.acquantumerrors.AcQuantumError

Base class for errors raised by account management.

exception acquantum_qiskit.acquantumerrors.AcQuantumJobError(*message)

Bases: acquantum_qiskit.acquantumerrors.AcQuantumError

Base class for errors raised by job errors

exception acquantum_qiskit.acquantumerrors.AcQuantumJobTimeOutError(*message)

Bases: acquantum_qiskit.acquantumerrors.AcQuantumJobError

exception acquantum_qiskit.acquantumerrors.AcQuantumBackendError(*message)

Bases: acquantum_qiskit.acquantumerrors.AcQuantumError

acquantum_qiskit.acquantumjob module

class acquantum_qiskit.acquantumjob.AcQuantumJobStatus

Bases: enum.Enum

Class for job status enumerated type.

INITIALIZING = 'job is being initialized'
QUEUED = 'job is queued'
VALIDATING = 'job is being validated'
RUNNING = 'job is actively running'
CANCELLED = 'job has been cancelled'
DONE = 'job has successfully run'
ERROR = 'job incurred error'
class acquantum_qiskit.acquantumjob.AcQuantumJob(backend, job_id, api, is_device, qobj=None, creation_date=None, api_status=None, job_name=None)

Bases: qiskit.providers.basejob.BaseJob

Represent the jobs that will be executed on Alibaba Computing Quantum simulators and real devices. Jobs are intended to be created calling run() on a particular backend.

Creating a AcQuantumJob instance does not imply running it. You need to do it in separate steps:

job = AcQuantumJob(..)
job.submit() # will block!
job_id()

Return a unique id identifying the job.

submit(n_qubits=None)

Submit the job to the backend.

cancel()
Returns:bool: True if job can be cancelled else False.
Raises:AcQuantumJobError: if there was some unexpected failure in the server
result(timeout=None, wait=5)

Return the result from the job. :param timeout: number of seconds to wait for job :param wait: time between queries to Alibaba Computing Quantum :return: qiskit.Result

status()

Query the Api to update the status of the job :return: The status of the job, once updated :raises: AcQuantumJobError: if there was an unknown answer from the server

get_queue_position()

acquantum_qiskit.acquantumprovider module

class acquantum_qiskit.acquantumprovider.AcQuantumProvider

Bases: qiskit.providers.baseprovider.BaseProvider

backends(name=None, **kwargs)
Parameters:
  • name – name of the backend
  • kwargs – kwargs for filtering not yet implemented
Returns:

enable_account(credentials=None, user=None, password=None)

Establishes a user/password connection to the API of the alibaba’s quantum computing interface. If a AcQuantumCredentials is given it will be used with precedence. Else you can provide a user/password. If no arguments are passed, the environment variables ACQ_USER and ACQ_PWD are used, if they exist.

Parameters:
  • credentials – optional. if given it has precedence
  • user – optional, if given the argument password must also be given
  • password – optional, if given the argument user must also be given

acquantum_qiskit.acquantumsingleprovider module

class acquantum_qiskit.acquantumsingleprovider.AcQuantumSingleProvider(credentials, provider)

Bases: qiskit.providers.baseprovider.BaseProvider

backends(name=None, **kwargs)
Parameters:
  • name – name of backends
  • kwargs
Returns:

acquantum_qiskit.backendconfiguration module

class acquantum_qiskit.backendconfiguration.AcQuantumGateConfigSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)

Bases: qiskit.validation.base.BaseSchema

Schema for AcQuantumGateConfig.

model_cls

alias of AcQuantumGateConfig

opts = <marshmallow.schema.SchemaOpts object>
class acquantum_qiskit.backendconfiguration.AcQuantumBackendConfigurationSchema(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)

Bases: qiskit.validation.base.BaseSchema

Schema for AcQuantumBackendConfiguration.

model_cls

alias of AcQuantumBackendConfiguration

opts = <marshmallow.schema.SchemaOpts object>
class acquantum_qiskit.backendconfiguration.AcQuantumBackendConfiguration(backend_name, backend_version, n_qubits, basis_gates, gates, local, simulator, conditional, open_pulse, memory, max_shots, **kwargs)

Bases: qiskit.validation.base.BaseModel

Model for BackendConfiguration.

Please note that this class only describes the required fields. For the full description of the model, please check AcQuantumBackendConfigurationSchema. Attributes:

backend_name (str): backend name. backend_version (str): backend version in the form X.Y.Z. n_qubits (int): number of qubits. basis_gates (list[str]): list of basis gates names on the backend. gates (GateConfig): list of basis gates on the backend. local (bool): backend is local or remote. simulator (bool): backend is a simulator. conditional (bool): backend supports conditional operations. open_pulse (bool): backend supports open pulse. memory (bool): backend supports memory. max_shots (int): maximum number of shots supported.
schema = <AcQuantumBackendConfigurationSchema(many=False, strict=False)>
shallow_schema = <AcQuantumBackendConfigurationSchema(many=False, strict=False)>
class acquantum_qiskit.backendconfiguration.AcQuantumGateConfig(name, parameters, qasm_def, **kwargs)

Bases: qiskit.validation.base.BaseModel

Model for AcQuantumGateConfig.

Please note that this class only describes the required fields. For the full description of the model, please check AcQuantumGateConfigSchema.

Attributes:

name (str): the gate name as it will be referred to in QASM. parameters (list[str]): variable names for the gate parameters (if any). qasm_def (str): definition of this gate in terms of QASM primitives U

and CX.
schema = <AcQuantumGateConfigSchema(many=False, strict=False)>
shallow_schema = <AcQuantumGateConfigSchema(many=False, strict=False)>

Module contents