LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ sgrqts()

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.

Definition at line 175 of file sgrqts.f.

177*
178* -- LAPACK test routine --
179* -- LAPACK is a software package provided by Univ. of Tennessee, --
180* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
181*
182* .. Scalar Arguments ..
183 INTEGER LDA, LDB, LWORK, M, P, N
184* ..
185* .. Array Arguments ..
186 REAL A( LDA, * ), AF( LDA, * ), R( LDA, * ),
187 $ Q( LDA, * ),
188 $ B( LDB, * ), BF( LDB, * ), T( LDB, * ),
189 $ Z( LDB, * ), BWK( LDB, * ),
190 $ TAUA( * ), TAUB( * ),
191 $ RESULT( 4 ), RWORK( * ), WORK( LWORK )
192* ..
193*
194* =====================================================================
195*
196* .. Parameters ..
197 REAL ZERO, ONE
198 parameter( zero = 0.0e+0, one = 1.0e+0 )
199 REAL ROGUE
200 parameter( rogue = -1.0e+10 )
201* ..
202* .. Local Scalars ..
203 INTEGER INFO
204 REAL ANORM, BNORM, ULP, UNFL, RESID
205* ..
206* .. External Functions ..
207 REAL SLAMCH, SLANGE, SLANSY
208 EXTERNAL slamch, slange, slansy
209* ..
210* .. External Subroutines ..
211 EXTERNAL sgemm, sggrqf, slacpy, slaset, sorgqr,
212 $ sorgrq, ssyrk
213* ..
214* .. Intrinsic Functions ..
215 INTRINSIC max, min, real
216* ..
217* .. Executable Statements ..
218*
219 ulp = slamch( 'Precision' )
220 unfl = slamch( 'Safe minimum' )
221*
222* Copy the matrix A to the array AF.
223*
224 CALL slacpy( 'Full', m, n, a, lda, af, lda )
225 CALL slacpy( 'Full', p, n, b, ldb, bf, ldb )
226*
227 anorm = max( slange( '1', m, n, a, lda, rwork ), unfl )
228 bnorm = max( slange( '1', p, n, b, ldb, rwork ), unfl )
229*
230* Factorize the matrices A and B in the arrays AF and BF.
231*
232 CALL sggrqf( m, p, n, af, lda, taua, bf, ldb, taub, work,
233 $ lwork, info )
234*
235* Generate the N-by-N matrix Q
236*
237 CALL slaset( 'Full', n, n, rogue, rogue, q, lda )
238 IF( m.LE.n ) THEN
239 IF( m.GT.0 .AND. m.LT.n )
240 $ CALL slacpy( 'Full', m, n-m, af, lda, q( n-m+1, 1 ), lda )
241 IF( m.GT.1 )
242 $ CALL slacpy( 'Lower', m-1, m-1, af( 2, n-m+1 ), lda,
243 $ q( n-m+2, n-m+1 ), lda )
244 ELSE
245 IF( n.GT.1 )
246 $ CALL slacpy( 'Lower', n-1, n-1, af( m-n+2, 1 ), lda,
247 $ q( 2, 1 ), lda )
248 END IF
249 CALL sorgrq( n, n, min( m, n ), q, lda, taua, work, lwork, info )
250*
251* Generate the P-by-P matrix Z
252*
253 CALL slaset( 'Full', p, p, rogue, rogue, z, ldb )
254 IF( p.GT.1 )
255 $ CALL slacpy( 'Lower', p-1, n, bf( 2,1 ), ldb, z( 2,1 ), ldb )
256 CALL sorgqr( p, p, min( p,n ), z, ldb, taub, work, lwork, info )
257*
258* Copy R
259*
260 CALL slaset( 'Full', m, n, zero, zero, r, lda )
261 IF( m.LE.n )THEN
262 CALL slacpy( 'Upper', m, m, af( 1, n-m+1 ), lda, r( 1, n-m+1 ),
263 $ lda )
264 ELSE
265 CALL slacpy( 'Full', m-n, n, af, lda, r, lda )
266 CALL slacpy( 'Upper', n, n, af( m-n+1, 1 ), lda, r( m-n+1, 1 ),
267 $ lda )
268 END IF
269*
270* Copy T
271*
272 CALL slaset( 'Full', p, n, zero, zero, t, ldb )
273 CALL slacpy( 'Upper', p, n, bf, ldb, t, ldb )
274*
275* Compute R - A*Q'
276*
277 CALL sgemm( 'No transpose', 'Transpose', m, n, n, -one, a, lda, q,
278 $ lda, one, r, lda )
279*
280* Compute norm( R - A*Q' ) / ( MAX(M,N)*norm(A)*ULP ) .
281*
282 resid = slange( '1', m, n, 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*Q - Z'*B
290*
291 CALL sgemm( 'Transpose', 'No transpose', p, n, p, one, z, ldb, b,
292 $ ldb, zero, bwk, ldb )
293 CALL sgemm( 'No transpose', 'No transpose', p, n, n, one, t, ldb,
294 $ q, lda, -one, bwk, ldb )
295*
296* Compute norm( T*Q - Z'*B ) / ( MAX(P,N)*norm(A)*ULP ) .
297*
298 resid = slange( '1', p, n, bwk, ldb, rwork )
299 IF( bnorm.GT.zero ) THEN
300 result( 2 ) = ( ( resid / real( max( 1,p,m ) ) )/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', 'No 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 SGRQTS
330*
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
Definition sgemm.f:188
subroutine sggrqf(m, p, n, a, lda, taua, b, ldb, taub, work, lwork, info)
SGGRQF
Definition sggrqf.f:214
subroutine ssyrk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
SSYRK
Definition ssyrk.f:169
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
Definition slacpy.f:103
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
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:114
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,...
Definition slansy.f:122
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:110
subroutine sorgqr(m, n, k, a, lda, tau, work, lwork, info)
SORGQR
Definition sorgqr.f:128
subroutine sorgrq(m, n, k, a, lda, tau, work, lwork, info)
SORGRQ
Definition sorgrq.f:128
Here is the call graph for this function:
Here is the caller graph for this function: