netket.optimizer.solver.pinv_smooth#
- netket.optimizer.solver.pinv_smooth(A, b, rcond=1e-14, rcond_smooth=1e-14, x0=None)[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
.- Parameters:
A – LinearOperator (matrix)
b – vector or Pytree
rcond – Cut-off ratio for small singular values of
A
. For the purposes of rank determination, singular values are treated as zero if they are smaller than rcond times the largest singular value ofA
.rcond_smooth – regularization parameter used with a similar effect to rcond but with a softer curve. See \(\epsilon\) in the formula above.