comparison libcruft/lapack/sgeqr2.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 SUBROUTINE SGEQR2( M, N, A, LDA, TAU, WORK, INFO )
2 *
3 * -- LAPACK routine (version 3.1) --
4 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
5 * November 2006
6 *
7 * .. Scalar Arguments ..
8 INTEGER INFO, LDA, M, N
9 * ..
10 * .. Array Arguments ..
11 REAL A( LDA, * ), TAU( * ), WORK( * )
12 * ..
13 *
14 * Purpose
15 * =======
16 *
17 * SGEQR2 computes a QR factorization of a real m by n matrix A:
18 * A = Q * R.
19 *
20 * Arguments
21 * =========
22 *
23 * M (input) INTEGER
24 * The number of rows of the matrix A. M >= 0.
25 *
26 * N (input) INTEGER
27 * The number of columns of the matrix A. N >= 0.
28 *
29 * A (input/output) REAL array, dimension (LDA,N)
30 * On entry, the m by n matrix A.
31 * On exit, the elements on and above the diagonal of the array
32 * contain the min(m,n) by n upper trapezoidal matrix R (R is
33 * upper triangular if m >= n); the elements below the diagonal,
34 * with the array TAU, represent the orthogonal matrix Q as a
35 * product of elementary reflectors (see Further Details).
36 *
37 * LDA (input) INTEGER
38 * The leading dimension of the array A. LDA >= max(1,M).
39 *
40 * TAU (output) REAL array, dimension (min(M,N))
41 * The scalar factors of the elementary reflectors (see Further
42 * Details).
43 *
44 * WORK (workspace) REAL array, dimension (N)
45 *
46 * INFO (output) INTEGER
47 * = 0: successful exit
48 * < 0: if INFO = -i, the i-th argument had an illegal value
49 *
50 * Further Details
51 * ===============
52 *
53 * The matrix Q is represented as a product of elementary reflectors
54 *
55 * Q = H(1) H(2) . . . H(k), where k = min(m,n).
56 *
57 * Each H(i) has the form
58 *
59 * H(i) = I - tau * v * v'
60 *
61 * where tau is a real scalar, and v is a real vector with
62 * v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i),
63 * and tau in TAU(i).
64 *
65 * =====================================================================
66 *
67 * .. Parameters ..
68 REAL ONE
69 PARAMETER ( ONE = 1.0E+0 )
70 * ..
71 * .. Local Scalars ..
72 INTEGER I, K
73 REAL AII
74 * ..
75 * .. External Subroutines ..
76 EXTERNAL SLARF, SLARFG, XERBLA
77 * ..
78 * .. Intrinsic Functions ..
79 INTRINSIC MAX, MIN
80 * ..
81 * .. Executable Statements ..
82 *
83 * Test the input arguments
84 *
85 INFO = 0
86 IF( M.LT.0 ) THEN
87 INFO = -1
88 ELSE IF( N.LT.0 ) THEN
89 INFO = -2
90 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
91 INFO = -4
92 END IF
93 IF( INFO.NE.0 ) THEN
94 CALL XERBLA( 'SGEQR2', -INFO )
95 RETURN
96 END IF
97 *
98 K = MIN( M, N )
99 *
100 DO 10 I = 1, K
101 *
102 * Generate elementary reflector H(i) to annihilate A(i+1:m,i)
103 *
104 CALL SLARFG( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1,
105 $ TAU( I ) )
106 IF( I.LT.N ) THEN
107 *
108 * Apply H(i) to A(i:m,i+1:n) from the left
109 *
110 AII = A( I, I )
111 A( I, I ) = ONE
112 CALL SLARF( 'Left', M-I+1, N-I, A( I, I ), 1, TAU( I ),
113 $ A( I, I+1 ), LDA, WORK )
114 A( I, I ) = AII
115 END IF
116 10 CONTINUE
117 RETURN
118 *
119 * End of SGEQR2
120 *
121 END