quantax.optimizer.minnorm_shift_cg#
- quantax.optimizer.minnorm_shift_cg(ashift: float = 0.0001, 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.
- Parameters:
ashift – The absolute diagonal shift \(\epsilon\).
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 dtype used internally in the CG iteration. By default (
None) the iteration is carried out in double precision (float64 for real inputs, complex128 for complex inputs), regardless of the dtype ofA. Running CG on the normal-equation operator \(A A^†\) squares the condition number, so in single precision the iteration easily loses conjugacy and diverges to NaN whenever \(A A^†\) is ill-conditioned. Passdtype=jnp.float32to keep single precision for large-scale problems where the memory footprint matters and the operator is well conditioned.
- Returns:
A solver function with two arguments A and b and one output x as the solution of \(A x = b\).