LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ zgrqts()

subroutine zgrqts ( integer  M,
integer  P,
integer  N,
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 
)

ZGRQTS

Purpose:
 ZGRQTS tests ZGGRQF, which computes the GRQ factorization of an
 M-by-N matrix A and a P-by-N matrix B: A = R*Q and B = Z*T*Q.
Parameters
[in]M
          M is INTEGER
          The number of rows of the matrix A.  M >= 0.
[in]P
          P is INTEGER
          The number of rows of the matrix B.  P >= 0.
[in]N
          N is INTEGER
          The number of columns of the matrices A and B.  N >= 0.
[in]A
          A is COMPLEX*16 array, dimension (LDA,N)
          The M-by-N matrix A.
[out]AF
          AF is COMPLEX*16 array, dimension (LDA,N)
          Details of the GRQ factorization of A and B, as returned
          by ZGGRQF, see CGGRQF for further details.
[out]Q
          Q is COMPLEX*16 array, dimension (LDA,N)
          The N-by-N 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 DGGQRC.
[in]B
          B is COMPLEX*16 array, dimension (LDB,N)
          On entry, the P-by-N matrix A.
[out]BF
          BF is COMPLEX*16 array, dimension (LDB,N)
          Details of the GQR factorization of A and B, as returned
          by ZGGRQF, see CGGRQF for further details.
[out]Z
          Z is DOUBLE PRECISION 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(M,P,N)**2.
[out]RWORK
          RWORK is DOUBLE PRECISION array, dimension (M)
[out]RESULT
          RESULT is DOUBLE PRECISION array, dimension (4)
          The test ratios:
            RESULT(1) = norm( R - A*Q' ) / ( MAX(M,N)*norm(A)*ULP)
            RESULT(2) = norm( T*Q - Z'*B ) / (MAX(P,N)*norm(B)*ULP)
            RESULT(3) = norm( I - Q'*Q ) / ( N*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 zgrqts.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, zggrqf, 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', m, n, a, lda, af, lda )
229  CALL zlacpy( 'Full', p, n, b, ldb, bf, ldb )
230 *
231  anorm = max( zlange( '1', m, n, a, lda, rwork ), unfl )
232  bnorm = max( zlange( '1', p, n, b, ldb, rwork ), unfl )
233 *
234 * Factorize the matrices A and B in the arrays AF and BF.
235 *
236  CALL zggrqf( m, p, n, 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  IF( m.LE.n ) THEN
243  IF( m.GT.0 .AND. m.LT.n )
244  $ CALL zlacpy( 'Full', m, n-m, af, lda, q( n-m+1, 1 ), lda )
245  IF( m.GT.1 )
246  $ CALL zlacpy( 'Lower', m-1, m-1, af( 2, n-m+1 ), lda,
247  $ q( n-m+2, n-m+1 ), lda )
248  ELSE
249  IF( n.GT.1 )
250  $ CALL zlacpy( 'Lower', n-1, n-1, af( m-n+2, 1 ), lda,
251  $ q( 2, 1 ), lda )
252  END IF
253  CALL zungrq( n, n, min( m, n ), q, lda, taua, work, lwork, info )
254 *
255 * Generate the P-by-P matrix Z
256 *
257  CALL zlaset( 'Full', p, p, crogue, crogue, z, ldb )
258  IF( p.GT.1 )
259  $ CALL zlacpy( 'Lower', p-1, n, bf( 2, 1 ), ldb, z( 2, 1 ), ldb )
260  CALL zungqr( p, p, min( p, n ), z, ldb, taub, work, lwork, info )
261 *
262 * Copy R
263 *
264  CALL zlaset( 'Full', m, n, czero, czero, r, lda )
265  IF( m.LE.n ) THEN
266  CALL zlacpy( 'Upper', m, m, af( 1, n-m+1 ), lda, r( 1, n-m+1 ),
267  $ lda )
268  ELSE
269  CALL zlacpy( 'Full', m-n, n, af, lda, r, lda )
270  CALL zlacpy( 'Upper', n, n, af( m-n+1, 1 ), lda, r( m-n+1, 1 ),
271  $ lda )
272  END IF
273 *
274 * Copy T
275 *
276  CALL zlaset( 'Full', p, n, czero, czero, t, ldb )
277  CALL zlacpy( 'Upper', p, n, bf, ldb, t, ldb )
278 *
279 * Compute R - A*Q'
280 *
281  CALL zgemm( 'No transpose', 'Conjugate transpose', m, n, n, -cone,
282  $ a, lda, q, lda, cone, r, lda )
283 *
284 * Compute norm( R - A*Q' ) / ( MAX(M,N)*norm(A)*ULP ) .
285 *
286  resid = zlange( '1', m, n, r, lda, rwork )
287  IF( anorm.GT.zero ) THEN
288  result( 1 ) = ( ( resid / dble( max( 1, m, n ) ) ) / anorm ) /
289  $ ulp
290  ELSE
291  result( 1 ) = zero
292  END IF
293 *
294 * Compute T*Q - Z'*B
295 *
296  CALL zgemm( 'Conjugate transpose', 'No transpose', p, n, p, cone,
297  $ z, ldb, b, ldb, czero, bwk, ldb )
298  CALL zgemm( 'No transpose', 'No transpose', p, n, n, cone, t, ldb,
299  $ q, lda, -cone, bwk, ldb )
300 *
301 * Compute norm( T*Q - Z'*B ) / ( MAX(P,N)*norm(A)*ULP ) .
302 *
303  resid = zlange( '1', p, n, bwk, ldb, rwork )
304  IF( bnorm.GT.zero ) THEN
305  result( 2 ) = ( ( resid / dble( max( 1, p, m ) ) ) / bnorm ) /
306  $ ulp
307  ELSE
308  result( 2 ) = zero
309  END IF
310 *
311 * Compute I - Q*Q'
312 *
313  CALL zlaset( 'Full', n, n, czero, cone, r, lda )
314  CALL zherk( 'Upper', 'No Transpose', n, n, -one, q, lda, one, r,
315  $ lda )
316 *
317 * Compute norm( I - Q'*Q ) / ( N * ULP ) .
318 *
319  resid = zlanhe( '1', 'Upper', n, r, lda, rwork )
320  result( 3 ) = ( resid / dble( max( 1, n ) ) ) / ulp
321 *
322 * Compute I - Z'*Z
323 *
324  CALL zlaset( 'Full', p, p, czero, cone, t, ldb )
325  CALL zherk( 'Upper', 'Conjugate transpose', p, p, -one, z, ldb,
326  $ one, t, ldb )
327 *
328 * Compute norm( I - Z'*Z ) / ( P*ULP ) .
329 *
330  resid = zlanhe( '1', 'Upper', p, t, ldb, rwork )
331  result( 4 ) = ( resid / dble( max( 1, p ) ) ) / ulp
332 *
333  RETURN
334 *
335 * End of ZGRQTS
336 *
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 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
subroutine zggrqf(M, P, N, A, LDA, TAUA, B, LDB, TAUB, WORK, LWORK, INFO)
ZGGRQF
Definition: zggrqf.f:216
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: