Home > demos > acgc > gclss.m

gclss

PURPOSE ^

customized LinearSystemSolver for acgc.

SYNOPSIS ^

function x=gclss(A,b,p,lam)

DESCRIPTION ^

 customized LinearSystemSolver for acgc. 
 To solve: Ax-lam<x>=b 
 With <x>=[triangle area]*C*x write (A-lam*nu eta)x=b 
 and solve by Sherman-Morrison

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function x=gclss(A,b,p,lam) 
0002 % customized LinearSystemSolver for acgc.
0003 % To solve: Ax-lam<x>=b
0004 % With <x>=[triangle area]*C*x write (A-lam*nu eta)x=b
0005 % and solve by Sherman-Morrison
0006 global eta nu; y=A\b; z=A\nu; al0=lam*eta*z; al=lam*eta*y/(1-al0);
0007 x=y+al*z; return % comment out to check Sherman-Morrison formula
0008 c1=(A-lam*p.nu*p.eta)*x; c2=(A-lam*p.nu*p.eta)*y; 
0009 err1=norm(c1-b); err2=norm(c2-b); 
0010 fprintf('lss: |b|=%g, |x|=%g, |y|=%g, SM-err=%g, noSM-err=%g\n',...
0011     norm(b),norm(x),norm(y),err1,err2); %pause

Generated on Wed 15-Aug-2012 12:53:02 by m2html © 2005