quantax.sampler.MixSampler#
- class quantax.sampler.MixSampler(samplers: Sequence[Metropolis], reweight: float = 2.0, thermal_steps: int | None = None, sweep_steps: int | None = None, initial_spins: Array | None = None)#
A mixture of several metropolis samplers. New samples are proposed randomly by every sampler.
Warning
This sampler only works for ingredient samplers with balanced proposal rates \(P(s'|s) = P(s|s')\)
- __init__(samplers: Sequence[Metropolis], reweight: float = 2.0, thermal_steps: int | None = None, sweep_steps: int | None = None, initial_spins: Array | None = None)#
- Parameters:
state – The state used for computing the wave function and probability.
nsamples – Number of samples generated per iteration. It should be a multiple of the total number of machines to allow samples to be equally distributed on different machines.
reweight – The reweight factor n defining the sample probability \(|\psi|^n\), default to 2.0.
thermal_steps – The number of thermalization steps in the beginning of each Markov chain, default to be 20 * fock state length.
sweep_steps – The number of steps for generating new samples, default to be 2 * fock state length.
initial_spins – The initial spins for every Markov chain before the thermalization steps, default to be random spins.
Methods
__init__
(samplers[, reweight, ...])reset
()Reset all Markov chains to
initial_spins
and thermalize themsweep
([nsweeps])Generate new samples
Attributes
N
is_balanced
Whether the sampler has balanced proposal rate \(P(s'|s) = P(s|s')\), default to True
nflips
The number of flips in new proposal.
nsamples
Number of samples generated per iteration
nstates
reweight
The reweight factor n defining the sample probability \(|\psi|^n\)
state
The state used for computing the wave function and probability