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

## ◆ drqt02()

 subroutine drqt02 ( integer M, integer N, integer K, double precision, dimension( lda, * ) A, double precision, dimension( lda, * ) AF, double precision, dimension( lda, * ) Q, double precision, dimension( lda, * ) R, integer LDA, double precision, dimension( * ) TAU, double precision, dimension( lwork ) WORK, integer LWORK, double precision, dimension( * ) RWORK, double precision, dimension( * ) RESULT )

DRQT02

Purpose:
``` DRQT02 tests DORGRQ, which generates an m-by-n matrix Q with
orthonornmal rows that is defined as the product of k elementary
reflectors.

Given the RQ factorization of an m-by-n matrix A, DRQT02 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 DOUBLE PRECISION array, dimension (LDA,N) The m-by-n matrix A which was factorized by DRQT01.``` [in] AF ``` AF is DOUBLE PRECISION array, dimension (LDA,N) Details of the RQ factorization of A, as returned by DGERQF. See DGERQF for further details.``` [out] Q ` Q is DOUBLE PRECISION array, dimension (LDA,N)` [out] R ` R is DOUBLE PRECISION 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 DOUBLE PRECISION array, dimension (M) The scalar factors of the elementary reflectors corresponding to the RQ factorization in AF.``` [out] WORK ` WORK is DOUBLE PRECISION 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( R - A*Q' ) / ( N * norm(A) * EPS ) RESULT(2) = norm( I - Q*Q' ) / ( N * EPS )```

Definition at line 134 of file drqt02.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 A( LDA, * ), AF( LDA, * ), Q( LDA, * ),
146 \$ R( LDA, * ), RESULT( * ), RWORK( * ), TAU( * ),
147 \$ WORK( LWORK )
148* ..
149*
150* =====================================================================
151*
152* .. Parameters ..
153 DOUBLE PRECISION ZERO, ONE
154 parameter( zero = 0.0d+0, one = 1.0d+0 )
155 DOUBLE PRECISION ROGUE
156 parameter( rogue = -1.0d+10 )
157* ..
158* .. Local Scalars ..
159 INTEGER INFO
160 DOUBLE PRECISION ANORM, EPS, RESID
161* ..
162* .. External Functions ..
163 DOUBLE PRECISION DLAMCH, DLANGE, DLANSY
164 EXTERNAL dlamch, dlange, dlansy
165* ..
166* .. External Subroutines ..
167 EXTERNAL dgemm, dlacpy, dlaset, dorgrq, dsyrk
168* ..
169* .. Intrinsic Functions ..
170 INTRINSIC dble, 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 rows of the factorization to the array Q
191*
192 CALL dlaset( 'Full', m, n, rogue, rogue, q, lda )
193 IF( k.LT.n )
194 \$ CALL dlacpy( 'Full', k, n-k, af( m-k+1, 1 ), lda,
195 \$ q( m-k+1, 1 ), lda )
196 IF( k.GT.1 )
197 \$ CALL dlacpy( '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 = 'DORGRQ'
203 CALL dorgrq( 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 dlaset( 'Full', k, m, zero, zero, r( m-k+1, n-m+1 ), lda )
208 CALL dlacpy( 'Upper', k, k, af( m-k+1, n-k+1 ), lda,
209 \$ r( m-k+1, n-k+1 ), lda )
210*
211* Compute R(m-k+1:m,n-m+1:n) - A(m-k+1:m,1:n) * Q(n-m+1:n,1:n)'
212*
213 CALL dgemm( 'No transpose', 'Transpose', k, m, n, -one,
214 \$ a( m-k+1, 1 ), lda, q, lda, one, r( m-k+1, n-m+1 ),
215 \$ lda )
216*
217* Compute norm( R - A*Q' ) / ( N * norm(A) * EPS ) .
218*
219 anorm = dlange( '1', k, n, a( m-k+1, 1 ), lda, rwork )
220 resid = dlange( '1', k, m, r( m-k+1, n-m+1 ), lda, rwork )
221 IF( anorm.GT.zero ) THEN
222 result( 1 ) = ( ( resid / dble( max( 1, n ) ) ) / anorm ) / eps
223 ELSE
224 result( 1 ) = zero
225 END IF
226*
227* Compute I - Q*Q'
228*
229 CALL dlaset( 'Full', m, m, zero, one, r, lda )
230 CALL dsyrk( 'Upper', 'No transpose', m, n, -one, q, lda, one, r,
231 \$ lda )
232*
233* Compute norm( I - Q*Q' ) / ( N * EPS ) .
234*
235 resid = dlansy( '1', 'Upper', m, r, lda, rwork )
236*
237 result( 2 ) = ( resid / dble( max( 1, n ) ) ) / eps
238*
239 RETURN
240*
241* End of DRQT02
242*
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:69
subroutine dlacpy(UPLO, M, N, A, LDA, B, LDB)
DLACPY copies all or part of one two-dimensional array to another.
Definition: dlacpy.f:103
subroutine dlaset(UPLO, M, N, ALPHA, BETA, A, LDA)
DLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: dlaset.f:110
subroutine dsyrk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
DSYRK
Definition: dsyrk.f:169
subroutine dgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
DGEMM
Definition: dgemm.f:187
double precision function dlange(NORM, M, N, A, LDA, WORK)
DLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: dlange.f:114
subroutine dorgrq(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
DORGRQ
Definition: dorgrq.f:128
double precision function dlansy(NORM, UPLO, N, A, LDA, WORK)
DLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition: dlansy.f:122
Here is the call graph for this function:
Here is the caller graph for this function: