#include "nr.h" void NR::svdfit(Vec_I_DP &x, Vec_I_DP &y, Vec_I_DP &sig, Vec_O_DP &a, Mat_O_DP &u, Mat_O_DP &v, Vec_O_DP &w, DP &chisq, void funcs(const DP, Vec_O_DP &)) { int i,j; const DP TOL=1.0e-13; DP wmax,tmp,thresh,sum; int ndata=x.size(); int ma=a.size(); Vec_DP b(ndata),afunc(ma); for (i=0;i wmax) wmax=w[j]; thresh=TOL*wmax; for (j=0;j