Implement an ExactState doing Exact stuff with a NQS
Created by: PhilipVinc
Draft PR implementing an ExactState behaving like an MCState but without the monte-carlo stuff. I'd love for somebody else to finish this implementation.
FYI @nikita-astronaut maybe?
It works for expectation values. You'd have to code it for getting the gradient, but it should not be hard. If you implement it then you can do SGD on it.
it uses a memoization trick to speed it up, by caching the sparse representation of operators.
You can use it like
>>> import netket as nk
>>>
>>> L = 6
>>> g = nk.graph.Hypercube(length=L, n_dim=1, pbc=True)
>>> hi = nk.hilbert.Spin(s=1 / 2, N=g.n_nodes)
>>> ha = nk.operator.Ising(hilbert=hi, graph=g, h=1.0)
>>> ma = nk.models.RBM(alpha=1, dtype=float)
>>> vs = nk.vqs.ExactState(hi, ma)
>>> vs.expect(ha)
-6.001e+00 ± 0.000e+00 [σ²=5.994e+00]