LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zlqt02.f
Go to the documentation of this file.
1*> \brief \b ZLQT02
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8* Definition:
9* ===========
10*
11* SUBROUTINE ZLQT02( M, N, K, A, AF, Q, L, LDA, TAU, WORK, LWORK,
12* RWORK, RESULT )
13*
14* .. Scalar Arguments ..
15* INTEGER K, LDA, LWORK, M, N
16* ..
17* .. Array Arguments ..
18* DOUBLE PRECISION RESULT( * ), RWORK( * )
19* COMPLEX*16 A( LDA, * ), AF( LDA, * ), L( LDA, * ),
20* $ Q( LDA, * ), TAU( * ), WORK( LWORK )
21* ..
22*
23*
24*> \par Purpose:
25* =============
26*>
27*> \verbatim
28*>
29*> ZLQT02 tests ZUNGLQ, which generates an m-by-n matrix Q with
30*> orthonormal rows that is defined as the product of k elementary
31*> reflectors.
32*>
33*> Given the LQ factorization of an m-by-n matrix A, ZLQT02 generates
34*> the orthogonal matrix Q defined by the factorization of the first k
35*> rows of A; it compares L(1:k,1:m) with A(1:k,1:n)*Q(1:m,1:n)', and
36*> checks that the rows of Q are orthonormal.
37*> \endverbatim
38*
39* Arguments:
40* ==========
41*
42*> \param[in] M
43*> \verbatim
44*> M is INTEGER
45*> The number of rows of the matrix Q to be generated. M >= 0.
46*> \endverbatim
47*>
48*> \param[in] N
49*> \verbatim
50*> N is INTEGER
51*> The number of columns of the matrix Q to be generated.
52*> N >= M >= 0.
53*> \endverbatim
54*>
55*> \param[in] K
56*> \verbatim
57*> K is INTEGER
58*> The number of elementary reflectors whose product defines the
59*> matrix Q. M >= K >= 0.
60*> \endverbatim
61*>
62*> \param[in] A
63*> \verbatim
64*> A is COMPLEX*16 array, dimension (LDA,N)
65*> The m-by-n matrix A which was factorized by ZLQT01.
66*> \endverbatim
67*>
68*> \param[in] AF
69*> \verbatim
70*> AF is COMPLEX*16 array, dimension (LDA,N)
71*> Details of the LQ factorization of A, as returned by ZGELQF.
72*> See ZGELQF for further details.
73*> \endverbatim
74*>
75*> \param[out] Q
76*> \verbatim
77*> Q is COMPLEX*16 array, dimension (LDA,N)
78*> \endverbatim
79*>
80*> \param[out] L
81*> \verbatim
82*> L is COMPLEX*16 array, dimension (LDA,M)
83*> \endverbatim
84*>
85*> \param[in] LDA
86*> \verbatim
87*> LDA is INTEGER
88*> The leading dimension of the arrays A, AF, Q and L. LDA >= N.
89*> \endverbatim
90*>
91*> \param[in] TAU
92*> \verbatim
93*> TAU is COMPLEX*16 array, dimension (M)
94*> The scalar factors of the elementary reflectors corresponding
95*> to the LQ factorization in AF.
96*> \endverbatim
97*>
98*> \param[out] WORK
99*> \verbatim
100*> WORK is COMPLEX*16 array, dimension (LWORK)
101*> \endverbatim
102*>
103*> \param[in] LWORK
104*> \verbatim
105*> LWORK is INTEGER
106*> The dimension of the array WORK.
107*> \endverbatim
108*>
109*> \param[out] RWORK
110*> \verbatim
111*> RWORK is DOUBLE PRECISION array, dimension (M)
112*> \endverbatim
113*>
114*> \param[out] RESULT
115*> \verbatim
116*> RESULT is DOUBLE PRECISION array, dimension (2)
117*> The test ratios:
118*> RESULT(1) = norm( L - A*Q' ) / ( N * norm(A) * EPS )
119*> RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )
120*> \endverbatim
121*
122* Authors:
123* ========
124*
125*> \author Univ. of Tennessee
126*> \author Univ. of California Berkeley
127*> \author Univ. of Colorado Denver
128*> \author NAG Ltd.
129*
130*> \ingroup complex16_lin
131*
132* =====================================================================
133 SUBROUTINE zlqt02( M, N, K, A, AF, Q, L, LDA, TAU, WORK, LWORK,
134 $ RWORK, RESULT )
135*
136* -- LAPACK test routine --
137* -- LAPACK is a software package provided by Univ. of Tennessee, --
138* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
139*
140* .. Scalar Arguments ..
141 INTEGER K, LDA, LWORK, M, N
142* ..
143* .. Array Arguments ..
144 DOUBLE PRECISION RESULT( * ), RWORK( * )
145 COMPLEX*16 A( LDA, * ), AF( LDA, * ), L( LDA, * ),
146 $ q( lda, * ), tau( * ), work( lwork )
147* ..
148*
149* =====================================================================
150*
151* .. Parameters ..
152 DOUBLE PRECISION ZERO, ONE
153 parameter( zero = 0.0d+0, one = 1.0d+0 )
154 COMPLEX*16 ROGUE
155 parameter( rogue = ( -1.0d+10, -1.0d+10 ) )
156* ..
157* .. Local Scalars ..
158 INTEGER INFO
159 DOUBLE PRECISION ANORM, EPS, RESID
160* ..
161* .. External Functions ..
162 DOUBLE PRECISION DLAMCH, ZLANGE, ZLANSY
163 EXTERNAL dlamch, zlange, zlansy
164* ..
165* .. External Subroutines ..
166 EXTERNAL zgemm, zherk, zlacpy, zlaset, zunglq
167* ..
168* .. Intrinsic Functions ..
169 INTRINSIC dble, dcmplx, max
170* ..
171* .. Scalars in Common ..
172 CHARACTER*32 SRNAMT
173* ..
174* .. Common blocks ..
175 COMMON / srnamc / srnamt
176* ..
177* .. Executable Statements ..
178*
179 eps = dlamch( 'Epsilon' )
180*
181* Copy the first k rows of the factorization to the array Q
182*
183 CALL zlaset( 'Full', m, n, rogue, rogue, q, lda )
184 CALL zlacpy( 'Upper', k, n-1, af( 1, 2 ), lda, q( 1, 2 ), lda )
185*
186* Generate the first n columns of the matrix Q
187*
188 srnamt = 'ZUNGLQ'
189 CALL zunglq( m, n, k, q, lda, tau, work, lwork, info )
190*
191* Copy L(1:k,1:m)
192*
193 CALL zlaset( 'Full', k, m, dcmplx( zero ), dcmplx( zero ), l,
194 $ lda )
195 CALL zlacpy( 'Lower', k, m, af, lda, l, lda )
196*
197* Compute L(1:k,1:m) - A(1:k,1:n) * Q(1:m,1:n)'
198*
199 CALL zgemm( 'No transpose', 'Conjugate transpose', k, m, n,
200 $ dcmplx( -one ), a, lda, q, lda, dcmplx( one ), l,
201 $ lda )
202*
203* Compute norm( L - A*Q' ) / ( N * norm(A) * EPS ) .
204*
205 anorm = zlange( '1', k, n, a, lda, rwork )
206 resid = zlange( '1', k, m, l, lda, rwork )
207 IF( anorm.GT.zero ) THEN
208 result( 1 ) = ( ( resid / dble( max( 1, n ) ) ) / anorm ) / eps
209 ELSE
210 result( 1 ) = zero
211 END IF
212*
213* Compute I - Q*Q'
214*
215 CALL zlaset( 'Full', m, m, dcmplx( zero ), dcmplx( one ), l, lda )
216 CALL zherk( 'Upper', 'No transpose', m, n, -one, q, lda, one, l,
217 $ lda )
218*
219* Compute norm( I - Q*Q' ) / ( N * EPS ) .
220*
221 resid = zlansy( '1', 'Upper', m, l, lda, rwork )
222*
223 result( 2 ) = ( resid / dble( max( 1, n ) ) ) / eps
224*
225 RETURN
226*
227* End of ZLQT02
228*
229 END
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
Definition zgemm.f:188
subroutine zherk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
ZHERK
Definition zherk.f:173
subroutine zlacpy(uplo, m, n, a, lda, b, ldb)
ZLACPY copies all or part of one two-dimensional array to another.
Definition zlacpy.f:103
subroutine zlaset(uplo, m, n, alpha, beta, a, lda)
ZLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition zlaset.f:106
subroutine zunglq(m, n, k, a, lda, tau, work, lwork, info)
ZUNGLQ
Definition zunglq.f:127
subroutine zlqt02(m, n, k, a, af, q, l, lda, tau, work, lwork, rwork, result)
ZLQT02
Definition zlqt02.f:135