healpix_resample.psf.least_squares_cg#
- healpix_resample.psf.least_squares_cg(M, MT, y, x_ref, x0, max_iter=200, tol=1e-06, damp=0.0, verbose=True, weight=None)[source]#
Solve for delta in a damped least-squares problem without forming dense matrices.
MandMTare not Euclidean transposes of one another (each is normalized against a different axis of the raw weight matrix), butMTis exactly the adjoint ofMwith respect to a pair of weighted inner products:<.,.>_Dyon the sample space (weight = per-sample row-sum used to normalizeMT) and<.,.>_Dxon the HEALPix-cell space (weight = per-cell column-sum used to normalizeM, passed here asweight). ConcretelyMT = Dx @ M.T @ Dy^-1(in this module’s row-vector convention). This solves the stationarity condition of the weighted least-squares problemdelta_hat = argmin_delta || delta @ MT - r_ref ||^2_Dy + damp * || delta ||^2_Dx
where
r_ref = y - x_ref @ MTis the sample-space residual, which is exactly:(MT-then-M + damp*I) delta = (y - x_ref @ MT) @ M
i.e. the same linear system as a naive (unweighted) Tikhonov normal equation, but its correct interpretation – and the correct inner product for the Conjugate Gradient solver below – uses
Dx = weight(seeconjugate_gradient()).- Shapes:
M : (N, K) sparse CSR MT : (K, N) sparse CSR y : (B, N) x_ref : (B, K) delta : (B, K) weight : (K,) or None – Dx, the per-cell weight columns of M were normalized by; None falls back to the (formally unjustified) Euclidean inner product.