174 SUBROUTINE sgqrts( N, M, P, A, AF, Q, R, LDA, TAUA, B, BF, Z, T,
175 $ BWK, LDB, TAUB, WORK, LWORK, RWORK, RESULT )
182 INTEGER LDA, LDB, LWORK, M, P, N
185 REAL A( LDA, * ), AF( LDA, * ), R( LDA, * ),
186 $ q( lda, * ), b( ldb, * ), bf( ldb, * ),
187 $ t( ldb, * ), z( ldb, * ), bwk( ldb, * ),
188 $ taua( * ), taub( * ), result( 4 ),
189 $ rwork( * ), work( lwork )
196 parameter( zero = 0.0e+0, one = 1.0e+0 )
198 parameter( rogue = -1.0e+10 )
202 REAL ANORM, BNORM, ULP, UNFL, RESID
205 REAL SLAMCH, SLANGE, SLANSY
206 EXTERNAL slamch, slange, slansy
213 INTRINSIC max, min, real
217 ulp = slamch(
'Precision' )
218 unfl = slamch(
'Safe minimum' )
222 CALL slacpy(
'Full', n, m, a, lda, af, lda )
223 CALL slacpy(
'Full', n, p, b, ldb, bf, ldb )
225 anorm = max( slange(
'1', n, m, a, lda, rwork ), unfl )
226 bnorm = max( slange(
'1', n, p, b, ldb, rwork ), unfl )
230 CALL sggqrf( n, m, p, af, lda, taua, bf, ldb, taub, work,
235 CALL slaset(
'Full', n, n, rogue, rogue, q, lda )
236 CALL slacpy(
'Lower', n-1, m, af( 2,1 ), lda, q( 2,1 ), lda )
237 CALL sorgqr( n, n, min( n, m ), q, lda, taua, work, lwork, info )
241 CALL slaset(
'Full', p, p, rogue, rogue, z, ldb )
243 IF( n.GT.0 .AND. n.LT.p )
244 $
CALL slacpy(
'Full', n, p-n, bf, ldb, z( p-n+1, 1 ), ldb )
246 $
CALL slacpy(
'Lower', n-1, n-1, bf( 2, p-n+1 ), ldb,
247 $ z( p-n+2, p-n+1 ), ldb )
250 $
CALL slacpy(
'Lower', p-1, p-1, bf( n-p+2, 1 ), ldb,
253 CALL sorgrq( p, p, min( n, p ), z, ldb, taub, work, lwork, info )
257 CALL slaset(
'Full', n, m, zero, zero, r, lda )
258 CALL slacpy(
'Upper', n, m, af, lda, r, lda )
262 CALL slaset(
'Full', n, p, zero, zero, t, ldb )
264 CALL slacpy(
'Upper', n, n, bf( 1, p-n+1 ), ldb, t( 1, p-n+1 ),
267 CALL slacpy(
'Full', n-p, p, bf, ldb, t, ldb )
268 CALL slacpy(
'Upper', p, p, bf( n-p+1, 1 ), ldb, t( n-p+1, 1 ),
274 CALL sgemm(
'Transpose',
'No transpose', n, m, n, -one, q, lda, a,
279 resid = slange(
'1', n, m, r, lda, rwork )
280 IF( anorm.GT.zero )
THEN
281 result( 1 ) = ( ( resid / real( max(1,m,n) ) ) / anorm ) / ulp
288 CALL sgemm(
'No Transpose',
'No transpose', n, p, p, one, t, ldb,
289 $ z, ldb, zero, bwk, ldb )
290 CALL sgemm(
'Transpose',
'No transpose', n, p, n, -one, q, lda,
291 $ b, ldb, one, bwk, ldb )
295 resid = slange(
'1', n, p, bwk, ldb, rwork )
296 IF( bnorm.GT.zero )
THEN
297 result( 2 ) = ( ( resid / real( max(1,p,n ) ) )/bnorm ) / ulp
304 CALL slaset(
'Full', n, n, zero, one, r, lda )
305 CALL ssyrk(
'Upper',
'Transpose', n, n, -one, q, lda, one, r,
310 resid = slansy(
'1',
'Upper', n, r, lda, rwork )
311 result( 3 ) = ( resid / real( max( 1, n ) ) ) / ulp
315 CALL slaset(
'Full', p, p, zero, one, t, ldb )
316 CALL ssyrk(
'Upper',
'Transpose', p, p, -one, z, ldb, one, t,
321 resid = slansy(
'1',
'Upper', p, t, ldb, rwork )
322 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 sggqrf(n, m, p, a, lda, taua, b, ldb, taub, work, lwork, info)
SGGQRF
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 sgqrts(n, m, p, a, af, q, r, lda, taua, b, bf, z, t, bwk, ldb, taub, work, lwork, rwork, result)
SGQRTS