quantax.sampler.Sampler#

class quantax.sampler.Sampler#

Abstract class for samplers

__init__(state: State, nsamples: int, reweight: float = 2.0)#
Parameters:
  • state – The state used for computing the wave function and probability

  • nsamples – Number of samples generated per iteration

  • reweight – The reweight factor n defining the sample probability \(|\psi|^n\), default to 2.0

property state: State#

The state used for computing the wave function and probability

property Nsites: int#

Number of sites

property Nmodes: int#

Number of modes (fock state length)

property nsamples: int#

Number of samples generated per iteration

property reweight: Array#

The reweight factor n defining the sample probability \(|\psi|^n\)

sweep() → Samples#

Generate new samples.

The returned Samples carry spins and prob, the probability the samples are actually drawn from, up to a constant. The wave function psi and the reweighting factor r towards \(|\psi|^2\) are also returned if psi evaluated in the sampling is consistent with the forward pass of the state. Otherwise, they are filled in later, e.g. by Oloc.