quantax.sampler.Samples#

class quantax.sampler.Samples#

The samples generated by the sampler. This class is jittable, and there are 3 attributes.

spins:

The spin configurations

wave_function:

The wave_function of the spin configurations

reweight_factor:

According to

\[\left< x \right>_p = \frac{\sum_s p_s x_s}{\sum_s p_s} = \frac{\sum_s q_s x_s p_s/q_s}{\sum_s q_s p_s/q_s} = \frac{\left< x p/q \right>_q}{\left< p/q \right>_q},\]

the expectation value with probability distribution p can be computed from samples with a different probability distribution q.

The reweighting factor is defined as

\[r_s = \frac{p_s/q_s}{\left< p/q \right>_q},\]

so that \(\left< x \right>_p = \left< r x \right>_q\).

Usually, \(p_s = |\psi(s)|^2\) is the target probability, and \(q_s\) can be chosen as \(|\psi(s)|^n\) or computed from a helper neural network. In the former case, \(r_s = \frac{|\psi_s|^{2-n}}{\left< |\psi|^{2-n} \right>}\)

state_internal:

The internal status of samples for the forward pass.

__init__(spins: Array, wave_function: Array, state_internal: PyTree = None, reweight_factor: Array | None = None)#
Parameters:
  • spins – The spin configurations

  • wave_function – The wave_function of the spin configurations

  • reweight – Either a number \(n\) specifying the reweighting probability \(|\psi(s)|^n\), or the unnormalized reweighting factor \(r'_s = p_s/q_s\)