qiskit_qulacs package#

Submodules#

qiskit_qulacs.adapter module#

Util functions for provider

IsingXX(*args)#
IsingYY(*args)#
IsingZZ(*args)#
convert_qiskit_to_qulacs_circuit(qc)[source]#

The function convert_qiskit_to_qulacs_circuit converts a Qiskit QuantumCircuit to a Qulacs ParametricQuantumCircuit while handling parameter mapping and gate operations.

Parameters:

qc (QuantumCircuit) – The qc is expected to be a QuantumCircuit object from Qiskit.

Returns:

The convert_qiskit_to_qulacs_circuit function returns a nested function circuit_builder that

takes an optional params_values argument. Inside circuit_builder, it constructs a ParametricQuantumCircuit based on the input QuantumCircuit qc provided to the outer function.

convert_sparse_pauliop_to_qulacs_obs(sparse_pauliop)[source]#

The function convert_sparse_pauliop_to_qulacs_obs converts a sparse Pauli operator to a Qulacs observable.

Parameters:
  • sparse_pauliop (SparsePauliOp) – The sparse_pauliop parameter is a sparse

  • contains (representation of a Pauli operator. It is an object that) –

  • is (information about the Pauli terms and their coefficients. Each term) –

  • object (represented by a PauliTerm) –

  • Pauli (which consists of a list of) –

  • corresponding (operators and their) –

Returns:

a Qulacs Observable object.

qgECR(*args)#
qgUnitary(*args)[source]#

The function qgUnitary takes qubits and parameters as input and returns a dense matrix.

Returns:

The function qgUnitary is returning a qg.DenseMatrix object created with the provided qubits

and parameters.

qiskit_to_qulacs(circuits)[source]#

The function qiskit_to_qulacs converts a list of Qiskit quantum circuits into a generator of Qulacs circuits.

Parameters:
  • circuits (List[QuantumCircuit]) – The circuits parameter is a list of

  • objects. (QuantumCircuit) –

Return type:

Iterable[ParametricQuantumCircuit]

qiskit_qulacs.backend_utils module#

Qulacs simulator backend utils

available_devices(devices)[source]#

Check available simulation devices by running a dummy circuit.

generate_config(backend_options, run_options)[source]#

generates a configuration to run simulation

requires_submit(func)[source]#

Decorator to ensure that a submit has been performed before calling the method.

Parameters:

func (callable) – test function to be decorated.

Returns:

the decorated function.

Return type:

callable

qiskit_qulacs.qulacs_backend module#

QulacsBackend class.

class QulacsBackend(configuration=None, properties=None, provider=None, **backend_options)[source]#

Bases: BackendV1

QulacsBackend 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

available_devices()[source]#

Return the available simulation methods.

run(run_input, **run_options)[source]#

Run on the backend.

This method returns a Job object that runs circuits. Depending on the backend this may be either an async or sync call. It is at the discretion of the provider to decide whether running should block until the execution is finished or not: the Job class can handle either situation.

Parameters:
  • run_input (QuantumCircuit or Schedule or list) – An individual or a list of QuantumCircuit or Schedule objects to run on the backend. For legacy providers migrating to the new versioned providers, provider interface a QasmQobj or PulseQobj objects should probably be supported too (but deprecated) for backwards compatibility. Be sure to update the docstrings of subclasses implementing this method to document that. New provider implementations should not do this though as qiskit.qobj will be deprecated and removed along with the legacy providers interface.

  • options – Any kwarg options to pass to the backend for running the config. If a key is also present in the options attribute/object then the expectation is that the value specified will be used instead of what’s set in the options object.

Returns:

The job object for the run

Return type:

Job

qiskit_qulacs.qulacs_estimator module#

QulacsEstimator class.

class QulacsEstimator(*, options=None)[source]#

Bases: Estimator

QulacsEstimator class.

Args: options: Default options.

Raises:

QiskitError – if some classical bits are not used for measurements.

qiskit_qulacs.qulacs_estimator_gradient module#

QulacsEstimatorGradient class.

class QulacsEstimatorGradient(options=None)[source]#

Bases: BaseEstimatorGradient

QulacsEstimatorGradient class.

Parameters:
  • estimator – The estimator used to compute the gradients.

  • options (Optional[Options]) – Primitive backend runtime options used for circuit execution. The order of priority is: options in run method > gradient’s default options > primitive’s default setting. Higher priority setting overrides lower priority setting

  • derivative_type

    The type of derivative. Can be either DerivativeType.REAL DerivativeType.IMAG, or DerivativeType.COMPLEX.

    • DerivativeType.REAL computes \(2 \mathrm{Re}[⟨ψ(ω)|O(θ)|dω ψ(ω)〉]\).

    • DerivativeType.IMAG computes \(2 \mathrm{Im}[⟨ψ(ω)|O(θ)|dω ψ(ω)〉]\).

    • DerivativeType.COMPLEX computes \(2 ⟨ψ(ω)|O(θ)|dω ψ(ω)〉\).

    Defaults to DerivativeType.REAL, as this yields e.g. the commonly-used energy gradient and this type is the only supported type for function-level schemes like finite difference.

qiskit_qulacs.qulacs_job module#

Qulacs Job

class QulacsJob(backend, job_id, fn, circuits, states, run_options=None, executor=None)[source]#

Bases: JobV1

Qulacs Job

Initializes the asynchronous job.

Parameters:
  • backend – the backend used to run the job.

  • job_id – a unique id in the context of the backend used to run the job.

  • kwargs – Any key value metadata to associate with this job.

backend()[source]#

Return the instance of the backend used for this job.

cancel()[source]#

Attempt to cancel the job.

circuits()[source]#

Return the list of QuantumCircuit submitted for this job.

Returns:

the list of QuantumCircuit submitted for this job.

Return type:

list of QuantumCircuit

executor()[source]#

Return the executor for this job

result(timeout=None)[source]#

Get job result. The behavior is the same as the underlying concurrent Future objects,

status()[source]#

Gets the status of the job by querying the Python’s future

submit()[source]#

Submit the job to the backend for execution.

qiskit_qulacs.qulacs_provider module#

QulacsProvider class.

class QulacsProvider[source]#

Bases: ProviderV1

QulacsProvider class.

backends(name=None, filters=None, **kwargs)[source]#

Return a list of backends matching the specified filtering.

Parameters:
  • name (str) – name of the backend.

  • **kwargs – dict used for filtering.

Returns:

a list of Backends that match the filtering

criteria.

Return type:

list[Backend]

get_backend(name=None, **kwargs)[source]#

Return a single backend matching the specified filtering.

Parameters:
  • name (str) – name of the backend.

  • **kwargs – dict used for filtering.

Returns:

a backend matching the filtering.

Return type:

Backend

Raises:

QiskitBackendNotFoundError – if no backend could be found or more than one backend matches the filtering criteria.

qiskit_qulacs.version module#

qiskit qualcs provider version.

Module contents#

Qiskit-Qulacs