Port StochasticReconfiguration to Python
Created by: gcarleo
Porting SR solver to pure python.
It is accessible using the usual APIs:
sr = nk.optimizer.SR(diag_shift=0.1)
The full solver is implemented through scipy's lstsq solver. Performance is the same as the C++ solver for QR-based solvers. The SVD solvers of scipy are significantly faster than the internal Eigen one (at least on conda...). [Using a conda installation one gets MKL automatically, thus also addressing the long-standing issues with Lapack #295]. The sparse solvers are implemented through scipy's minres (gmres) and conjugate gradient. They are typically faster than the C++ counterparts.
(Minor) change in the interface:
- The
LLT
solver is not supported. Maybe we can still implement it using some other scipy method, but for the moment the default solution is a QR solver based ongelsy
's LAPACK, which seems at least as fast as LLT. -
store_rank_enabled
,store_covariance_matrix_enabled
etc are removed. When accessing the corresponding elements, None is returned if the rank (for example) is not being stored. -
scale_invariant_regularization_enabled
becomes a propertyscale_invariant_regularization
that can be set True or False - added a is_holomorphic method to SR, that can (must!) be set by the drivers, otherwise in the previous interface we were relying on the user to pick the correct version of SR, leading to possible issues
This will also later allow to remove the dependency on MPI in C++ code already as v2.1 (see #324 (closed)).