quantax.sampler.ExactSampler#

class quantax.sampler.ExactSampler#

Bases: Sampler

Generate samples directly from exact probability

__init__(state: State, nsamples: int, reweight: float = 2.0, symm: Symmetry | None = None)#
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

  • symm – The symmetry for computing the full wave function, default to the symmetry of the state.

sweep() → Samples#

Generate new samples by computing the full wave function.

A representative \(s_0\) of the symmetry basis is drawn with probability \(P(s_0) \propto |\psi_G(s_0)|^n\), where \(\psi_G(s_0) = \psi(s_0) \sqrt{|G s_0|}\) is the amplitude of the normalized symmetric basis state with \(|G s_0|\) the size of the orbit of \(s_0\), and \(\psi\) is the wave function symmetrized by symm. A random symmetry operation then maps it to the sample \(s\). The returned prob is the actual sampling probability \(q_s = P(s_0) m_s / |G|\), with \(m_s = |G| / |G s_0|\) the number of operations mapping \(s_0\) to \(s\), i.e. \(q_s \propto |\psi(s)|^n |G s|^{n/2 - 1}\), which is \(|\psi(s)|^2\) for reweight=2. The returned psi is the wave function of the samples evaluated by the state itself, so that r also corrects the difference from the symmetrized wave function if the state doesn’t carry symm.

property Nmodes: int#

Number of modes (fock state length)

property Nsites: int#

Number of sites

property nsamples: int#

Number of samples generated per iteration

property reweight: Array#

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

property state: State#

The state used for computing the wave function and probability