QDriftSampler
class QDriftSampler(gate, num_terms, weights, rng)
Bases: object
The draws of the qDRIFT protocol for one Evolution gate.
This is what FermionicQDrift.sampler() returns. It holds the distribution derived from the gate, and exists so that a caller that needs to look at each draw (the QDriftTrotterization pass, when it rejects draws) can take them one at a time, whereas FermionicQDrift.synthesize() takes them all at once.
Initializing a sampler can be done with the arguments below.
Parameters
- gate (Evolution) – the gate to sample.
- num_terms (int) – the number of gates the whole sample holds.
- weights (np.ndarray | None) – the sampling weights, or
Noneto derive them from the operator ofgate. - rng (np.random.Generator) – the random number generator to draw from.
Raises
ValueError – if weights does not hold one entry per group (or term) of the operator.
Attributes
time
The evolution time of every sampled gate.
Methods
draw
sample
Was this page helpful?
Report a bug, typo, or request content on GitHub.