LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ 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
 orthonornmal 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 )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 137 of file zqrt02.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  DOUBLE PRECISION result( * ), rwork( * )
148  COMPLEX*16 a( lda, * ), af( lda, * ), q( lda, * ),
149  $ r( lda, * ), tau( * ), work( lwork )
150 * ..
151 *
152 * =====================================================================
153 *
154 * .. Parameters ..
155  DOUBLE PRECISION zero, one
156  parameter( zero = 0.0d+0, one = 1.0d+0 )
157  COMPLEX*16 rogue
158  parameter( rogue = ( -1.0d+10, -1.0d+10 ) )
159 * ..
160 * .. Local Scalars ..
161  INTEGER info
162  DOUBLE PRECISION anorm, eps, resid
163 * ..
164 * .. External Functions ..
165  DOUBLE PRECISION dlamch, zlange, zlansy
166  EXTERNAL dlamch, zlange, zlansy
167 * ..
168 * .. External Subroutines ..
169  EXTERNAL zgemm, zherk, zlacpy, zlaset, zungqr
170 * ..
171 * .. Intrinsic Functions ..
172  INTRINSIC dble, dcmplx, max
173 * ..
174 * .. Scalars in Common ..
175  CHARACTER*32 srnamt
176 * ..
177 * .. Common blocks ..
178  COMMON / srnamc / srnamt
179 * ..
180 * .. Executable Statements ..
181 *
182  eps = dlamch( 'Epsilon' )
183 *
184 * Copy the first k columns of the factorization to the array Q
185 *
186  CALL zlaset( 'Full', m, n, rogue, rogue, q, lda )
187  CALL zlacpy( 'Lower', m-1, k, af( 2, 1 ), lda, q( 2, 1 ), lda )
188 *
189 * Generate the first n columns of the matrix Q
190 *
191  srnamt = 'ZUNGQR'
192  CALL zungqr( m, n, k, q, lda, tau, work, lwork, info )
193 *
194 * Copy R(1:n,1:k)
195 *
196  CALL zlaset( 'Full', n, k, dcmplx( zero ), dcmplx( zero ), r,
197  $ lda )
198  CALL zlacpy( 'Upper', n, k, af, lda, r, lda )
199 *
200 * Compute R(1:n,1:k) - Q(1:m,1:n)' * A(1:m,1:k)
201 *
202  CALL zgemm( 'Conjugate transpose', 'No transpose', n, k, m,
203  $ dcmplx( -one ), q, lda, a, lda, dcmplx( one ), r,
204  $ lda )
205 *
206 * Compute norm( R - Q'*A ) / ( M * norm(A) * EPS ) .
207 *
208  anorm = zlange( '1', m, k, a, lda, rwork )
209  resid = zlange( '1', n, k, r, lda, rwork )
210  IF( anorm.GT.zero ) THEN
211  result( 1 ) = ( ( resid / dble( max( 1, m ) ) ) / anorm ) / eps
212  ELSE
213  result( 1 ) = zero
214  END IF
215 *
216 * Compute I - Q'*Q
217 *
218  CALL zlaset( 'Full', n, n, dcmplx( zero ), dcmplx( one ), r, lda )
219  CALL zherk( 'Upper', 'Conjugate transpose', n, m, -one, q, lda,
220  $ one, r, lda )
221 *
222 * Compute norm( I - Q'*Q ) / ( M * EPS ) .
223 *
224  resid = zlansy( '1', 'Upper', n, r, lda, rwork )
225 *
226  result( 2 ) = ( resid / dble( max( 1, m ) ) ) / eps
227 *
228  RETURN
229 *
230 * End of ZQRT02
231 *
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:117
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:108
subroutine zgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
ZGEMM
Definition: zgemm.f:189
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, or the element of largest absolute value of a complex symmetric matrix.
Definition: zlansy.f:125
subroutine zherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
ZHERK
Definition: zherk.f:175
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:105
subroutine zungqr(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
ZUNGQR
Definition: zungqr.f:130
Here is the call graph for this function:
Here is the caller graph for this function: