This sampler acts locally only on two local degree of freedom and , and proposes a new state: , where in general and . The sites and are also chosen to be within a maximum graph distance of .
The transition probability associated to this sampler can be decomposed into two steps:
- A pair of indices , and such that , is chosen with uniform probability.
- The sites are exchanged, i.e. and .
Notice that this sampling method generates random permutations of the quantum numbers, thus global quantities such as the sum of the local quantum n umbers are conserved during the sampling. This scheme should be used then only when sampling in a region where is needed, otherwise the sampling would be strongly not ergodic.
Constructs a new
MetropolisExchange sampler given a machine and a
|machine||netket._C_netket.machine.Machine||A machine used for the sampling. The probability distribution being sampled from is , where the function , is arbitrary, by default .|
|graph||netket._C_netket.graph.Graph||A graph used to define the distances among the degrees of freedom being sampled.|
|d_max||int=1||The maximum graph distance allowed for exchanges.|
Sampling from a RBM machine in a 1D lattice of spin 1/2, using nearest-neighbours exchanges.
>>> import netket as nk >>> >>> g=nk.graph.Hypercube(length=10,n_dim=2,pbc=True) >>> hi=nk.hilbert.Spin(s=0.5,graph=g) >>> >>> # RBM Spin Machine >>> ma = nk.machine.RbmSpin(alpha=1, hilbert=hi) >>> >>> # Construct a MetropolisExchange Sampler >>> sa = nk.sampler.MetropolisExchange(machine=ma,graph=g,d_max=1) >>> print(sa.hilbert.size) 100
Resets the state of the sampler, including the acceptance rate statistics and optionally initializing at random the visible units being sampled.
Seeds the random number generator used by the
|base_seed||int||The base seed for the random number generator|
Performs a sampling sweep. Typically a single sweep consists of an extensive number of local moves.
|acceptance||numpy.array||The measured acceptance rate for the sampling. In the case of rejection-free sampling this is always equal to 1.|
|hilbert||netket.hilbert||The Hilbert space used for the sampling.|
|machine||netket.machine||The machine used for the sampling.|
|machine_func||function(complex)||The function to be used for sampling. by default is sampled, however in general|
|visible||numpy.array||The quantum numbers being sampled, and distributed according to|