Home > p2plib > jaccheck.m

jaccheck

PURPOSE ^

compare numerical and assembled Jacobian; useful to check coding, timing,

SYNOPSIS ^

function [Gua,Gun]=jaccheck(p)

DESCRIPTION ^

 compare numerical and assembled Jacobian; useful to check coding, timing,
 and mesh quality

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Gua,Gun]=jaccheck(p)
0002 % compare numerical and assembled Jacobian; useful to check coding, timing,
0003 % and mesh quality
0004 jsws=p.jsw; r=resi(p,p.u,p.lam); 
0005 p.jsw=3;tic;Gun=getGu(p,p.u,p.lam,r); t1=toc; 
0006 figure(6); spy(Gun); title('numerical G_{u,n}'); 
0007 p.jsw=0;tic;Gua=getGu(p,p.u,p.lam,r); t2=toc; 
0008 figure(4); spy(Gua); title('assembled G_{u,a}'); 
0009 fprintf('time for numjac=%g, time for assembling=%g\n',t1,t2);
0010 m1=full(max(max(abs(Gun)))); m2=full(max(max(abs(Gun-Gua)))); 
0011 m3=full(max(sum(abs(Gun))));m4=full(max(sum(abs(Gun-Gua))));
0012 fprintf('max(Gun)=%g, max(Gun-Gua)=%g, infinity-norm(Gun)=%g, relerr=%g\n',...
0013     m1,m2,m3,m4/m3);

Generated on Wed 15-Aug-2012 10:09:15 by m2html © 2005