| x=lurank2(L,U,u1,v1,u2,v2,b) |
function x=lurank2(L,U,u1,v1,u2,v2,b)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% lurank2.m
%
% Solve the system Ax=b, where A is given in terms of its L and U factors
% plus a rank-2 update.
%
% A=LU+u1*v1'+u2*v2'
%
% A, L, and U must all be nonsingular. Solves the linear system in O(n^2)
% operations.
%
% Written by: Greg von Winckel - 08/10/05
% Contact: gregvw(at)chtm(dot)unm(dot)edu
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c=[U\(L\[u1,u2,b])];
v=[v1,v2]'; y=c(:,3);
vc=v*c; r1=vc(1,3); r2=vc(2,3);
vc=vc(1:2,1:2);
k=1/(1+trace(vc)+det(vc));
C1=(-(1+vc(2,2))*r1+vc(1,2)*r2)*c(:,1);
C2=(vc(2,1)*r1-(1+vc(1,1))*r2)*c(:,2);
x=y+k*(C1+C2);
|
|