1 function err=prol_rest_err(hzc,icl3,X,params)
2 % err=prol_rest_err(hzc,icl3,X,params)
3 % test prolongation and restriction
6 [icl1,icl2]=hzc2icl(hzc,n);
7 nc = [length(icl1),length(icl2),length(icl3)];
8 P =coarsening_P(hzc,icl3,X,params);
10 u0 = reshape(P*uc(:),n);
11 u1 = prolongation(uc,hzc,icl3,X,params);
13 tol = eps(single(1))*15*big(u0);
16 warning('prol_restr_err: prolongation error vs. matrix P too large')
18 if exist('fortran/prolongation_test.exe') && isfield(params,'test_fortran') && params.test_fortran
19 disp('testing if prolongation same result in fortran')
20 u2 = prolongation_fortran(uc,hzc,icl3,X,params);
24 warning('prol_restr_err: prolongation error fortran too large')
31 uc0 = reshape(P'*u(:),nc);
32 uc1 = restriction(u,hzc,icl3,X,params);
36 warning('prol_restr_err: restriction error vs. matrix P too large')
38 if exist('fortran/restriction_test.exe') && isfield(params,'test_fortran') && params.test_fortran
39 disp('testing if restriction same result in fortran')
40 uc2 = restriction_fortran(u,hzc,icl3,X,params);
44 warning('prol_restr_err: prolongation error fortran too large')
49 err=max([err1,err2,errc,errc2]);
51 error('prol_rest_err: error too large')
53 fprintf('prol_rest_err %g OK\n',err)