LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
cgelq2.f
Go to the documentation of this file.
1*> \brief \b CGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CGELQ2 + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgelq2.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgelq2.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgelq2.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CGELQ2( M, N, A, LDA, TAU, WORK, INFO )
20*
21* .. Scalar Arguments ..
22* INTEGER INFO, LDA, M, N
23* ..
24* .. Array Arguments ..
25* COMPLEX A( LDA, * ), TAU( * ), WORK( * )
26* ..
27*
28*
29*> \par Purpose:
30* =============
31*>
32*> \verbatim
33*>
34*> CGELQ2 computes an LQ factorization of a complex m-by-n matrix A:
35*>
36*> A = ( L 0 ) * Q
37*>
38*> where:
39*>
40*> Q is a n-by-n orthogonal matrix;
41*> L is a lower-triangular m-by-m matrix;
42*> 0 is a m-by-(n-m) zero matrix, if m < n.
43*>
44*> \endverbatim
45*
46* Arguments:
47* ==========
48*
49*> \param[in] M
50*> \verbatim
51*> M is INTEGER
52*> The number of rows of the matrix A. M >= 0.
53*> \endverbatim
54*>
55*> \param[in] N
56*> \verbatim
57*> N is INTEGER
58*> The number of columns of the matrix A. N >= 0.
59*> \endverbatim
60*>
61*> \param[in,out] A
62*> \verbatim
63*> A is COMPLEX array, dimension (LDA,N)
64*> On entry, the m by n matrix A.
65*> On exit, the elements on and below the diagonal of the array
66*> contain the m by min(m,n) lower trapezoidal matrix L (L is
67*> lower triangular if m <= n); the elements above the diagonal,
68*> with the array TAU, represent the unitary matrix Q as a
69*> product of elementary reflectors (see Further Details).
70*> \endverbatim
71*>
72*> \param[in] LDA
73*> \verbatim
74*> LDA is INTEGER
75*> The leading dimension of the array A. LDA >= max(1,M).
76*> \endverbatim
77*>
78*> \param[out] TAU
79*> \verbatim
80*> TAU is COMPLEX array, dimension (min(M,N))
81*> The scalar factors of the elementary reflectors (see Further
82*> Details).
83*> \endverbatim
84*>
85*> \param[out] WORK
86*> \verbatim
87*> WORK is COMPLEX array, dimension (M)
88*> \endverbatim
89*>
90*> \param[out] INFO
91*> \verbatim
92*> INFO is INTEGER
93*> = 0: successful exit
94*> < 0: if INFO = -i, the i-th argument had an illegal value
95*> \endverbatim
96*
97* Authors:
98* ========
99*
100*> \author Univ. of Tennessee
101*> \author Univ. of California Berkeley
102*> \author Univ. of Colorado Denver
103*> \author NAG Ltd.
104*
105*> \ingroup gelq2
106*
107*> \par Further Details:
108* =====================
109*>
110*> \verbatim
111*>
112*> The matrix Q is represented as a product of elementary reflectors
113*>
114*> Q = H(k)**H . . . H(2)**H H(1)**H, where k = min(m,n).
115*>
116*> Each H(i) has the form
117*>
118*> H(i) = I - tau * v * v**H
119*>
120*> where tau is a complex scalar, and v is a complex vector with
121*> v(1:i-1) = 0 and v(i) = 1; conjg(v(i+1:n)) is stored on exit in
122*> A(i,i+1:n), and tau in TAU(i).
123*> \endverbatim
124*>
125* =====================================================================
126 SUBROUTINE cgelq2( M, N, A, LDA, TAU, WORK, INFO )
127*
128* -- LAPACK computational routine --
129* -- LAPACK is a software package provided by Univ. of Tennessee, --
130* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
131*
132* .. Scalar Arguments ..
133 INTEGER INFO, LDA, M, N
134* ..
135* .. Array Arguments ..
136 COMPLEX A( LDA, * ), TAU( * ), WORK( * )
137* ..
138*
139* =====================================================================
140*
141* .. Local Scalars ..
142 INTEGER I, K
143* ..
144* .. External Subroutines ..
145 EXTERNAL clacgv, clarf1f, clarfg, xerbla
146* ..
147* .. Intrinsic Functions ..
148 INTRINSIC max, min
149* ..
150* .. Executable Statements ..
151*
152* Test the input arguments
153*
154 info = 0
155 IF( m.LT.0 ) THEN
156 info = -1
157 ELSE IF( n.LT.0 ) THEN
158 info = -2
159 ELSE IF( lda.LT.max( 1, m ) ) THEN
160 info = -4
161 END IF
162 IF( info.NE.0 ) THEN
163 CALL xerbla( 'CGELQ2', -info )
164 RETURN
165 END IF
166*
167 k = min( m, n )
168*
169 DO 10 i = 1, k
170*
171* Generate elementary reflector H(i) to annihilate A(i,i+1:n)
172*
173 CALL clacgv( n-i+1, a( i, i ), lda )
174 CALL clarfg( n-i+1, a( i, i ), a( i, min( i+1, n ) ), lda,
175 $ tau( i ) )
176 IF( i.LT.m ) THEN
177*
178* Apply H(i) to A(i+1:m,i:n) from the right
179*
180 CALL clarf1f( 'Right', m-i, n-i+1, a( i, i ), lda,
181 $ tau( i ), a( i+1, i ), lda, work )
182 END IF
183 CALL clacgv( n-i+1, a( i, i ), lda )
184 10 CONTINUE
185 RETURN
186*
187* End of CGELQ2
188*
189 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine clarf1f(side, m, n, v, incv, tau, c, ldc, work)
CLARF1F applies an elementary reflector to a general rectangular
Definition clarf1f.f:126
subroutine cgelq2(m, n, a, lda, tau, work, info)
CGELQ2 computes the LQ factorization of a general rectangular matrix using an unblocked algorithm.
Definition cgelq2.f:127
subroutine clacgv(n, x, incx)
CLACGV conjugates a complex vector.
Definition clacgv.f:72
subroutine clarfg(n, alpha, x, incx, tau)
CLARFG generates an elementary reflector (Householder matrix).
Definition clarfg.f:104