1
*> \brief \b ZGEQR2 computes the QR factorization of a general rectangular matrix using an unblocked algorithm.
3
* =========== DOCUMENTATION ===========
5
* Online html documentation available at
6
* http://www.netlib.org/lapack/explore-html/
9
*> Download ZGEQR2 + dependencies
10
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgeqr2.f">
12
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgeqr2.f">
14
*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgeqr2.f">
21
* SUBROUTINE ZGEQR2( M, N, A, LDA, TAU, WORK, INFO )
23
* .. Scalar Arguments ..
24
* INTEGER INFO, LDA, M, N
26
* .. Array Arguments ..
27
* COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
36
*> ZGEQR2 computes a QR factorization of a complex m by n matrix A:
46
*> The number of rows of the matrix A. M >= 0.
52
*> The number of columns of the matrix A. N >= 0.
57
*> A is COMPLEX*16 array, dimension (LDA,N)
58
*> On entry, the m by n matrix A.
59
*> On exit, the elements on and above the diagonal of the array
60
*> contain the min(m,n) by n upper trapezoidal matrix R (R is
61
*> upper triangular if m >= n); the elements below the diagonal,
62
*> with the array TAU, represent the unitary matrix Q as a
63
*> product of elementary reflectors (see Further Details).
69
*> The leading dimension of the array A. LDA >= max(1,M).
74
*> TAU is COMPLEX*16 array, dimension (min(M,N))
75
*> The scalar factors of the elementary reflectors (see Further
81
*> WORK is COMPLEX*16 array, dimension (N)
87
*> = 0: successful exit
88
*> < 0: if INFO = -i, the i-th argument had an illegal value
94
*> \author Univ. of Tennessee
95
*> \author Univ. of California Berkeley
96
*> \author Univ. of Colorado Denver
99
*> \date September 2012
101
*> \ingroup complex16GEcomputational
103
*> \par Further Details:
104
* =====================
108
*> The matrix Q is represented as a product of elementary reflectors
110
*> Q = H(1) H(2) . . . H(k), where k = min(m,n).
112
*> Each H(i) has the form
114
*> H(i) = I - tau * v * v**H
116
*> where tau is a complex scalar, and v is a complex vector with
117
*> v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i),
118
*> and tau in TAU(i).
121
* =====================================================================
122
SUBROUTINE ZGEQR2( M, N, A, LDA, TAU, WORK, INFO )
124
* -- LAPACK computational routine (version 3.4.2) --
125
* -- LAPACK is a software package provided by Univ. of Tennessee, --
126
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
129
* .. Scalar Arguments ..
130
INTEGER INFO, LDA, M, N
132
* .. Array Arguments ..
133
COMPLEX*16 A( LDA, * ), TAU( * ), WORK( * )
136
* =====================================================================
140
PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )
142
* .. Local Scalars ..
146
* .. External Subroutines ..
147
EXTERNAL XERBLA, ZLARF, ZLARFG
149
* .. Intrinsic Functions ..
150
INTRINSIC DCONJG, MAX, MIN
152
* .. Executable Statements ..
154
* Test the input arguments
159
ELSE IF( N.LT.0 ) THEN
161
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
165
CALL XERBLA( 'ZGEQR2', -INFO )
173
* Generate elementary reflector H(i) to annihilate A(i+1:m,i)
175
CALL ZLARFG( M-I+1, A( I, I ), A( MIN( I+1, M ), I ), 1,
179
* Apply H(i)**H to A(i:m,i+1:n) from the left
183
CALL ZLARF( 'Left', M-I+1, N-I, A( I, I ), 1,
184
$ DCONJG( TAU( I ) ), A( I, I+1 ), LDA, WORK )