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 at or below rtol (floored at the machine epsilon of the matrix dtype) times the largest are truncated, and negative ones always are: the fallback only runs when Cholesky failed, i.e. when roundoff made the shifted matrix indefinite.

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

  • x0 – unused