Revision 706, 0.9 kB
(checked in by smidl, 15 years ago)
|
eol-native
|
-
Property svn:eol-style set to
native
|
Line | |
---|
1 | function UD = udupdt(UD, r, w); |
---|
2 | % update U'DU decomposition update |
---|
3 | % U'DU := U'DU+w*r'*r |
---|
4 | % UD = udupdt(UD, r, w) |
---|
5 | % UD = input upper triangular matrix with unit diagonal replaced |
---|
6 | % by D |
---|
7 | % w = weight of the updating dyad |
---|
8 | % r = the modifying data vector |
---|
9 | % |
---|
10 | % Design : L. Tesar Jan 2004 |
---|
11 | % Updated: Jan 2004 |
---|
12 | % Project: ProDaCTool |
---|
13 | % Calls : dydrs |
---|
14 | |
---|
15 | if nargin<2, error('udupdt needs at least two input arguments'); end |
---|
16 | if nargin==2, w=1; end |
---|
17 | if abs(w)<eps, return; end |
---|
18 | |
---|
19 | [m,n] = size(UD); |
---|
20 | if m~=n, error('UD decomposition must be square matrix in udupdt.m'); end |
---|
21 | if m~=length(r), error('incorrect dimension of vector to be reduced in udupdt.m'); end |
---|
22 | |
---|
23 | if size(r,1)>1, r=r'; end; |
---|
24 | |
---|
25 | %Test for upper triangularity: |
---|
26 | %if max(max(abs(triu(UD',1)))); |
---|
27 | % error('must be lower triangular matrix'); |
---|
28 | %end; |
---|
29 | |
---|
30 | for j=1:m; |
---|
31 | if r(j)~=0; |
---|
32 | [r, UD(j,:), w, UDjj] = dydrs(r,UD(j,:),w,UD(j,j),j,j+1,m); |
---|
33 | UD(j,j) = UDjj; |
---|
34 | end; |
---|
35 | end; |
---|