103 INTEGER nmax, nparams, nerrbnd, ntests, kl, ku
104 parameter(nmax = 6, nparams = 2, nerrbnd = 3,
108 INTEGER n, nrhs, info, i ,j, k, nfail, lda, ldab,
110 CHARACTER fact, trans, uplo, equed
112 CHARACTER(3) nguar, cguar
113 LOGICAL printed_guide
114 REAL ncond, ccond, m, normdif, normt, rcond,
115 $ rnorm, rinorm, sumr, sumri, eps,
116 $ berr(nmax), rpvgrw, orcond,
117 $ cwise_err, nwise_err, cwise_bnd, nwise_bnd,
118 $ cwise_rcond, nwise_rcond,
119 $ condthresh, errthresh
122 REAL tstrat(ntests), rinv(nmax), params(nparams),
123 $ a(nmax, nmax), acopy(nmax, nmax),
124 $ invhilb(nmax, nmax), r(nmax), c(nmax), s(nmax),
125 $ work(nmax * 5), b(nmax, nmax), x(nmax, nmax),
126 $ diff(nmax, nmax), af(nmax, nmax),
127 $ ab( (nmax-1)+(nmax-1)+1, nmax ),
128 $ abcopy( (nmax-1)+(nmax-1)+1, nmax ),
129 $ afb( 2*(nmax-1)+(nmax-1)+1, nmax ),
130 $ errbnd_n(nmax*3), errbnd_c(nmax*3)
131 INTEGER iwork(nmax), ipiv(nmax)
142 INTRINSIC sqrt, max, abs
145 INTEGER nwise_i, cwise_i
146 parameter(nwise_i = 1, cwise_i = 1)
147 INTEGER bnd_i, cond_i
148 parameter(bnd_i = 2, cond_i = 3)
160 ldab = (nmax-1)+(nmax-1)+1
161 ldafb = 2*(nmax-1)+(nmax-1)+1
166 printed_guide = .false.
175 m = max(sqrt(
REAL(n)), 10.0)
179 CALL
slahilb(n, n, a, lda, invhilb, lda, b, lda, work, info)
182 CALL
slacpy(
'ALL', n, n, a, nmax, acopy, nmax)
191 DO i = max( 1, j-ku ), min( n, j+kl )
192 ab( ku+1+i-j, j ) = a( i, j )
199 abcopy( i, j ) = 0.0e+0
202 CALL
slacpy(
'ALL', kl+ku+1, n, ab, ldab, abcopy, ldab)
205 IF (
lsamen( 2, c2,
'SY' ) )
THEN
206 CALL
ssysvxx(fact, uplo, n, nrhs, acopy, lda, af, lda,
207 $ ipiv, equed, s, b, lda, x, lda, orcond,
208 $ rpvgrw, berr, nerrbnd, errbnd_n, errbnd_c, nparams,
209 $ params, work, iwork, info)
210 ELSE IF (
lsamen( 2, c2,
'PO' ) )
THEN
211 CALL
sposvxx(fact, uplo, n, nrhs, acopy, lda, af, lda,
212 $ equed, s, b, lda, x, lda, orcond,
213 $ rpvgrw, berr, nerrbnd, errbnd_n, errbnd_c, nparams,
214 $ params, work, iwork, info)
215 ELSE IF (
lsamen( 2, c2,
'GB' ) )
THEN
216 CALL
sgbsvxx(fact, trans, n, kl, ku, nrhs, abcopy,
217 $ ldab, afb, ldafb, ipiv, equed, r, c, b,
218 $ lda, x, lda, orcond, rpvgrw, berr, nerrbnd,
219 $ errbnd_n, errbnd_c, nparams, params, work, iwork,
222 CALL
sgesvxx(fact, trans, n, nrhs, acopy, lda, af, lda,
223 $ ipiv, equed, r, c, b, lda, x, lda, orcond,
224 $ rpvgrw, berr, nerrbnd, errbnd_n, errbnd_c, nparams,
225 $ params, work, iwork, info)
228 n_aux_tests = n_aux_tests + 1
229 IF (orcond .LT. eps)
THEN
239 IF (info .GT. 0 .AND. info .LE. n+1)
THEN
241 WRITE (*, fmt=8000) c2, n, info, orcond, rcond
248 diff( i, j ) = x( i, j ) - invhilb( i, j )
255 IF (
lsamen( 2, c2,
'PO' ) .OR.
lsamen( 2, c2,
'SY' ) )
THEN
260 sumr = sumr + abs(s(i) * a(i,j) * s(j))
261 sumri = sumri + abs(invhilb(i, j) / s(j) / s(i))
263 rnorm = max(rnorm,sumr)
264 rinorm = max(rinorm,sumri)
266 ELSE IF (
lsamen( 2, c2,
'GE' ) .OR.
lsamen( 2, c2,
'GB' ) )
272 sumr = sumr + abs(r(i) * a(i,j) * c(j))
273 sumri = sumri + abs(invhilb(i, j) / r(j) / c(i))
275 rnorm = max(rnorm,sumr)
276 rinorm = max(rinorm,sumri)
280 rnorm = rnorm / a(1, 1)
281 rcond = 1.0/(rnorm * rinorm)
289 rinv(i) = rinv(i) + abs(a(i,j))
298 sumri = sumri + abs(invhilb(i,j) * rinv(j))
300 rinorm = max(rinorm, sumri)
305 ncond = a(1,1) / rinorm
315 normt = max(abs(invhilb(i, k)), normt)
316 normdif = max(abs(x(i,k) - invhilb(i,k)), normdif)
317 IF (invhilb(i,k) .NE. 0.0)
THEN
318 cwise_err = max(abs(x(i,k) - invhilb(i,k))
319 $ /abs(invhilb(i,k)), cwise_err)
320 ELSE IF (x(i, k) .NE. 0.0)
THEN
321 cwise_err =
slamch(
'OVERFLOW')
324 IF (normt .NE. 0.0)
THEN
325 nwise_err = normdif / normt
326 ELSE IF (normdif .NE. 0.0)
THEN
327 nwise_err =
slamch(
'OVERFLOW')
337 rinv(i) = rinv(i) + abs(a(i, j) * invhilb(j, k))
345 $ + abs(invhilb(i, j) * rinv(j) / invhilb(i, k))
347 rinorm = max(rinorm, sumri)
351 ccond = a(1,1)/rinorm
354 nwise_bnd = errbnd_n(k + (bnd_i-1)*nrhs)
355 cwise_bnd = errbnd_c(k + (bnd_i-1)*nrhs)
356 nwise_rcond = errbnd_n(k + (cond_i-1)*nrhs)
357 cwise_rcond = errbnd_c(k + (cond_i-1)*nrhs)
362 IF (ncond .GE. condthresh)
THEN
364 IF (nwise_bnd .GT. errthresh)
THEN
365 tstrat(1) = 1/(2.0*eps)
368 IF (nwise_bnd .NE. 0.0)
THEN
369 tstrat(1) = nwise_err / nwise_bnd
370 ELSE IF (nwise_err .NE. 0.0)
THEN
371 tstrat(1) = 1/(16.0*eps)
375 IF (tstrat(1) .GT. 1.0)
THEN
376 tstrat(1) = 1/(4.0*eps)
381 IF (nwise_bnd .LT. 1.0)
THEN
382 tstrat(1) = 1/(8.0*eps)
390 IF (ccond .GE. condthresh)
THEN
393 IF (cwise_bnd .GT. errthresh)
THEN
394 tstrat(2) = 1/(2.0*eps)
396 IF (cwise_bnd .NE. 0.0)
THEN
397 tstrat(2) = cwise_err / cwise_bnd
398 ELSE IF (cwise_err .NE. 0.0)
THEN
399 tstrat(2) = 1/(16.0*eps)
403 IF (tstrat(2) .GT. 1.0) tstrat(2) = 1/(4.0*eps)
407 IF (cwise_bnd .LT. 1.0)
THEN
408 tstrat(2) = 1/(8.0*eps)
415 tstrat(3) = berr(k)/eps
418 tstrat(4) = rcond / orcond
419 IF (rcond .GE. condthresh .AND. tstrat(4) .LT. 1.0)
420 $ tstrat(4) = 1.0 / tstrat(4)
422 tstrat(5) = ncond / nwise_rcond
423 IF (ncond .GE. condthresh .AND. tstrat(5) .LT. 1.0)
424 $ tstrat(5) = 1.0 / tstrat(5)
426 tstrat(6) = ccond / nwise_rcond
427 IF (ccond .GE. condthresh .AND. tstrat(6) .LT. 1.0)
428 $ tstrat(6) = 1.0 / tstrat(6)
431 IF (tstrat(i) .GT. thresh)
THEN
432 IF (.NOT.printed_guide)
THEN
443 printed_guide = .true.
445 WRITE( *, 9999) c2, n, k, nguar, cguar, i, tstrat(i)
468 IF( nfail .GT. 0 )
THEN
469 WRITE(*,9998) c2, nfail, ntests*n+n_aux_tests
473 9999 format(
' S', a2,
'SVXX: N =', i2,
', RHS = ', i2,
474 $
', NWISE GUAR. = ', a,
', CWISE GUAR. = ', a,
475 $
' test(',i1,
') =', g12.5 )
476 9998 format(
' S', a2,
'SVXX: ', i6,
' out of ', i6,
477 $
' tests failed to pass the threshold' )
478 9997 format(
' S', a2,
'SVXX passed the tests of error bounds' )
480 9996 format( 3x, i2,
': Normwise guaranteed forward error', / 5x,
481 $
'Guaranteed case: if norm ( abs( Xc - Xt )',
482 $ .LE.
' / norm ( Xt ) ERRBND( *, nwise_i, bnd_i ), then',
484 $ .LE.
'ERRBND( *, nwise_i, bnd_i ) MAX(SQRT(N), 10) * EPS')
485 9995 format( 3x, i2,
': Componentwise guaranteed forward error' )
486 9994 format( 3x, i2,
': Backwards error' )
487 9993 format( 3x, i2,
': Reciprocal condition number' )
488 9992 format( 3x, i2,
': Reciprocal normwise condition number' )
489 9991 format( 3x, i2,
': Raw normwise error estimate' )
490 9990 format( 3x, i2,
': Reciprocal componentwise condition number' )
491 9989 format( 3x, i2,
': Raw componentwise error estimate' )
493 8000 format(
' S', a2,
'SVXX: N =', i2,
', INFO = ', i3,
494 $
', ORCOND = ', g12.5,
', real RCOND = ', g12.5 )