netket.sampler#

Inheritance diagram of netket.sampler, netket.sampler.rules

Abstract Classes#

Below you find a list of all abstract classes defined in this module, from which you can inherit if you want to define new hilbert spaces.

Sampler

Abstract base class for all samplers.

SamplerState

Base class holding the state of a sampler.

MetropolisSamplerState

State for a Metropolis sampler.

MetropolisRule

Base class for transition rules of Metropolis, such as Local, Exchange, Hamiltonian and several others.

List of Samplers#

This is a list of all available samplers. Please note that samplers with Numpy in their name are implemented in Numpy and not in pure jax, and they will convert from numpy<->jax at every sampling step the state. If you are using GPUs, this conversion can be very costly. On CPUs, while the conversion is cheap, the dispatch cost of jax is considerate for small systems.

In general those samplers, while they have the same asymptotic cost of Jax samplers, have a much higher overhead for small to moderate (for GPUs) system sizes.

This is because it is not possible to implement all transition rules in Jax.

ExactSampler

This sampler generates i.i.d.

MetropolisSampler

Metropolis-Hastings sampler for a Hilbert space according to a specific transition rule.

MetropolisSamplerNumpy

Metropolis-Hastings sampler for an Hilbert space according to a specific transition rule executed on CPU through Numpy.

ARDirectSampler

Direct sampler for autoregressive neural networks.

experimental.sampler.MetropolisPtSampler

Metropolis-Hastings with Parallel Tempering sampler.

This is a list of shorthands that allow to construct a MetropolisSampler with a corresponding rule.

MetropolisLocal(hilbert, **kwargs)

Sampler acting on one local degree of freedom.

MetropolisExchange(hilbert, *[, clusters, ...])

This sampler acts locally only on two local degree of freedom \(s_i\) and \(s_j\), and proposes a new state: \(s_1 \dots s^\prime_i \dots s^\prime_j \dots s_N\), where in general \(s^\prime_i \neq s_i\) and \(s^\prime_j \neq s_j\).

MetropolisHamiltonian(hilbert, hamiltonian, ...)

Sampling based on the off-diagonal elements of a Hamiltonian (or a generic Operator).

experimental.sampler.MetropolisLocalPt

Sampler acting on one local degree of freedom.

experimental.sampler.MetropolisExchangePt

This sampler acts locally only on two local degree of freedom \(s_i\) and \(s_j\), and proposes a new state: \(s_1 \dots s^\prime_i \dots s^\prime_j \dots s_N\), where in general \(s^\prime_i \neq s_i\) and \(s^\prime_j \neq s_j\).

Transition Rules#

Those are the transition rules that can be used with the Metropolis Sampler. Rules with Numpy in their name can only be used with netket.sampler.MetropolisSamplerNumpy.

rules.MetropolisRule

Base class for transition rules of Metropolis, such as Local, Exchange, Hamiltonian and several others.

rules.LocalRule

A transition rule acting on the local degree of freedom.

rules.ExchangeRule(*[, clusters, graph, d_max])

A Rule exchanging the state on a random couple of sites, chosen from a list of possible couples (clusters).

rules.HamiltonianRule

Rule proposing moves according to the terms in an operator.

rules.GaussianRule

A transition rule acting on all particle positions at once.

rules.HamiltonianRuleNumpy

Rule for Numpy sampler backend proposing moves according to the terms in an operator.

rules.CustomRuleNumpy

CustomRuleNumpy(operator: Any, weight_list: Any = None)

Internal State#

Those structure hold the state of the sampler.

SamplerState

Base class holding the state of a sampler.

MetropolisSamplerState

State for a Metropolis sampler.