Abstract python sampler
Created by: gcarleo
This is PR defines an abstract python class (interface) for samplers (see discussion here #306 (closed) ).
The abstract class is relatively simple and is found in netket/sampler/abstract_sampler.py . Basically it is implemented as a generator, as also suggested by @noamwies .
There is also a pure-python implementation of samplers provided with this PR. Most notably, all MetropolisHastings sampler (non Parallel Tempering) and exact samplers have pure python versions. The backend for the sampler is chosen automatically, depending on the type of the machine to be sampled from. This is similar to the mechanism implemented by @femtobit for optimizers, but it's hidden in the class implementations.
A good side effect of this is that now one can use an arbitrary (pure python) MetropolisHastings sampler in case when the machine is not a C++ machine. The speed of the pure python MetropolisHastings is typically comparable to the pure C++ implementation, for machines that are not "too easy" (say, a RBM with at least alpha=4 for L>20 sites), otherwise it's a bit slower.