LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ zgqrts()

subroutine zgqrts ( integer  N,
integer  M,
integer  P,
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( * )  TAUA,
complex*16, dimension( ldb, * )  B,
complex*16, dimension( ldb, * )  BF,
complex*16, dimension( ldb, * )  Z,
complex*16, dimension( ldb, * )  T,
complex*16, dimension( ldb, * )  BWK,
integer  LDB,
complex*16, dimension( * )  TAUB,
complex*16, dimension( lwork )  WORK,
integer  LWORK,
double precision, dimension( * )  RWORK,
double precision, dimension( 4 )  RESULT 
)

ZGQRTS

Purpose:
 ZGQRTS tests ZGGQRF, which computes the GQR factorization of an
 N-by-M matrix A and a N-by-P matrix B: A = Q*R and B = Q*T*Z.
Parameters
[in]N
          N is INTEGER
          The number of rows of the matrices A and B.  N >= 0.
[in]M
          M is INTEGER
          The number of columns of the matrix A.  M >= 0.
[in]P
          P is INTEGER
          The number of columns of the matrix B.  P >= 0.
[in]A
          A is COMPLEX*16 array, dimension (LDA,M)
          The N-by-M matrix A.
[out]AF
          AF is COMPLEX*16 array, dimension (LDA,N)
          Details of the GQR factorization of A and B, as returned
          by ZGGQRF, see CGGQRF for further details.
[out]Q
          Q is COMPLEX*16 array, dimension (LDA,N)
          The M-by-M unitary matrix Q.
[out]R
          R is COMPLEX*16 array, dimension (LDA,MAX(M,N))
[in]LDA
          LDA is INTEGER
          The leading dimension of the arrays A, AF, R and Q.
          LDA >= max(M,N).
[out]TAUA
          TAUA is COMPLEX*16 array, dimension (min(M,N))
          The scalar factors of the elementary reflectors, as returned
          by ZGGQRF.
[in]B
          B is COMPLEX*16 array, dimension (LDB,P)
          On entry, the N-by-P matrix A.
[out]BF
          BF is COMPLEX*16 array, dimension (LDB,N)
          Details of the GQR factorization of A and B, as returned
          by ZGGQRF, see CGGQRF for further details.
[out]Z
          Z is COMPLEX*16 array, dimension (LDB,P)
          The P-by-P unitary matrix Z.
[out]T
          T is COMPLEX*16 array, dimension (LDB,max(P,N))
[out]BWK
          BWK is COMPLEX*16 array, dimension (LDB,N)
[in]LDB
          LDB is INTEGER
          The leading dimension of the arrays B, BF, Z and T.
          LDB >= max(P,N).
[out]TAUB
          TAUB is COMPLEX*16 array, dimension (min(P,N))
          The scalar factors of the elementary reflectors, as returned
          by DGGRQF.
[out]WORK
          WORK is COMPLEX*16 array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK, LWORK >= max(N,M,P)**2.
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (max(N,M,P))
[out]RESULT
          RESULT is DOUBLE PRECISION array, dimension (4)
          The test ratios:
            RESULT(1) = norm( R - Q'*A ) / ( MAX(M,N)*norm(A)*ULP)
            RESULT(2) = norm( T*Z - Q'*B ) / (MAX(P,N)*norm(B)*ULP)
            RESULT(3) = norm( I - Q'*Q ) / ( M*ULP )
            RESULT(4) = norm( I - Z'*Z ) / ( P*ULP )
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
December 2016

Definition at line 178 of file zgqrts.f.

178 *
179 * -- LAPACK test routine (version 3.7.0) --
180 * -- LAPACK is a software package provided by Univ. of Tennessee, --
181 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
182 * December 2016
183 *
184 * .. Scalar Arguments ..
185  INTEGER lda, ldb, lwork, m, n, p
186 * ..
187 * .. Array Arguments ..
188  DOUBLE PRECISION result( 4 ), rwork( * )
189  COMPLEX*16 a( lda, * ), af( lda, * ), b( ldb, * ),
190  $ bf( ldb, * ), bwk( ldb, * ), q( lda, * ),
191  $ r( lda, * ), t( ldb, * ), taua( * ), taub( * ),
192  $ work( lwork ), z( ldb, * )
193 * ..
194 *
195 * =====================================================================
196 *
197 * .. Parameters ..
198  DOUBLE PRECISION zero, one
199  parameter( zero = 0.0d+0, one = 1.0d+0 )
200  COMPLEX*16 czero, cone
201  parameter( czero = ( 0.0d+0, 0.0d+0 ),
202  $ cone = ( 1.0d+0, 0.0d+0 ) )
203  COMPLEX*16 crogue
204  parameter( crogue = ( -1.0d+10, 0.0d+0 ) )
205 * ..
206 * .. Local Scalars ..
207  INTEGER info
208  DOUBLE PRECISION anorm, bnorm, resid, ulp, unfl
209 * ..
210 * .. External Functions ..
211  DOUBLE PRECISION dlamch, zlange, zlanhe
212  EXTERNAL dlamch, zlange, zlanhe
213 * ..
214 * .. External Subroutines ..
215  EXTERNAL zgemm, zggqrf, zherk, zlacpy, zlaset, zungqr,
216  $ zungrq
217 * ..
218 * .. Intrinsic Functions ..
219  INTRINSIC dble, max, min
220 * ..
221 * .. Executable Statements ..
222 *
223  ulp = dlamch( 'Precision' )
224  unfl = dlamch( 'Safe minimum' )
225 *
226 * Copy the matrix A to the array AF.
227 *
228  CALL zlacpy( 'Full', n, m, a, lda, af, lda )
229  CALL zlacpy( 'Full', n, p, b, ldb, bf, ldb )
230 *
231  anorm = max( zlange( '1', n, m, a, lda, rwork ), unfl )
232  bnorm = max( zlange( '1', n, p, b, ldb, rwork ), unfl )
233 *
234 * Factorize the matrices A and B in the arrays AF and BF.
235 *
236  CALL zggqrf( n, m, p, af, lda, taua, bf, ldb, taub, work, lwork,
237  $ info )
238 *
239 * Generate the N-by-N matrix Q
240 *
241  CALL zlaset( 'Full', n, n, crogue, crogue, q, lda )
242  CALL zlacpy( 'Lower', n-1, m, af( 2, 1 ), lda, q( 2, 1 ), lda )
243  CALL zungqr( n, n, min( n, m ), q, lda, taua, work, lwork, info )
244 *
245 * Generate the P-by-P matrix Z
246 *
247  CALL zlaset( 'Full', p, p, crogue, crogue, z, ldb )
248  IF( n.LE.p ) THEN
249  IF( n.GT.0 .AND. n.LT.p )
250  $ CALL zlacpy( 'Full', n, p-n, bf, ldb, z( p-n+1, 1 ), ldb )
251  IF( n.GT.1 )
252  $ CALL zlacpy( 'Lower', n-1, n-1, bf( 2, p-n+1 ), ldb,
253  $ z( p-n+2, p-n+1 ), ldb )
254  ELSE
255  IF( p.GT.1 )
256  $ CALL zlacpy( 'Lower', p-1, p-1, bf( n-p+2, 1 ), ldb,
257  $ z( 2, 1 ), ldb )
258  END IF
259  CALL zungrq( p, p, min( n, p ), z, ldb, taub, work, lwork, info )
260 *
261 * Copy R
262 *
263  CALL zlaset( 'Full', n, m, czero, czero, r, lda )
264  CALL zlacpy( 'Upper', n, m, af, lda, r, lda )
265 *
266 * Copy T
267 *
268  CALL zlaset( 'Full', n, p, czero, czero, t, ldb )
269  IF( n.LE.p ) THEN
270  CALL zlacpy( 'Upper', n, n, bf( 1, p-n+1 ), ldb, t( 1, p-n+1 ),
271  $ ldb )
272  ELSE
273  CALL zlacpy( 'Full', n-p, p, bf, ldb, t, ldb )
274  CALL zlacpy( 'Upper', p, p, bf( n-p+1, 1 ), ldb, t( n-p+1, 1 ),
275  $ ldb )
276  END IF
277 *
278 * Compute R - Q'*A
279 *
280  CALL zgemm( 'Conjugate transpose', 'No transpose', n, m, n, -cone,
281  $ q, lda, a, lda, cone, r, lda )
282 *
283 * Compute norm( R - Q'*A ) / ( MAX(M,N)*norm(A)*ULP ) .
284 *
285  resid = zlange( '1', n, m, r, lda, rwork )
286  IF( anorm.GT.zero ) THEN
287  result( 1 ) = ( ( resid / dble( max( 1, m, n ) ) ) / anorm ) /
288  $ ulp
289  ELSE
290  result( 1 ) = zero
291  END IF
292 *
293 * Compute T*Z - Q'*B
294 *
295  CALL zgemm( 'No Transpose', 'No transpose', n, p, p, cone, t, ldb,
296  $ z, ldb, czero, bwk, ldb )
297  CALL zgemm( 'Conjugate transpose', 'No transpose', n, p, n, -cone,
298  $ q, lda, b, ldb, cone, bwk, ldb )
299 *
300 * Compute norm( T*Z - Q'*B ) / ( MAX(P,N)*norm(A)*ULP ) .
301 *
302  resid = zlange( '1', n, p, bwk, ldb, rwork )
303  IF( bnorm.GT.zero ) THEN
304  result( 2 ) = ( ( resid / dble( max( 1, p, n ) ) ) / bnorm ) /
305  $ ulp
306  ELSE
307  result( 2 ) = zero
308  END IF
309 *
310 * Compute I - Q'*Q
311 *
312  CALL zlaset( 'Full', n, n, czero, cone, r, lda )
313  CALL zherk( 'Upper', 'Conjugate transpose', n, n, -one, q, lda,
314  $ one, r, lda )
315 *
316 * Compute norm( I - Q'*Q ) / ( N * ULP ) .
317 *
318  resid = zlanhe( '1', 'Upper', n, r, lda, rwork )
319  result( 3 ) = ( resid / dble( max( 1, n ) ) ) / ulp
320 *
321 * Compute I - Z'*Z
322 *
323  CALL zlaset( 'Full', p, p, czero, cone, t, ldb )
324  CALL zherk( 'Upper', 'Conjugate transpose', p, p, -one, z, ldb,
325  $ one, t, ldb )
326 *
327 * Compute norm( I - Z'*Z ) / ( P*ULP ) .
328 *
329  resid = zlanhe( '1', 'Upper', p, t, ldb, rwork )
330  result( 4 ) = ( resid / dble( max( 1, p ) ) ) / ulp
331 *
332  RETURN
333 *
334 * End of ZGQRTS
335 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
double precision function zlanhe(NORM, UPLO, N, A, LDA, WORK)
ZLANHE 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 Hermitian matrix.
Definition: zlanhe.f:126
subroutine zungrq(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
ZUNGRQ
Definition: zungrq.f:130
subroutine zggqrf(N, M, P, A, LDA, TAUA, B, LDB, TAUB, WORK, LWORK, INFO)
ZGGQRF
Definition: zggqrf.f:217
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 zgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
ZGEMM
Definition: zgemm.f:189
subroutine zungqr(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
ZUNGQR
Definition: zungqr.f:130
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 zherk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
ZHERK
Definition: zherk.f:175
Here is the call graph for this function:
Here is the caller graph for this function: