quantax.sampler.ExactSampler#
- class quantax.sampler.ExactSampler#
Bases:
SamplerGenerate 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 returnedprobis 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\) forreweight=2. The returnedpsiis the wave function of the samples evaluated by the state itself, so thatralso corrects the difference from the symmetrized wave function if the state doesnβt carrysymm.