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)[source]#

Solve A x = b with Conjugate Gradient, using only matvec A_mv(v). No autograd (uses torch.no_grad).

A_mv (as built by least_squares_cg() for PSFResampler) 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-weight Dx used to normalize M), not with respect to the plain Euclidean inner product. Pass weight so CG’s own dot products use the inner product the operator is actually SPD in — with weight=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