qrunch.quantum.samplers

Contains the logic for quantum state samplers, either through a Backend or simulation.

Functions

sampler_creator()

Start creating a sampler.

Classes

SamplerCreator

Builder for all types of samplers available.

class SamplerCreator

Bases: object

Builder for all types of samplers available. Default is the ExcitationGateSampler.

static backend() BackendSamplerCreator

Narrow the sampler type to a backend sampler.

A backend sampler uses one of the available quantum or simulation backends to run and sample from the quantum circuit.

Return type:

BackendSamplerCreator

static create() ExcitationGateSampler

Create an instance of ExcitationGateSampler.

Return type:

ExcitationGateSampler

static excitation_gate() ExcitationGateSamplerCreator

Narrow the sampler type to an excitation gate sampler.

This sampler uses Kvantify’s proprietary simulator optimized for circuits built from excitation gates, and thus tailored specifically for quantum chemistry applications. It is thus the recommended sampler for simulating quantum algorithms for quantum chemistry.

Return type:

ExcitationGateSamplerCreator

static memory_restricted() MemoryRestrictedSamplerCreator

Narrow the sampler type to a memory restricted sampler.

This sampler is a memory-efficient version that uses Kvantify’s of proprietary simulator optimized for circuits built from excitation gates, and thus tailored specifically for quantum chemistry applications. It uses a configurable maximum amount of memory to enable simulation of larger systems than the excitation gate sampler, switching to a more memory-efficient mode when the limit is reached.

For small systems where the full state vector can be stored in memory, the excitation gate sampler will typically be faster, but for larger systems where the full state vector cannot be stored in memory, or is too slow, this simulator will enable simulation of larger systems at the cost of some precision.

Return type:

MemoryRestrictedSamplerCreator

sampler_creator() SamplerCreator

Start creating a sampler.

Return type:

SamplerCreator

Modules

backend_sampler

Module for backend sampler.

creators

Builder classes for creating samplers for all available samplers.

excitation_gate_sampler

Module for excitation gate sampler.

memory_restricted_sampler

Module containing the a memory restricted estimator.

sampler

Base class for samplers.

sampler_shot_counter

Module for implementing Sampler for counting shots of running on quantum hardware.