LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zqlt02()

subroutine zqlt02 ( integer  m,
integer  n,
integer  k,
complex*16, dimension( lda, * )  a,
complex*16, dimension( lda, * )  af,
complex*16, dimension( lda, * )  q,
complex*16, dimension( lda, * )  l,
integer  lda,
complex*16, dimension( * )  tau,
complex*16, dimension( lwork )  work,
integer  lwork,
double precision, dimension( * )  rwork,
double precision, dimension( * )  result 
)

ZQLT02

Purpose:
 ZQLT02 tests ZUNGQL, which generates an m-by-n matrix Q with
 orthonormal columns that is defined as the product of k elementary
 reflectors.

 Given the QL factorization of an m-by-n matrix A, ZQLT02 generates
 the orthogonal matrix Q defined by the factorization of the last k
 columns of A; it compares L(m-n+1:m,n-k+1:n) with
 Q(1:m,m-n+1:m)'*A(1:m,n-k+1:n), and checks that the columns of Q are
 orthonormal.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix Q to be generated.  M >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrix Q to be generated.
          M >= N >= 0.
[in]K
          K is INTEGER
          The number of elementary reflectors whose product defines the
          matrix Q. N >= K >= 0.
[in]A
          A is COMPLEX*16 array, dimension (LDA,N)
          The m-by-n matrix A which was factorized by ZQLT01.
[in]AF
          AF is COMPLEX*16 array, dimension (LDA,N)
          Details of the QL factorization of A, as returned by ZGEQLF.
          See ZGEQLF for further details.
[out]Q
          Q is COMPLEX*16 array, dimension (LDA,N)
[out]L
          L is COMPLEX*16 array, dimension (LDA,N)
[in]LDA
          LDA is INTEGER
          The leading dimension of the arrays A, AF, Q and L. LDA >= M.
[in]TAU
          TAU is COMPLEX*16 array, dimension (N)
          The scalar factors of the elementary reflectors corresponding
          to the QL factorization in AF.
[out]WORK
          WORK is COMPLEX*16 array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK.
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (M)
[out]RESULT
          RESULT is DOUBLE PRECISION array, dimension (2)
          The test ratios:
          RESULT(1) = norm( L - Q'*A ) / ( M * norm(A) * EPS )
          RESULT(2) = norm( I - Q'*Q ) / ( M * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 134 of file zqlt02.f.

136*
137* -- LAPACK test routine --
138* -- LAPACK is a software package provided by Univ. of Tennessee, --
139* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
140*
141* .. Scalar Arguments ..
142 INTEGER K, LDA, LWORK, M, N
143* ..
144* .. Array Arguments ..
145 DOUBLE PRECISION RESULT( * ), RWORK( * )
146 COMPLEX*16 A( LDA, * ), AF( LDA, * ), L( LDA, * ),
147 $ Q( LDA, * ), TAU( * ), WORK( LWORK )
148* ..
149*
150* =====================================================================
151*
152* .. Parameters ..
153 DOUBLE PRECISION ZERO, ONE
154 parameter( zero = 0.0d+0, one = 1.0d+0 )
155 COMPLEX*16 ROGUE
156 parameter( rogue = ( -1.0d+10, -1.0d+10 ) )
157* ..
158* .. Local Scalars ..
159 INTEGER INFO
160 DOUBLE PRECISION ANORM, EPS, RESID
161* ..
162* .. External Functions ..
163 DOUBLE PRECISION DLAMCH, ZLANGE, ZLANSY
164 EXTERNAL dlamch, zlange, zlansy
165* ..
166* .. External Subroutines ..
167 EXTERNAL zgemm, zherk, zlacpy, zlaset, zungql
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC dble, dcmplx, max
171* ..
172* .. Scalars in Common ..
173 CHARACTER*32 SRNAMT
174* ..
175* .. Common blocks ..
176 COMMON / srnamc / srnamt
177* ..
178* .. Executable Statements ..
179*
180* Quick return if possible
181*
182 IF( m.EQ.0 .OR. n.EQ.0 .OR. k.EQ.0 ) THEN
183 result( 1 ) = zero
184 result( 2 ) = zero
185 RETURN
186 END IF
187*
188 eps = dlamch( 'Epsilon' )
189*
190* Copy the last k columns of the factorization to the array Q
191*
192 CALL zlaset( 'Full', m, n, rogue, rogue, q, lda )
193 IF( k.LT.m )
194 $ CALL zlacpy( 'Full', m-k, k, af( 1, n-k+1 ), lda,
195 $ q( 1, n-k+1 ), lda )
196 IF( k.GT.1 )
197 $ CALL zlacpy( 'Upper', k-1, k-1, af( m-k+1, n-k+2 ), lda,
198 $ q( m-k+1, n-k+2 ), lda )
199*
200* Generate the last n columns of the matrix Q
201*
202 srnamt = 'ZUNGQL'
203 CALL zungql( m, n, k, q, lda, tau( n-k+1 ), work, lwork, info )
204*
205* Copy L(m-n+1:m,n-k+1:n)
206*
207 CALL zlaset( 'Full', n, k, dcmplx( zero ), dcmplx( zero ),
208 $ l( m-n+1, n-k+1 ), lda )
209 CALL zlacpy( 'Lower', k, k, af( m-k+1, n-k+1 ), lda,
210 $ l( m-k+1, n-k+1 ), lda )
211*
212* Compute L(m-n+1:m,n-k+1:n) - Q(1:m,m-n+1:m)' * A(1:m,n-k+1:n)
213*
214 CALL zgemm( 'Conjugate transpose', 'No transpose', n, k, m,
215 $ dcmplx( -one ), q, lda, a( 1, n-k+1 ), lda,
216 $ dcmplx( one ), l( m-n+1, n-k+1 ), lda )
217*
218* Compute norm( L - Q'*A ) / ( M * norm(A) * EPS ) .
219*
220 anorm = zlange( '1', m, k, a( 1, n-k+1 ), lda, rwork )
221 resid = zlange( '1', n, k, l( m-n+1, n-k+1 ), lda, rwork )
222 IF( anorm.GT.zero ) THEN
223 result( 1 ) = ( ( resid / dble( max( 1, m ) ) ) / anorm ) / eps
224 ELSE
225 result( 1 ) = zero
226 END IF
227*
228* Compute I - Q'*Q
229*
230 CALL zlaset( 'Full', n, n, dcmplx( zero ), dcmplx( one ), l, lda )
231 CALL zherk( 'Upper', 'Conjugate transpose', n, m, -one, q, lda,
232 $ one, l, lda )
233*
234* Compute norm( I - Q'*Q ) / ( M * EPS ) .
235*
236 resid = zlansy( '1', 'Upper', n, l, lda, rwork )
237*
238 result( 2 ) = ( resid / dble( max( 1, m ) ) ) / eps
239*
240 RETURN
241*
242* End of ZQLT02
243*
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
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
double precision function zlange(norm, m, n, a, lda, work)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition zlange.f:115
double precision function zlansy(norm, uplo, n, a, lda, work)
ZLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlansy.f:123
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 zungql(m, n, k, a, lda, tau, work, lwork, info)
ZUNGQL
Definition zungql.f:128
Here is the call graph for this function:
Here is the caller graph for this function: