LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ sgqrts()

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

SGQRTS

Purpose:
 SGQRTS tests SGGQRF, 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 REAL array, dimension (LDA,M)
          The N-by-M matrix A.
[out]AF
          AF is REAL array, dimension (LDA,N)
          Details of the GQR factorization of A and B, as returned
          by SGGQRF, see SGGQRF for further details.
[out]Q
          Q is REAL array, dimension (LDA,N)
          The M-by-M 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 SGGQRF.
[in]B
          B is REAL array, dimension (LDB,P)
          On entry, the N-by-P matrix A.
[out]BF
          BF is REAL array, dimension (LDB,N)
          Details of the GQR factorization of A and B, as returned
          by SGGQRF, see SGGQRF 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(N,M,P)**2.
[out]RWORK
          RWORK is REAL array, dimension (max(N,M,P))
[out]RESULT
          RESULT is REAL 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 sgqrts.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, p, n
186 * ..
187 * .. Array Arguments ..
188  REAL a( lda, * ), af( lda, * ), r( lda, * ),
189  $ q( lda, * ), b( ldb, * ), bf( ldb, * ),
190  $ t( ldb, * ), z( ldb, * ), bwk( ldb, * ),
191  $ taua( * ), taub( * ), result( 4 ),
192  $ rwork( * ), work( lwork )
193 * ..
194 *
195 * =====================================================================
196 *
197 * .. Parameters ..
198  REAL zero, one
199  parameter( zero = 0.0e+0, one = 1.0e+0 )
200  REAL rogue
201  parameter( rogue = -1.0e+10 )
202 * ..
203 * .. Local Scalars ..
204  INTEGER info
205  REAL anorm, bnorm, ulp, unfl, resid
206 * ..
207 * .. External Functions ..
208  REAL slamch, slange, slansy
209  EXTERNAL slamch, slange, slansy
210 * ..
211 * .. External Subroutines ..
212  EXTERNAL sgemm, slacpy, slaset, sorgqr,
213  $ sorgrq, ssyrk
214 * ..
215 * .. Intrinsic Functions ..
216  INTRINSIC max, min, real
217 * ..
218 * .. Executable Statements ..
219 *
220  ulp = slamch( 'Precision' )
221  unfl = slamch( 'Safe minimum' )
222 *
223 * Copy the matrix A to the array AF.
224 *
225  CALL slacpy( 'Full', n, m, a, lda, af, lda )
226  CALL slacpy( 'Full', n, p, b, ldb, bf, ldb )
227 *
228  anorm = max( slange( '1', n, m, a, lda, rwork ), unfl )
229  bnorm = max( slange( '1', n, p, b, ldb, rwork ), unfl )
230 *
231 * Factorize the matrices A and B in the arrays AF and BF.
232 *
233  CALL sggqrf( n, m, p, af, lda, taua, bf, ldb, taub, work,
234  $ lwork, info )
235 *
236 * Generate the N-by-N matrix Q
237 *
238  CALL slaset( 'Full', n, n, rogue, rogue, q, lda )
239  CALL slacpy( 'Lower', n-1, m, af( 2,1 ), lda, q( 2,1 ), lda )
240  CALL sorgqr( n, n, min( n, m ), q, lda, taua, work, lwork, info )
241 *
242 * Generate the P-by-P matrix Z
243 *
244  CALL slaset( 'Full', p, p, rogue, rogue, z, ldb )
245  IF( n.LE.p ) THEN
246  IF( n.GT.0 .AND. n.LT.p )
247  $ CALL slacpy( 'Full', n, p-n, bf, ldb, z( p-n+1, 1 ), ldb )
248  IF( n.GT.1 )
249  $ CALL slacpy( 'Lower', n-1, n-1, bf( 2, p-n+1 ), ldb,
250  $ z( p-n+2, p-n+1 ), ldb )
251  ELSE
252  IF( p.GT.1)
253  $ CALL slacpy( 'Lower', p-1, p-1, bf( n-p+2, 1 ), ldb,
254  $ z( 2, 1 ), ldb )
255  END IF
256  CALL sorgrq( p, p, min( n, p ), z, ldb, taub, work, lwork, info )
257 *
258 * Copy R
259 *
260  CALL slaset( 'Full', n, m, zero, zero, r, lda )
261  CALL slacpy( 'Upper', n, m, af, lda, r, lda )
262 *
263 * Copy T
264 *
265  CALL slaset( 'Full', n, p, zero, zero, t, ldb )
266  IF( n.LE.p ) THEN
267  CALL slacpy( 'Upper', n, n, bf( 1, p-n+1 ), ldb, t( 1, p-n+1 ),
268  $ ldb )
269  ELSE
270  CALL slacpy( 'Full', n-p, p, bf, ldb, t, ldb )
271  CALL slacpy( 'Upper', p, p, bf( n-p+1, 1 ), ldb, t( n-p+1, 1 ),
272  $ ldb )
273  END IF
274 *
275 * Compute R - Q'*A
276 *
277  CALL sgemm( 'Transpose', 'No transpose', n, m, n, -one, q, lda, a,
278  $ lda, one, r, lda )
279 *
280 * Compute norm( R - Q'*A ) / ( MAX(M,N)*norm(A)*ULP ) .
281 *
282  resid = slange( '1', n, m, r, lda, rwork )
283  IF( anorm.GT.zero ) THEN
284  result( 1 ) = ( ( resid / REAL( MAX(1,M,N) ) ) / anorm ) / ulp
285  ELSE
286  result( 1 ) = zero
287  END IF
288 *
289 * Compute T*Z - Q'*B
290 *
291  CALL sgemm( 'No Transpose', 'No transpose', n, p, p, one, t, ldb,
292  $ z, ldb, zero, bwk, ldb )
293  CALL sgemm( 'Transpose', 'No transpose', n, p, n, -one, q, lda,
294  $ b, ldb, one, bwk, ldb )
295 *
296 * Compute norm( T*Z - Q'*B ) / ( MAX(P,N)*norm(A)*ULP ) .
297 *
298  resid = slange( '1', n, p, bwk, ldb, rwork )
299  IF( bnorm.GT.zero ) THEN
300  result( 2 ) = ( ( resid / REAL( MAX(1,P,N ) ) )/bnorm ) / ulp
301  ELSE
302  result( 2 ) = zero
303  END IF
304 *
305 * Compute I - Q'*Q
306 *
307  CALL slaset( 'Full', n, n, zero, one, r, lda )
308  CALL ssyrk( 'Upper', 'Transpose', n, n, -one, q, lda, one, r,
309  $ lda )
310 *
311 * Compute norm( I - Q'*Q ) / ( N * ULP ) .
312 *
313  resid = slansy( '1', 'Upper', n, r, lda, rwork )
314  result( 3 ) = ( resid / REAL( MAX( 1, N ) ) ) / ulp
315 *
316 * Compute I - Z'*Z
317 *
318  CALL slaset( 'Full', p, p, zero, one, t, ldb )
319  CALL ssyrk( 'Upper', 'Transpose', p, p, -one, z, ldb, one, t,
320  $ ldb )
321 *
322 * Compute norm( I - Z'*Z ) / ( P*ULP ) .
323 *
324  resid = slansy( '1', 'Upper', p, t, ldb, rwork )
325  result( 4 ) = ( resid / REAL( MAX( 1, P ) ) ) / ulp
326 *
327  RETURN
328 *
329 * End of SGQRTS
330 *
subroutine sggqrf(N, M, P, A, LDA, TAUA, B, LDB, TAUB, WORK, LWORK, INFO)
SGGQRF
Definition: sggqrf.f:217
subroutine ssyrk(UPLO, TRANS, N, K, ALPHA, A, LDA, BETA, C, LDC)
SSYRK
Definition: ssyrk.f:171
subroutine sgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
SGEMM
Definition: sgemm.f:189
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
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 slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine sorgqr(M, N, K, A, LDA, TAU, WORK, LWORK, INFO)
SORGQR
Definition: sorgqr.f:130
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 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: