LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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
 orthonornmal 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.
Date
December 2016

Definition at line 137 of file clqt02.f.

137 *
138 * -- LAPACK test routine (version 3.7.0) --
139 * -- LAPACK is a software package provided by Univ. of Tennessee, --
140 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
141 * December 2016
142 *
143 * .. Scalar Arguments ..
144  INTEGER k, lda, lwork, m, n
145 * ..
146 * .. Array Arguments ..
147  REAL result( * ), rwork( * )
148  COMPLEX a( lda, * ), af( lda, * ), l( lda, * ),
149  $ q( lda, * ), tau( * ), work( lwork )
150 * ..
151 *
152 * =====================================================================
153 *
154 * .. Parameters ..
155  REAL zero, one
156  parameter( zero = 0.0e+0, one = 1.0e+0 )
157  COMPLEX rogue
158  parameter( rogue = ( -1.0e+10, -1.0e+10 ) )
159 * ..
160 * .. Local Scalars ..
161  INTEGER info
162  REAL anorm, eps, resid
163 * ..
164 * .. External Functions ..
165  REAL clange, clansy, slamch
166  EXTERNAL clange, clansy, slamch
167 * ..
168 * .. External Subroutines ..
169  EXTERNAL cgemm, cherk, clacpy, claset, cunglq
170 * ..
171 * .. Intrinsic Functions ..
172  INTRINSIC cmplx, max, real
173 * ..
174 * .. Scalars in Common ..
175  CHARACTER*32 srnamt
176 * ..
177 * .. Common blocks ..
178  COMMON / srnamc / srnamt
179 * ..
180 * .. Executable Statements ..
181 *
182  eps = slamch( 'Epsilon' )
183 *
184 * Copy the first k rows of the factorization to the array Q
185 *
186  CALL claset( 'Full', m, n, rogue, rogue, q, lda )
187  CALL clacpy( 'Upper', k, n-1, af( 1, 2 ), lda, q( 1, 2 ), lda )
188 *
189 * Generate the first n columns of the matrix Q
190 *
191  srnamt = 'CUNGLQ'
192  CALL cunglq( m, n, k, q, lda, tau, work, lwork, info )
193 *
194 * Copy L(1:k,1:m)
195 *
196  CALL claset( 'Full', k, m, cmplx( zero ), cmplx( zero ), l, lda )
197  CALL clacpy( 'Lower', k, m, af, lda, l, lda )
198 *
199 * Compute L(1:k,1:m) - A(1:k,1:n) * Q(1:m,1:n)'
200 *
201  CALL cgemm( 'No transpose', 'Conjugate transpose', k, m, n,
202  $ cmplx( -one ), a, lda, q, lda, cmplx( one ), l, lda )
203 *
204 * Compute norm( L - A*Q' ) / ( N * norm(A) * EPS ) .
205 *
206  anorm = clange( '1', k, n, a, lda, rwork )
207  resid = clange( '1', k, m, l, lda, rwork )
208  IF( anorm.GT.zero ) THEN
209  result( 1 ) = ( ( resid / REAL( MAX( 1, N ) ) ) / anorm ) / eps
210  ELSE
211  result( 1 ) = zero
212  END IF
213 *
214 * Compute I - Q*Q'
215 *
216  CALL claset( 'Full', m, m, cmplx( zero ), cmplx( one ), l, lda )
217  CALL cherk( 'Upper', 'No transpose', m, n, -one, q, lda, one, l,
218  $ lda )
219 *
220 * Compute norm( I - Q*Q' ) / ( N * EPS ) .
221 *
222  resid = clansy( '1', 'Upper', m, l, lda, rwork )
223 *
224  result( 2 ) = ( resid / REAL( MAX( 1, N ) ) ) / eps
225 *
226  RETURN
227 *
228 * End of CLQT02
229 *
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:108
subroutine cherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
CHERK
Definition: cherk.f:175
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:117
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
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, or the element of largest absolute value of a complex symmetric matrix.
Definition: clansy.f:125
subroutine cunglq(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
CUNGLQ
Definition: cunglq.f:129
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:189
Here is the call graph for this function:
Here is the caller graph for this function: