LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine sgrqts ( integer  M,
integer  P,
integer  N,
real, dimension( lda, * )  A,
real, dimension( lda, * )  AF,
real, dimension( lda, * )  Q,
real, dimension( lda, * )  R,
integer  LDA,
real, dimension( * )  TAUA,
real, dimension( ldb, * )  B,
real, dimension( ldb, * )  BF,
real, dimension( ldb, * )  Z,
real, dimension( ldb, * )  T,
real, dimension( ldb, * )  BWK,
integer  LDB,
real, dimension( * )  TAUB,
real, dimension( lwork )  WORK,
integer  LWORK,
real, dimension( * )  RWORK,
real, dimension( 4 )  RESULT 
)

SGRQTS

Purpose:
 SGRQTS tests SGGRQF, 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 REAL array, dimension (LDA,N)
          The M-by-N matrix A.
[out]AF
          AF is REAL array, dimension (LDA,N)
          Details of the GRQ factorization of A and B, as returned
          by SGGRQF, see SGGRQF for further details.
[out]Q
          Q is REAL array, dimension (LDA,N)
          The N-by-N orthogonal matrix Q.
[out]R
          R is REAL 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 REAL array, dimension (min(M,N))
          The scalar factors of the elementary reflectors, as returned
          by SGGQRC.
[in]B
          B is REAL array, dimension (LDB,N)
          On entry, the P-by-N matrix A.
[out]BF
          BF is REAL array, dimension (LDB,N)
          Details of the GQR factorization of A and B, as returned
          by SGGRQF, see SGGRQF for further details.
[out]Z
          Z is REAL array, dimension (LDB,P)
          The P-by-P orthogonal matrix Z.
[out]T
          T is REAL array, dimension (LDB,max(P,N))
[out]BWK
          BWK is REAL 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 REAL array, dimension (min(P,N))
          The scalar factors of the elementary reflectors, as returned
          by SGGRQF.
[out]WORK
          WORK is REAL array, dimension (LWORK)
[in]LWORK
          LWORK is INTEGER
          The dimension of the array WORK, LWORK >= max(M,P,N)**2.
[out]RWORK
          RWORK is REAL array, dimension (M)
[out]RESULT
          RESULT is REAL 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
November 2011

Definition at line 179 of file sgrqts.f.

179 *
180 * -- LAPACK test routine (version 3.4.0) --
181 * -- LAPACK is a software package provided by Univ. of Tennessee, --
182 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
183 * November 2011
184 *
185 * .. Scalar Arguments ..
186  INTEGER lda, ldb, lwork, m, p, n
187 * ..
188 * .. Array Arguments ..
189  REAL a( lda, * ), af( lda, * ), r( lda, * ),
190  $ q( lda, * ),
191  $ b( ldb, * ), bf( ldb, * ), t( ldb, * ),
192  $ z( ldb, * ), bwk( ldb, * ),
193  $ taua( * ), taub( * ),
194  $ result( 4 ), rwork( * ), work( lwork )
195 * ..
196 *
197 * =====================================================================
198 *
199 * .. Parameters ..
200  REAL zero, one
201  parameter ( zero = 0.0e+0, one = 1.0e+0 )
202  REAL rogue
203  parameter ( rogue = -1.0e+10 )
204 * ..
205 * .. Local Scalars ..
206  INTEGER info
207  REAL anorm, bnorm, ulp, unfl, resid
208 * ..
209 * .. External Functions ..
210  REAL slamch, slange, slansy
211  EXTERNAL slamch, slange, slansy
212 * ..
213 * .. External Subroutines ..
214  EXTERNAL sgemm, sggrqf, slacpy, slaset, sorgqr,
215  $ sorgrq, ssyrk
216 * ..
217 * .. Intrinsic Functions ..
218  INTRINSIC max, min, real
219 * ..
220 * .. Executable Statements ..
221 *
222  ulp = slamch( 'Precision' )
223  unfl = slamch( 'Safe minimum' )
224 *
225 * Copy the matrix A to the array AF.
226 *
227  CALL slacpy( 'Full', m, n, a, lda, af, lda )
228  CALL slacpy( 'Full', p, n, b, ldb, bf, ldb )
229 *
230  anorm = max( slange( '1', m, n, a, lda, rwork ), unfl )
231  bnorm = max( slange( '1', p, n, b, ldb, rwork ), unfl )
232 *
233 * Factorize the matrices A and B in the arrays AF and BF.
234 *
235  CALL sggrqf( m, p, n, af, lda, taua, bf, ldb, taub, work,
236  $ lwork, info )
237 *
238 * Generate the N-by-N matrix Q
239 *
240  CALL slaset( 'Full', n, n, rogue, rogue, q, lda )
241  IF( m.LE.n ) THEN
242  IF( m.GT.0 .AND. m.LT.n )
243  $ CALL slacpy( 'Full', m, n-m, af, lda, q( n-m+1, 1 ), lda )
244  IF( m.GT.1 )
245  $ CALL slacpy( 'Lower', m-1, m-1, af( 2, n-m+1 ), lda,
246  $ q( n-m+2, n-m+1 ), lda )
247  ELSE
248  IF( n.GT.1 )
249  $ CALL slacpy( 'Lower', n-1, n-1, af( m-n+2, 1 ), lda,
250  $ q( 2, 1 ), lda )
251  END IF
252  CALL sorgrq( n, n, min( m, n ), q, lda, taua, work, lwork, info )
253 *
254 * Generate the P-by-P matrix Z
255 *
256  CALL slaset( 'Full', p, p, rogue, rogue, z, ldb )
257  IF( p.GT.1 )
258  $ CALL slacpy( 'Lower', p-1, n, bf( 2,1 ), ldb, z( 2,1 ), ldb )
259  CALL sorgqr( p, p, min( p,n ), z, ldb, taub, work, lwork, info )
260 *
261 * Copy R
262 *
263  CALL slaset( 'Full', m, n, zero, zero, r, lda )
264  IF( m.LE.n )THEN
265  CALL slacpy( 'Upper', m, m, af( 1, n-m+1 ), lda, r( 1, n-m+1 ),
266  $ lda )
267  ELSE
268  CALL slacpy( 'Full', m-n, n, af, lda, r, lda )
269  CALL slacpy( 'Upper', n, n, af( m-n+1, 1 ), lda, r( m-n+1, 1 ),
270  $ lda )
271  END IF
272 *
273 * Copy T
274 *
275  CALL slaset( 'Full', p, n, zero, zero, t, ldb )
276  CALL slacpy( 'Upper', p, n, bf, ldb, t, ldb )
277 *
278 * Compute R - A*Q'
279 *
280  CALL sgemm( 'No transpose', 'Transpose', m, n, n, -one, a, lda, q,
281  $ lda, one, r, lda )
282 *
283 * Compute norm( R - A*Q' ) / ( MAX(M,N)*norm(A)*ULP ) .
284 *
285  resid = slange( '1', m, n, r, lda, rwork )
286  IF( anorm.GT.zero ) THEN
287  result( 1 ) = ( ( resid / REAL(MAX(1,M,N) ) ) / anorm ) / ulp
288  ELSE
289  result( 1 ) = zero
290  END IF
291 *
292 * Compute T*Q - Z'*B
293 *
294  CALL sgemm( 'Transpose', 'No transpose', p, n, p, one, z, ldb, b,
295  $ ldb, zero, bwk, ldb )
296  CALL sgemm( 'No transpose', 'No transpose', p, n, n, one, t, ldb,
297  $ q, lda, -one, bwk, ldb )
298 *
299 * Compute norm( T*Q - Z'*B ) / ( MAX(P,N)*norm(A)*ULP ) .
300 *
301  resid = slange( '1', p, n, bwk, ldb, rwork )
302  IF( bnorm.GT.zero ) THEN
303  result( 2 ) = ( ( resid / REAL( MAX( 1,P,M ) ) )/bnorm ) / ulp
304  ELSE
305  result( 2 ) = zero
306  END IF
307 *
308 * Compute I - Q*Q'
309 *
310  CALL slaset( 'Full', n, n, zero, one, r, lda )
311  CALL ssyrk( 'Upper', 'No Transpose', n, n, -one, q, lda, one, r,
312  $ lda )
313 *
314 * Compute norm( I - Q'*Q ) / ( N * ULP ) .
315 *
316  resid = slansy( '1', 'Upper', n, r, lda, rwork )
317  result( 3 ) = ( resid / REAL( MAX( 1,N ) ) ) / ulp
318 *
319 * Compute I - Z'*Z
320 *
321  CALL slaset( 'Full', p, p, zero, one, t, ldb )
322  CALL ssyrk( 'Upper', 'Transpose', p, p, -one, z, ldb, one, t,
323  $ ldb )
324 *
325 * Compute norm( I - Z'*Z ) / ( P*ULP ) .
326 *
327  resid = slansy( '1', 'Upper', p, t, ldb, rwork )
328  result( 4 ) = ( resid / REAL( MAX( 1,P ) ) ) / ulp
329 *
330  RETURN
331 *
332 * End of SGRQTS
333 *
subroutine ssyrk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
SSYRK
Definition: ssyrk.f:171
subroutine sggrqf(M, P, N, A, LDA, TAUA, B, LDB, TAUB, WORK, LWORK, INFO)
SGGRQF
Definition: sggrqf.f:216
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:189
subroutine slacpy(UPLO, M, N, A, LDA, B, LDB)
SLACPY copies all or part of one two-dimensional array to another.
Definition: slacpy.f:105
subroutine slaset(UPLO, M, N, ALPHA, BETA, A, LDA)
SLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values...
Definition: slaset.f:112
real function slange(NORM, M, N, A, LDA, WORK)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: slange.f:116
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine sorgqr(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
SORGQR
Definition: sorgqr.f:130
subroutine sorgrq(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
SORGRQ
Definition: sorgrq.f:130
real function slansy(NORM, UPLO, N, A, LDA, WORK)
SLANSY returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a real symmetric matrix.
Definition: slansy.f:124

Here is the call graph for this function:

Here is the caller graph for this function: