Make nk more extensible, pt 1: use dispatch in netket.hilbert.random
Created by: PhilipVinc
This is part 1 in making netket more easy to extend by moving to use dispatch in functions that might be extended and overridden by an user.
This PR does 2 things:
-
Use netket.utils.dispatch
instead offrom plum import dispatch
(even if they are identical) just for the sake that if, at some point, we need to change something in the dispatch, we just need to change it in one place. -
Use dispatch throughout netket.hilbert.random
.
The next step of this PR would be to make DoubledHilbert
and TensorHilbert
parametric classes in order to create special dispatches (for example, if DoubledHilbert[<:HomogeneousHilbert]
, there is no need to split the rows and columns because they all are identical).
But I think this can be done in a second moment.
The next step would be to do the same for MCState.expect
and .expect_and_grad
so an user could use his own, custom operators or anything with those two functions.