175 SUBROUTINE sgrqts( M, P, N, A, AF, Q, R, LDA, TAUA, B, BF, Z, T,
176 $ BWK, LDB, TAUB, WORK, LWORK, RWORK, RESULT )
183 INTEGER LDA, LDB, LWORK, M, P, N
186 REAL A( LDA, * ), AF( LDA, * ), R( LDA, * ),
188 $ b( ldb, * ), bf( ldb, * ), t( ldb, * ),
189 $ z( ldb, * ), bwk( ldb, * ),
190 $ taua( * ), taub( * ),
191 $ result( 4 ), rwork( * ), work( lwork )
198 parameter( zero = 0.0e+0, one = 1.0e+0 )
200 parameter( rogue = -1.0e+10 )
204 REAL ANORM, BNORM, ULP, UNFL, RESID
207 REAL SLAMCH, SLANGE, SLANSY
208 EXTERNAL slamch, slange, slansy
215 INTRINSIC max, min, real
219 ulp = slamch(
'Precision' )
220 unfl = slamch(
'Safe minimum' )
224 CALL slacpy(
'Full', m, n, a, lda, af, lda )
225 CALL slacpy(
'Full', p, n, b, ldb, bf, ldb )
227 anorm = max( slange(
'1', m, n, a, lda, rwork ), unfl )
228 bnorm = max( slange(
'1', p, n, b, ldb, rwork ), unfl )
232 CALL sggrqf( m, p, n, af, lda, taua, bf, ldb, taub, work,
237 CALL slaset(
'Full', n, n, rogue, rogue, q, lda )
239 IF( m.GT.0 .AND. m.LT.n )
240 $
CALL slacpy(
'Full', m, n-m, af, lda, q( n-m+1, 1 ), lda )
242 $
CALL slacpy(
'Lower', m-1, m-1, af( 2, n-m+1 ), lda,
243 $ q( n-m+2, n-m+1 ), lda )
246 $
CALL slacpy(
'Lower', n-1, n-1, af( m-n+2, 1 ), lda,
249 CALL sorgrq( n, n, min( m, n ), q, lda, taua, work, lwork, info )
253 CALL slaset(
'Full', p, p, rogue, rogue, z, ldb )
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 )
260 CALL slaset(
'Full', m, n, zero, zero, r, lda )
262 CALL slacpy(
'Upper', m, m, af( 1, n-m+1 ), lda, r( 1, n-m+1 ),
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 ),
272 CALL slaset(
'Full', p, n, zero, zero, t, ldb )
273 CALL slacpy(
'Upper', p, n, bf, ldb, t, ldb )
277 CALL sgemm(
'No transpose',
'Transpose', m, n, n, -one, a, lda, q,
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
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 )
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
307 CALL slaset(
'Full', n, n, zero, one, r, lda )
308 CALL ssyrk(
'Upper',
'No Transpose', n, n, -one, q, lda, one, r,
313 resid = slansy(
'1',
'Upper', n, r, lda, rwork )
314 result( 3 ) = ( resid / real( max( 1,n ) ) ) / ulp
318 CALL slaset(
'Full', p, p, zero, one, t, ldb )
319 CALL ssyrk(
'Upper',
'Transpose', p, p, -one, z, ldb, one, t,
324 resid = slansy(
'1',
'Upper', p, t, ldb, rwork )
325 result( 4 ) = ( resid / real( max( 1,p ) ) ) / ulp
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
subroutine sggrqf(m, p, n, a, lda, taua, b, ldb, taub, work, lwork, info)
SGGRQF
subroutine ssyrk(uplo, trans, n, k, alpha, a, lda, beta, c, ldc)
SSYRK
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
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.
subroutine sorgqr(m, n, k, a, lda, tau, work, lwork, info)
SORGQR
subroutine sorgrq(m, n, k, a, lda, tau, work, lwork, info)
SORGRQ
subroutine sgrqts(m, p, n, a, af, q, r, lda, taua, b, bf, z, t, bwk, ldb, taub, work, lwork, rwork, result)
SGRQTS