function sol=fmg2(f,nu0,nu1,nu2) % % recursive fmg as on page 49, but still using the simple data structure % This differs from fmg1 because vcycle2 does nu2 damped Jacobi iterations % at the coarsest level, whereas vcycle1 does a direct solve. % lmin=3; nt=length(f); l=log2(nt-1); if l==lmin v=zeros(nt,1); else fc=ftoc(f); vc=fmg2(fc,nu0,nu1,nu2); v=ctof(vc); end for i=1:nu0 v=vcycle2(v,f,nu1,nu2); end sol=v;