quantax.optimizer.minnorm_cg#
- quantax.optimizer.minnorm_cg(rshift: float = 0.0001, ashift: float = 0.0, rtol: float = 0.01, atol: float = 0.0, maxiter: int = 500, dtype: str | type[Any] | dtype | SupportsDType | None = None) Callable[[...], Array]#
Obtain the minimum-norm solver for the linear equation \(Ax=b\) using diagonal shift, corresponding to MinSR. The solution \(x = A^†(A A^†+ \epsilon I)^{-1} b\) is obtained by solving the auxiliary system \((A A^†+ \epsilon I) y = b\) with the conjugate gradient method jax.scipy.sparse.linalg.cg matrix-free, without forming \(A A^†\), followed by \(x = A^†y\). This is suitable for underdetermined problems where the number of parameters exceeds the number of samples.
The shift is necessary for the rank-deficient \(A A^†\) of a VMC Jacobian: without it, the iteration amplifies the small, noise-dominated eigen-directions from the first steps, and the residual tolerance is never reached.
- Parameters:
rshift – The relative diagonal shift, entering the shift as \(\epsilon = \mathrm{Tr}(A A^†) \times \mathrm{rshift} / \sqrt{d} + \mathrm{ashift}\), with \(d\) the smaller one of the numbers of rows and columns of \(A\), i.e. the number of samples for an underdetermined problem, or twice that for non-holomorphic states. Default to 1e-4.
ashift – The absolute diagonal shift, default to 0.
rtol – The relative tolerance for terminating the CG iteration.
atol – The absolute tolerance for terminating the CG iteration.
maxiter – The maximum number of CG iterations.
dtype – The precision used internally in the CG iteration. By default (
None) the dtype of the inputs is kept. Complex inputs use the complex counterpart, e.g. complex64 for float32. Running CG on the normal-equation operator \(A A^†\) squares the condition number, so passdtype=jnp.float64if the single-precision iteration loses conjugacy and diverges for an ill-conditioned \(A A^†\).
- Returns:
A solver function with two arguments A and b and one output x as the solution of \(A x = b\).