netket.optimizer.solver.cholesky_with_fallback

netket.optimizer.solver.cholesky_with_fallback#

netket.optimizer.solver.cholesky_with_fallback(A, b, *, rtol=1e-14, rtol_smooth=1e-14, x0=None)[source]#

Solve the linear system using a Cholesky factorisation, automatically falling back to pinv_smooth() when the result contains NaN or Inf.

This combines the speed of cholesky() with the robustness of pinv_smooth(). Refer to their docstring for complete information.

The returned info dict always contains a "solver_fallback" key indicating whether the fallback was activated.

Note

This is exactly equivalent to using nan_fallback() as nan_fallback(cholesky, pinv_smooth(rtol=rtol, rtol_smooth=rtol_smooth)).

Parameters:
  • A – the matrix A in Ax=b

  • b – the vector or pytree b in Ax=b

  • rtol (float) – Relative tolerance for small eigenvalues of A, passed to pinv_smooth(). Eigenvalues smaller than rtol times the largest are truncated.

  • rtol_smooth (float) – Soft regularisation parameter passed to pinv_smooth(). See pinv_smooth() for details.

  • x0 – unused