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

## ◆ crqt02()

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

CRQT02

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

Given the RQ factorization of an m-by-n matrix A, CRQT02 generates
the orthogonal matrix Q defined by the factorization of the last k
rows of A; it compares R(m-k+1:m,n-m+1:n) with
A(m-k+1:m,1:n)*Q(n-m+1:n,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 CRQT01. [in] AF AF is COMPLEX array, dimension (LDA,N) Details of the RQ factorization of A, as returned by CGERQF. See CGERQF for further details. [out] Q Q is COMPLEX array, dimension (LDA,N) [out] R R 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 RQ 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( R - A*Q' ) / ( N * norm(A) * EPS ) RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )

Definition at line 134 of file crqt02.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 REAL RESULT( * ), RWORK( * )
146 COMPLEX A( LDA, * ), AF( LDA, * ), Q( LDA, * ),
147 \$ R( LDA, * ), TAU( * ), WORK( LWORK )
148* ..
149*
150* =====================================================================
151*
152* .. Parameters ..
153 REAL ZERO, ONE
154 parameter( zero = 0.0e+0, one = 1.0e+0 )
155 COMPLEX ROGUE
156 parameter( rogue = ( -1.0e+10, -1.0e+10 ) )
157* ..
158* .. Local Scalars ..
159 INTEGER INFO
160 REAL ANORM, EPS, RESID
161* ..
162* .. External Functions ..
163 REAL CLANGE, CLANSY, SLAMCH
164 EXTERNAL clange, clansy, slamch
165* ..
166* .. External Subroutines ..
167 EXTERNAL cgemm, cherk, clacpy, claset, cungrq
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC cmplx, max, real
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 = slamch( 'Epsilon' )
189*
190* Copy the last k rows of the factorization to the array Q
191*
192 CALL claset( 'Full', m, n, rogue, rogue, q, lda )
193 IF( k.LT.n )
194 \$ CALL clacpy( 'Full', k, n-k, af( m-k+1, 1 ), lda,
195 \$ q( m-k+1, 1 ), lda )
196 IF( k.GT.1 )
197 \$ CALL clacpy( 'Lower', k-1, k-1, af( m-k+2, n-k+1 ), lda,
198 \$ q( m-k+2, n-k+1 ), lda )
199*
200* Generate the last n rows of the matrix Q
201*
202 srnamt = 'CUNGRQ'
203 CALL cungrq( m, n, k, q, lda, tau( m-k+1 ), work, lwork, info )
204*
205* Copy R(m-k+1:m,n-m+1:n)
206*
207 CALL claset( 'Full', k, m, cmplx( zero ), cmplx( zero ),
208 \$ r( m-k+1, n-m+1 ), lda )
209 CALL clacpy( 'Upper', k, k, af( m-k+1, n-k+1 ), lda,
210 \$ r( m-k+1, n-k+1 ), lda )
211*
212* Compute R(m-k+1:m,n-m+1:n) - A(m-k+1:m,1:n) * Q(n-m+1:n,1:n)'
213*
214 CALL cgemm( 'No transpose', 'Conjugate transpose', k, m, n,
215 \$ cmplx( -one ), a( m-k+1, 1 ), lda, q, lda,
216 \$ cmplx( one ), r( m-k+1, n-m+1 ), lda )
217*
218* Compute norm( R - A*Q' ) / ( N * norm(A) * EPS ) .
219*
220 anorm = clange( '1', k, n, a( m-k+1, 1 ), lda, rwork )
221 resid = clange( '1', k, m, r( m-k+1, n-m+1 ), lda, rwork )
222 IF( anorm.GT.zero ) THEN
223 result( 1 ) = ( ( resid / real( max( 1, n ) ) ) / anorm ) / eps
224 ELSE
225 result( 1 ) = zero
226 END IF
227*
228* Compute I - Q*Q'
229*
230 CALL claset( 'Full', m, m, cmplx( zero ), cmplx( one ), r, lda )
231 CALL cherk( 'Upper', 'No transpose', m, n, -one, q, lda, one, r,
232 \$ lda )
233*
234* Compute norm( I - Q*Q' ) / ( N * EPS ) .
235*
236 resid = clansy( '1', 'Upper', m, r, lda, rwork )
237*
238 result( 2 ) = ( resid / real( max( 1, n ) ) ) / eps
239*
240 RETURN
241*
242* End of CRQT02
243*
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 cungrq(m, n, k, a, lda, tau, work, lwork, info)
CUNGRQ
Definition cungrq.f:128
Here is the call graph for this function:
Here is the caller graph for this function: