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

## ◆ zqrt02()

 subroutine zqrt02 ( 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, * ) r, integer lda, complex*16, dimension( * ) tau, complex*16, dimension( lwork ) work, integer lwork, double precision, dimension( * ) rwork, double precision, dimension( * ) result )

ZQRT02

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

Given the QR factorization of an m-by-n matrix A, ZQRT02 generates
the orthogonal matrix Q defined by the factorization of the first k
columns of A; it compares R(1:n,1:k) with Q(1:m,1:n)'*A(1:m,1:k),
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 ZQRT01.``` [in] AF ``` AF is COMPLEX*16 array, dimension (LDA,N) Details of the QR factorization of A, as returned by ZGEQRF. See ZGEQRF for further details.``` [out] Q ` Q is COMPLEX*16 array, dimension (LDA,N)` [out] R ` R is COMPLEX*16 array, dimension (LDA,N)` [in] LDA ``` LDA is INTEGER The leading dimension of the arrays A, AF, Q and R. LDA >= M.``` [in] TAU ``` TAU is COMPLEX*16 array, dimension (N) The scalar factors of the elementary reflectors corresponding to the QR 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( R - Q'*A ) / ( M * norm(A) * EPS ) RESULT(2) = norm( I - Q'*Q ) / ( M * EPS )```

Definition at line 133 of file zqrt02.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 DOUBLE PRECISION RESULT( * ), RWORK( * )
145 COMPLEX*16 A( LDA, * ), AF( LDA, * ), Q( LDA, * ),
146 \$ R( LDA, * ), TAU( * ), WORK( LWORK )
147* ..
148*
149* =====================================================================
150*
151* .. Parameters ..
152 DOUBLE PRECISION ZERO, ONE
153 parameter( zero = 0.0d+0, one = 1.0d+0 )
154 COMPLEX*16 ROGUE
155 parameter( rogue = ( -1.0d+10, -1.0d+10 ) )
156* ..
157* .. Local Scalars ..
158 INTEGER INFO
159 DOUBLE PRECISION ANORM, EPS, RESID
160* ..
161* .. External Functions ..
162 DOUBLE PRECISION DLAMCH, ZLANGE, ZLANSY
163 EXTERNAL dlamch, zlange, zlansy
164* ..
165* .. External Subroutines ..
166 EXTERNAL zgemm, zherk, zlacpy, zlaset, zungqr
167* ..
168* .. Intrinsic Functions ..
169 INTRINSIC dble, dcmplx, max
170* ..
171* .. Scalars in Common ..
172 CHARACTER*32 SRNAMT
173* ..
174* .. Common blocks ..
175 COMMON / srnamc / srnamt
176* ..
177* .. Executable Statements ..
178*
179 eps = dlamch( 'Epsilon' )
180*
181* Copy the first k columns of the factorization to the array Q
182*
183 CALL zlaset( 'Full', m, n, rogue, rogue, q, lda )
184 CALL zlacpy( 'Lower', m-1, k, af( 2, 1 ), lda, q( 2, 1 ), lda )
185*
186* Generate the first n columns of the matrix Q
187*
188 srnamt = 'ZUNGQR'
189 CALL zungqr( m, n, k, q, lda, tau, work, lwork, info )
190*
191* Copy R(1:n,1:k)
192*
193 CALL zlaset( 'Full', n, k, dcmplx( zero ), dcmplx( zero ), r,
194 \$ lda )
195 CALL zlacpy( 'Upper', n, k, af, lda, r, lda )
196*
197* Compute R(1:n,1:k) - Q(1:m,1:n)' * A(1:m,1:k)
198*
199 CALL zgemm( 'Conjugate transpose', 'No transpose', n, k, m,
200 \$ dcmplx( -one ), q, lda, a, lda, dcmplx( one ), r,
201 \$ lda )
202*
203* Compute norm( R - Q'*A ) / ( M * norm(A) * EPS ) .
204*
205 anorm = zlange( '1', m, k, a, lda, rwork )
206 resid = zlange( '1', n, k, r, lda, rwork )
207 IF( anorm.GT.zero ) THEN
208 result( 1 ) = ( ( resid / dble( max( 1, m ) ) ) / anorm ) / eps
209 ELSE
210 result( 1 ) = zero
211 END IF
212*
213* Compute I - Q'*Q
214*
215 CALL zlaset( 'Full', n, n, dcmplx( zero ), dcmplx( one ), r, lda )
216 CALL zherk( 'Upper', 'Conjugate transpose', n, m, -one, q, lda,
217 \$ one, r, lda )
218*
219* Compute norm( I - Q'*Q ) / ( M * EPS ) .
220*
221 resid = zlansy( '1', 'Upper', n, r, lda, rwork )
222*
223 result( 2 ) = ( resid / dble( max( 1, m ) ) ) / eps
224*
225 RETURN
226*
227* End of ZQRT02
228*
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 zungqr(m, n, k, a, lda, tau, work, lwork, info)
ZUNGQR
Definition zungqr.f:128
Here is the call graph for this function:
Here is the caller graph for this function: