comparison libcruft/qrupdate/dqr1up.f @ 7553:56be6f31dd4e

implementation of QR factorization updating
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 04 Mar 2008 21:47:11 -0500
parents
children
comparison
equal deleted inserted replaced
7552:6070c3bd69c4 7553:56be6f31dd4e
1 c Copyright (C) 2008 VZLU Prague, a.s., Czech Republic
2 c
3 c Author: Jaroslav Hajek <highegg@gmail.com>
4 c
5 c This source is free software; you can redistribute it and/or modify
6 c it under the terms of the GNU General Public License as published by
7 c the Free Software Foundation; either version 2 of the License, or
8 c (at your option) any later version.
9 c
10 c This program is distributed in the hope that it will be useful,
11 c but WITHOUT ANY WARRANTY; without even the implied warranty of
12 c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 c GNU General Public License for more details.
14 c
15 c You should have received a copy of the GNU General Public License
16 c along with this software; see the file COPYING. If not, see
17 c <http://www.gnu.org/licenses/>.
18 c
19 subroutine dqr1up(m,n,k,Q,R,u,v)
20 c purpose: updates a QR factorization after rank-1 modification
21 c i.e., given a m-by-k orthogonal Q and m-by-n upper
22 c trapezoidal R, an m-vector u and n-vector v,
23 c this subroutine updates Q -> Q1 and R -> R1 so that
24 c Q1*R1 = Q*R + Q*Q'u*v', and Q1 is again orthonormal
25 c and R1 upper trapezoidal.
26 c (real version)
27 c arguments:
28 c m (in) number of rows of the matrix Q.
29 c n (in) number of columns of the matrix R.
30 c k (in) number of columns of Q, and rows of R. k <= m.
31 c Q (io) on entry, the orthogonal m-by-k matrix Q.
32 c on exit, the updated matrix Q1.
33 c R (io) on entry, the upper trapezoidal m-by-n matrix R..
34 c on exit, the updated matrix R1.
35 c u (in) the left m-vector.
36 c v (in) the right n-vector.
37 c
38 integer m,n,k
39 double precision Q(m,k),R(k,n),u(m),v(n)
40 double precision w
41 external dqrqhv,dqhqr,daxpy
42 c quick return if possible
43 if (m <= 0 .or. n <= 0) return
44 c eliminate tail of Q'*u
45 call dqrqhv(m,n,k,Q,m,R,m,u,w)
46 c update R
47
48 call daxpy(n,w,v,1,R(1,1),m)
49
50 c retriangularize R
51 call dqhqr(m,n,k,Q,m,R,k)
52 end