qlauncher.routines.qiskit.adapters#

Summary#

Classes:

EstimatorV1ToEstimatorV2Adapter

SamplerV1ToSamplerV2Adapter

Adapts a v1 sampler to a v2 interface.

SamplerV2ToSamplerV1Adapter

Adapts a v2 sampler to a v1 interface.

TranslatingSampler

TranslatingSamplerV1

Reference#

class qlauncher.routines.qiskit.adapters.SamplerV2ToSamplerV1Adapter(sampler_v2: BaseSamplerV2, backend=None)[source]#

Bases: BaseSamplerV1

Adapts a v2 sampler to a v1 interface.

class qlauncher.routines.qiskit.adapters.SamplerV1ToSamplerV2Adapter(sampler_v1: BaseSamplerV1)[source]#

Bases: BaseSamplerV2

Adapts a v1 sampler to a v2 interface.

run(pubs: Iterable[QuantumCircuit | Tuple[QuantumCircuit] | Tuple[QuantumCircuit, Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]] | Tuple[QuantumCircuit, Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], Integral | None]], *, shots: int | None = None) BasePrimitiveJob[PrimitiveResult[SamplerPubResult], Any][source]#

Run and collect samples from each pub.

Parameters:
  • pubs (Iterable[QuantumCircuit | Tuple[QuantumCircuit] | Tuple[QuantumCircuit, Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]] | Tuple[QuantumCircuit, Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], Integral | None]]) – An iterable of pub-like objects. For example, a list of circuits or tuples (circuit, parameter_values).

  • shots (int | None) – The total number of shots to sample for each sampler pub that does not specify its own shots. If None, the primitive’s default shots value will be used, which can vary by implementation.

Returns:

The job object of Sampler’s result.

Return type:

BasePrimitiveJob[PrimitiveResult[SamplerPubResult], Any]

class qlauncher.routines.qiskit.adapters.EstimatorV1ToEstimatorV2Adapter(estimator: BaseEstimatorV1)[source]#

Bases: BaseEstimatorV2

run(pubs: Iterable[EstimatorPub | Tuple[QuantumCircuit, str | Pauli | SparsePauliOp | Mapping[str | Pauli, float] | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | bytes | _NestedSequence[bool | int | float | complex | str | bytes]] | Tuple[QuantumCircuit, str | Pauli | SparsePauliOp | Mapping[str | Pauli, float] | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | bytes | _NestedSequence[bool | int | float | complex | str | bytes], Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]] | Tuple[QuantumCircuit, str | Pauli | SparsePauliOp | Mapping[str | Pauli, float] | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | bytes | _NestedSequence[bool | int | float | complex | str | bytes], Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], Real]], *, precision: float | None = None) BasePrimitiveJob[PrimitiveResult[PubResult], Any][source]#

Estimate expectation values for each provided pub (Primitive Unified Bloc).

Parameters:
  • pubs (Iterable[EstimatorPub | Tuple[QuantumCircuit, str | Pauli | SparsePauliOp | Mapping[str | Pauli, float] | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | bytes | _NestedSequence[bool | int | float | complex | str | bytes]] | Tuple[QuantumCircuit, str | Pauli | SparsePauliOp | Mapping[str | Pauli, float] | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | bytes | _NestedSequence[bool | int | float | complex | str | bytes], Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]] | Tuple[QuantumCircuit, str | Pauli | SparsePauliOp | Mapping[str | Pauli, float] | Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | bytes | _NestedSequence[bool | int | float | complex | str | bytes], Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], Real]]) – An iterable of pub-like objects, such as tuples (circuit, observables) or (circuit, observables, parameter_values).

  • precision (float | None) – The target precision for expectation value estimates of each run Estimator Pub that does not specify its own precision. If None the estimator’s default precision value will be used.

Returns:

A job object that contains results.

Return type:

BasePrimitiveJob[PrimitiveResult[PubResult], Any]

class qlauncher.routines.qiskit.adapters.TranslatingSamplerV1(sampler_v1: BaseSamplerV1, compatible_circuit: QuantumCircuit | Circuit, options: dict | None = None)[source]#

Bases: BaseSamplerV1

class qlauncher.routines.qiskit.adapters.TranslatingSampler(sampler_v2: BaseSamplerV2, compatible_circuit: QuantumCircuit | Circuit)[source]#

Bases: BaseSamplerV2

run(pubs: Iterable[QuantumCircuit | Tuple[QuantumCircuit] | Tuple[QuantumCircuit, Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]] | Tuple[QuantumCircuit, Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], Integral | None] | Circuit], *, shots: int | None = None) BasePrimitiveJob[PrimitiveResult[SamplerPubResult], Any][source]#

Run and collect samples from each pub.

Parameters:
  • pubs (Iterable[QuantumCircuit | Tuple[QuantumCircuit] | Tuple[QuantumCircuit, Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]]] | Tuple[QuantumCircuit, Mapping[Parameter | str | Tuple[Parameter | str, ...], Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], Integral | None] | Circuit]) – An iterable of pub-like objects. For example, a list of circuits or tuples (circuit, parameter_values).

  • shots (int | None) – The total number of shots to sample for each sampler pub that does not specify its own shots. If None, the primitive’s default shots value will be used, which can vary by implementation.

Returns:

The job object of Sampler’s result.

Return type:

BasePrimitiveJob[PrimitiveResult[SamplerPubResult], Any]