1 *> \brief \b CUNG2L generates all or part of the unitary matrix Q from a QL factorization determined by cgeqlf (unblocked algorithm).
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CUNG2L + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cung2l.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cung2l.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cung2l.f">
21 * SUBROUTINE CUNG2L( M, N, K, A, LDA, TAU, WORK, INFO )
23 * .. Scalar Arguments ..
24 * INTEGER INFO, K, LDA, M, N
26 * .. Array Arguments ..
27 * COMPLEX A( LDA, * ), TAU( * ), WORK( * )
36 *> CUNG2L generates an m by n complex matrix Q with orthonormal columns,
37 *> which is defined as the last n columns of a product of k elementary
38 *> reflectors of order m
40 *> Q = H(k) . . . H(2) H(1)
42 *> as returned by CGEQLF.
51 *> The number of rows of the matrix Q. M >= 0.
57 *> The number of columns of the matrix Q. M >= N >= 0.
63 *> The number of elementary reflectors whose product defines the
64 *> matrix Q. N >= K >= 0.
69 *> A is COMPLEX array, dimension (LDA,N)
70 *> On entry, the (n-k+i)-th column must contain the vector which
71 *> defines the elementary reflector H(i), for i = 1,2,...,k, as
72 *> returned by CGEQLF in the last k columns of its array
74 *> On exit, the m-by-n matrix Q.
80 *> The first dimension of the array A. LDA >= max(1,M).
85 *> TAU is COMPLEX array, dimension (K)
86 *> TAU(i) must contain the scalar factor of the elementary
87 *> reflector H(i), as returned by CGEQLF.
92 *> WORK is COMPLEX array, dimension (N)
98 *> = 0: successful exit
99 *> < 0: if INFO = -i, the i-th argument has an illegal value
105 *> \author Univ. of Tennessee
106 *> \author Univ. of California Berkeley
107 *> \author Univ. of Colorado Denver
110 *> \date September 2012
112 *> \ingroup complexOTHERcomputational
114 * =====================================================================
115 SUBROUTINE CUNG2L( M, N, K, A, LDA, TAU, WORK, INFO )
117 * -- LAPACK computational routine (version 3.4.2) --
118 * -- LAPACK is a software package provided by Univ. of Tennessee, --
119 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
122 * .. Scalar Arguments ..
123 INTEGER INFO, K, LDA, M, N
125 * .. Array Arguments ..
126 COMPLEX A( LDA, * ), TAU( * ), WORK( * )
129 * =====================================================================
133 PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ),
134 $ ZERO = ( 0.0E+0, 0.0E+0 ) )
136 * .. Local Scalars ..
139 * .. External Subroutines ..
140 EXTERNAL CLARF, CSCAL, XERBLA
142 * .. Intrinsic Functions ..
145 * .. Executable Statements ..
147 * Test the input arguments
152 ELSE IF( N.LT.0 .OR. N.GT.M ) THEN
154 ELSE IF( K.LT.0 .OR. K.GT.N ) THEN
156 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
160 CALL XERBLA( 'CUNG2L', -INFO )
164 * Quick return if possible
169 * Initialise columns 1:n-k to columns of the unit matrix
181 * Apply H(i) to A(1:m-k+i,1:n-k+i) from the left
183 A( M-N+II, II ) = ONE
184 CALL CLARF( 'Left', M-N+II, II-1, A( 1, II ), 1, TAU( I ), A,
186 CALL CSCAL( M-N+II-1, -TAU( I ), A( 1, II ), 1 )
187 A( M-N+II, II ) = ONE - TAU( I )
189 * Set A(m-k+i+1:m,n-k+i) to zero
191 DO 30 L = M - N + II + 1, M