healpix_resample.psf.conjugate_gradient#
- healpix_resample.psf.conjugate_gradient(A_mv, b, x0=None, max_iter=200, tol=1e-06, verbose=True, weight=None, preconditioner=None)[source]#
Solve A x = b with Conjugate Gradient, using only matvec A_mv(v).
preconditioner, if given, is the inverse of a positive diagonal (K,) (e.g. ofAitself: Jacobi). A diagonal is self-adjoint in the weighted inner product as well, so the preconditioned iteration keeps the weighted Conjugate Gradient’s guarantees; it stops on the same weighted residualtol * |b|. Without it, the iteration is the plain one, unchanged. No autograd (uses torch.no_grad).A_mv(as built byleast_squares_cg()forPSFResampler) is self-adjoint and positive-definite with respect to the weighted inner product<u, v>_w = sum(u * v * weight)on the HEALPix-cell space (weight = per-cell column-weightDxused to normalizeM), not with respect to the plain Euclidean inner product. Passweightso CG’s own dot products use the inner product the operator is actually SPD in — withweight=None(Euclidean), CG’s classical convergence guarantees do not formally apply to this operator, even though it often still behaves reasonably in practice.- Returns:
x – solution info: dict with residual norms history, iterations