Skip to content

Add MCState.local_estimators

Vicentini Filippo requested to merge local_estimators into master

Created by: femtobit

This PR adds an MCState.local_estimators method, addressing point 2 of #1178 (and superseding the previous PR #1154).

O_loc = vstate.local_estimators(operator)
print(O_loc.shape) # -> (n_chains, n_samples)

It only supports computing the estimate for the current vstate.samples. That is a restriction because of the way the interface described in https://netket.readthedocs.io/en/latest/advanced/custom_operators.html allows extending operators in a way that depends on the VariationalState, making it non-trivial to decouple that logic. Doing it this way should ensure that the same code path is used to compute the local estimators that is also used for expect.

Merge request reports