127 INTEGER M, N, MB1, NB1, NB2
135 REAL ,
ALLOCATABLE :: A(:,:), AF(:,:), Q(:,:), R(:,:),
136 $ RWORK(:), WORK( : ), T1(:,:), T2(:,:), DIAG(:),
137 $ C(:,:), CF(:,:), D(:,:), DF(:,:)
141 parameter( zero = 0.0e+0, one = 1.0e+0 )
145 INTEGER INFO, J, K, L, LWORK, NB2_UB, NRB
146 REAL ANORM, EPS, RESID, CNORM, DNORM
153 REAL SLAMCH, SLANGE, SLANSY
154 EXTERNAL slamch, slange, slansy
161 INTRINSIC ceiling, real, max, min
164 CHARACTER(LEN=32) SRNAMT
167 COMMON / srmnamc / srnamt
170 DATA iseed / 1988, 1989, 1990, 1991 /
176 eps = slamch(
'Epsilon' )
182 ALLOCATE ( a(m,n), af(m,n), q(l,l), r(m,l), rwork(l),
189 CALL slarnv( 2, iseed, m, a( 1, j ) )
194 CALL slarnv( 2, iseed, m/2, a( m/4, j ) )
198 CALL slacpy(
'Full', m, n, a, m, af, m )
202 nrb = max( 1, ceiling( real( m - n ) / real( mb1 - n ) ) )
204 ALLOCATE ( t1( nb1, n * nrb ) )
205 ALLOCATE ( t2( nb2, n ) )
206 ALLOCATE ( diag( n ) )
212 nb2_ub = min( nb2, n)
214 CALL sgetsqrhrt( m, n, mb1, nb1, nb2, af, m, t2, nb2,
215 $ workquery, -1, info )
217 lwork = int( workquery( 1 ) )
222 lwork = max( lwork, nb2_ub * n, nb2_ub * m )
224 ALLOCATE ( work( lwork ) )
233 srnamt =
'SGETSQRHRT'
234 CALL sgetsqrhrt( m, n, mb1, nb1, nb2, af, m, t2, nb2,
235 $ work, lwork, info )
242 CALL slaset(
'Full', m, m, zero, one, q, m )
245 CALL sgemqrt(
'L',
'N', m, m, k, nb2_ub, af, m, t2, nb2, q, m,
250 CALL slaset(
'Full', m, n, zero, zero, r, m )
252 CALL slacpy(
'Upper', m, n, af, m, r, m )
257 CALL sgemm(
'T',
'N', m, n, m, -one, q, m, a, m, one, r, m )
259 anorm = slange(
'1', m, n, a, m, rwork )
260 resid = slange(
'1', m, n, r, m, rwork )
261 IF( anorm.GT.zero )
THEN
262 result( 1 ) = resid / ( eps * max( 1, m ) * anorm )
270 CALL slaset(
'Full', m, m, zero, one, r, m )
271 CALL ssyrk(
'U',
'T', m, m, -one, q, m, one, r, m )
272 resid = slansy(
'1',
'Upper', m, r, m, rwork )
273 result( 2 ) = resid / ( eps * max( 1, m ) )
278 CALL slarnv( 2, iseed, m, c( 1, j ) )
280 cnorm = slange(
'1', m, n, c, m, rwork )
281 CALL slacpy(
'Full', m, n, c, m, cf, m )
286 CALL sgemqrt(
'L',
'N', m, n, k, nb2_ub, af, m, t2, nb2, cf, m,
292 CALL sgemm(
'N',
'N', m, n, m, -one, q, m, c, m, one, cf, m )
293 resid = slange(
'1', m, n, cf, m, rwork )
294 IF( cnorm.GT.zero )
THEN
295 result( 3 ) = resid / ( eps * max( 1, m ) * cnorm )
302 CALL slacpy(
'Full', m, n, c, m, cf, m )
307 CALL sgemqrt(
'L',
'T', m, n, k, nb2_ub, af, m, t2, nb2, cf, m,
313 CALL sgemm(
'T',
'N', m, n, m, -one, q, m, c, m, one, cf, m )
314 resid = slange(
'1', m, n, cf, m, rwork )
315 IF( cnorm.GT.zero )
THEN
316 result( 4 ) = resid / ( eps * max( 1, m ) * cnorm )
324 CALL slarnv( 2, iseed, n, d( 1, j ) )
326 dnorm = slange(
'1', n, m, d, n, rwork )
327 CALL slacpy(
'Full', n, m, d, n, df, n )
332 CALL sgemqrt(
'R',
'N', n, m, k, nb2_ub, af, m, t2, nb2, df, n,
338 CALL sgemm(
'N',
'N', n, m, m, -one, d, n, q, m, one, df, n )
339 resid = slange(
'1', n, m, df, n, rwork )
340 IF( dnorm.GT.zero )
THEN
341 result( 5 ) = resid / ( eps * max( 1, m ) * dnorm )
348 CALL slacpy(
'Full', n, m, d, n, df, n )
353 CALL sgemqrt(
'R',
'T', n, m, k, nb2_ub, af, m, t2, nb2, df, n,
359 CALL sgemm(
'N',
'T', n, m, m, -one, d, n, q, m, one, df, n )
360 resid = slange(
'1', n, m, df, n, rwork )
361 IF( dnorm.GT.zero )
THEN
362 result( 6 ) = resid / ( eps * max( 1, m ) * dnorm )
369 DEALLOCATE ( a, af, q, r, rwork, work, t1, t2, diag,
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
subroutine sgemqrt(side, trans, m, n, k, nb, v, ldv, t, ldt, c, ldc, work, info)
SGEMQRT
subroutine sgetsqrhrt(m, n, mb1, nb1, nb2, a, lda, t, ldt, work, lwork, info)
SGETSQRHRT
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 slarnv(idist, iseed, n, x)
SLARNV returns a vector of random numbers from a uniform or normal distribution.
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 sscal(n, sa, sx, incx)
SSCAL
subroutine sorhr_col02(m, n, mb1, nb1, nb2, result)
SORHR_COL02