netket.optimizer.solver.pinv_smooth#
- netket.optimizer.solver.pinv_smooth(A, b, *, rtol=1e-14, rtol_smooth=1e-14, x0=None, rcond=None, rcond_smooth=None, return_eigvals=False)[source]#
Solve the linear system by building a pseudo-inverse from the eigendecomposition obtained from
jax.numpy.linalg.eigh().The eigenvalues \(\lambda_i\) smaller than \(r_\textrm{cond} \lambda_\textrm{max}\) are truncated (where \(\lambda_\textrm{max}\) is the largest eigenvalue).
The eigenvalues are further smoothed with another filter, originally introduced in Medvidovic, Sels arXiv:2212.11289 (2022), given by the following equation
\[\tilde\lambda_i^{-1}=\frac{\lambda_i^{-1}}{1+\big(\epsilon\frac{\lambda_\textrm{max}}{\lambda_i}\big)^6}\]Note
In general, we found that this custom implementation of the pseudo-inverse outperform jax’s
pinv(). This might be becausepinv()internally callssvd, while this solver internally useseigh.For that reason, we suggest you use this solver instead of
pinv.Note
If you pass only keyword arguments, this solver will directly create a partial capturing them.
- Parameters:
A – LinearOperator (matrix)
b – vector or Pytree
rtol (
float) – Relative tolerance for small singular values ofA. For the purposes of rank determination, singular values are treated as zero if they are smaller than rtol times the largest singular value ofA.rtol_smooth (
float) – Regularization parameter used with a similar effect to rtol but with a softer curve. See \(\epsilon\) in the formula above.rcond (
float) – (deprecated) Alias for rtol. Will be removed in a future release.rcond_smooth (
float) – (deprecated) Alias for rtol_smooth. Will be removed in a future release.return_eigvals (
bool) – If True, also return the eigenvalues of A.