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

◆ clqt02()

subroutine clqt02 ( integer  m,
integer  n,
integer  k,
complex, dimension( lda, * )  a,
complex, dimension( lda, * )  af,
complex, dimension( lda, * )  q,
complex, dimension( lda, * )  l,
integer  lda,
complex, dimension( * )  tau,
complex, dimension( lwork )  work,
integer  lwork,
real, dimension( * )  rwork,
real, dimension( * )  result 
)

CLQT02

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

 Given the LQ factorization of an m-by-n matrix A, CLQT02 generates
 the orthogonal matrix Q defined by the factorization of the first k
 rows of A; it compares L(1:k,1:m) with A(1:k,1:n)*Q(1:m,1:n)', and
 checks that the rows 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.
          N >= M >= 0.
[in]K
          K is INTEGER
          The number of elementary reflectors whose product defines the
          matrix Q. M >= K >= 0.
[in]A
          A is COMPLEX array, dimension (LDA,N)
          The m-by-n matrix A which was factorized by CLQT01.
[in]AF
          AF is COMPLEX array, dimension (LDA,N)
          Details of the LQ factorization of A, as returned by CGELQF.
          See CGELQF for further details.
[out]Q
          Q is COMPLEX array, dimension (LDA,N)
[out]L
          L is COMPLEX array, dimension (LDA,M)
[in]LDA
          LDA is INTEGER
          The leading dimension of the arrays A, AF, Q and L. LDA >= N.
[in]TAU
          TAU is COMPLEX array, dimension (M)
          The scalar factors of the elementary reflectors corresponding
          to the LQ factorization in AF.
[out]WORK
          WORK is COMPLEX array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK.
[out]RWORK
          RWORK is REAL array, dimension (M)
[out]RESULT
          RESULT is REAL array, dimension (2)
          The test ratios:
          RESULT(1) = norm( L - A*Q' ) / ( N * norm(A) * EPS )
          RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 133 of file clqt02.f.

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 REAL RESULT( * ), RWORK( * )
145 COMPLEX A( LDA, * ), AF( LDA, * ), L( LDA, * ),
146 $ Q( LDA, * ), TAU( * ), WORK( LWORK )
147* ..
148*
149* =====================================================================
150*
151* .. Parameters ..
152 REAL ZERO, ONE
153 parameter( zero = 0.0e+0, one = 1.0e+0 )
154 COMPLEX ROGUE
155 parameter( rogue = ( -1.0e+10, -1.0e+10 ) )
156* ..
157* .. Local Scalars ..
158 INTEGER INFO
159 REAL ANORM, EPS, RESID
160* ..
161* .. External Functions ..
162 REAL CLANGE, CLANSY, SLAMCH
163 EXTERNAL clange, clansy, slamch
164* ..
165* .. External Subroutines ..
166 EXTERNAL cgemm, cherk, clacpy, claset, cunglq
167* ..
168* .. Intrinsic Functions ..
169 INTRINSIC cmplx, max, real
170* ..
171* .. Scalars in Common ..
172 CHARACTER*32 SRNAMT
173* ..
174* .. Common blocks ..
175 COMMON / srnamc / srnamt
176* ..
177* .. Executable Statements ..
178*
179 eps = slamch( 'Epsilon' )
180*
181* Copy the first k rows of the factorization to the array Q
182*
183 CALL claset( 'Full', m, n, rogue, rogue, q, lda )
184 CALL clacpy( '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 = 'CUNGLQ'
189 CALL cunglq( m, n, k, q, lda, tau, work, lwork, info )
190*
191* Copy L(1:k,1:m)
192*
193 CALL claset( 'Full', k, m, cmplx( zero ), cmplx( zero ), l, lda )
194 CALL clacpy( 'Lower', k, m, af, lda, l, lda )
195*
196* Compute L(1:k,1:m) - A(1:k,1:n) * Q(1:m,1:n)'
197*
198 CALL cgemm( 'No transpose', 'Conjugate transpose', k, m, n,
199 $ cmplx( -one ), a, lda, q, lda, cmplx( one ), l, lda )
200*
201* Compute norm( L - A*Q' ) / ( N * norm(A) * EPS ) .
202*
203 anorm = clange( '1', k, n, a, lda, rwork )
204 resid = clange( '1', k, m, l, lda, rwork )
205 IF( anorm.GT.zero ) THEN
206 result( 1 ) = ( ( resid / real( max( 1, n ) ) ) / anorm ) / eps
207 ELSE
208 result( 1 ) = zero
209 END IF
210*
211* Compute I - Q*Q'
212*
213 CALL claset( 'Full', m, m, cmplx( zero ), cmplx( one ), l, lda )
214 CALL cherk( 'Upper', 'No transpose', m, n, -one, q, lda, one, l,
215 $ lda )
216*
217* Compute norm( I - Q*Q' ) / ( N * EPS ) .
218*
219 resid = clansy( '1', 'Upper', m, l, lda, rwork )
220*
221 result( 2 ) = ( resid / real( max( 1, n ) ) ) / eps
222*
223 RETURN
224*
225* End of CLQT02
226*
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
Definition cgemm.f:188
subroutine cherk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
CHERK
Definition cherk.f:173
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.
Definition clacpy.f:103
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
real function clange(norm, m, n, a, lda, work)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition clange.f:115
real function clansy(norm, uplo, n, a, lda, work)
CLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition clansy.f:123
subroutine claset(uplo, m, n, alpha, beta, a, lda)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition claset.f:106
subroutine cunglq(m, n, k, a, lda, tau, work, lwork, info)
CUNGLQ
Definition cunglq.f:127
Here is the call graph for this function:
Here is the caller graph for this function: