Mercurial > octave-nkf
comparison libcruft/qrupdate/cqrinr.f @ 7789:82be108cc558
First attempt at single precision tyeps
* * *
corrections to qrupdate single precision routines
* * *
prefer demotion to single over promotion to double
* * *
Add single precision support to log2 function
* * *
Trivial PROJECT file update
* * *
Cache optimized hermitian/transpose methods
* * *
Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 27 Apr 2008 22:34:17 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
7788:45f5faba05a2 | 7789:82be108cc558 |
---|---|
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 cqrinr(m,n,Q,Q1,R,R1,j,x) | |
20 c purpose: updates a QR factorization after inserting a new | |
21 c row. | |
22 c i.e., given an m-by-m unitary matrix Q, an m-by-n | |
23 c upper trapezoidal matrix R and index j in the range | |
24 c 1:m+1, this subroutine forms the (m+1)-by-(m+1) matrix | |
25 c Q1 and an (m+1)-by-n matrix R1 so that Q1 is again | |
26 c unitary, R1 upper trapezoidal, and | |
27 c Q1*R1 = [A(1:j-1,:); x; A(j:m,:)], where A = Q*R. | |
28 c (complex version) | |
29 c arguments: | |
30 c m (in) number of rows of the matrix R. | |
31 c n (in) number of columns of the matrix R | |
32 c Q (in) the orthogonal matrix Q | |
33 c Q1 (out) the updated matrix Q1 | |
34 c R (in) the upper trapezoidal matrix R | |
35 c R1 (out) the updated matrix R1 | |
36 c j (in) the position of the new row in R1 | |
37 c x (in) the row being added | |
38 c | |
39 integer m,n,j | |
40 complex Q(m,m),Q1(m+1,m+1),R(m,n),R1(m+1,n),x(n) | |
41 external xerbla,clacpy,ccopy,cqhqr | |
42 integer i | |
43 c check arguments | |
44 info = 0 | |
45 if (n < 0) then | |
46 info = 2 | |
47 else if (j < 1 .or. j > m+1) then | |
48 info = 7 | |
49 end if | |
50 if (info /= 0) then | |
51 call xerbla('CQRINR',info) | |
52 end if | |
53 c setup the new matrix Q1 | |
54 c permute the columns of Q1 and rows of R1 so that c the new row ends | |
55 c up being the topmost row. | |
56 if (j > 1) then | |
57 call clacpy('0',j-1,m,Q(1,1),m,Q1(1,2),m+1) | |
58 end if | |
59 if (j <= m) then | |
60 call clacpy('0',m-j+1,m,Q(j,1),m,Q1(j+1,2),m+1) | |
61 end if | |
62 c zero the rest of Q1 | |
63 do i = 1,m+1 | |
64 Q1(i,1) = 0e0 | |
65 Q1(j,i) = 0e0 | |
66 end do | |
67 Q1(j,1) = 1e0 | |
68 c setup the new matrix R1 | |
69 call ccopy(n,x,1,R1(1,1),m+1) | |
70 call clacpy('0',m,n,R(1,1),m,R1(2,1),m+1) | |
71 c rotate to form proper QR | |
72 call cqhqr(m+1,n,m+1,Q1,m+1,R1,m+1) | |
73 end |