146
147
148
149
150
151
152 LOGICAL TSTERR
153 INTEGER NN, NNS, NOUT
154 REAL THRESH
155
156
157 LOGICAL DOTYPE( * )
158 INTEGER NSVAL( * ), NVAL( * )
159 REAL A( * ), B( * ), D( * ), E( * ), RWORK( * ),
160 $ WORK( * ), X( * ), XACT( * )
161
162
163
164
165
166 REAL ONE, ZERO
167 parameter( one = 1.0e+0, zero = 0.0e+0 )
168 INTEGER NTYPES
169 parameter( ntypes = 12 )
170 INTEGER NTESTS
171 parameter( ntests = 7 )
172
173
174 LOGICAL ZEROT
175 CHARACTER DIST, TYPE
176 CHARACTER*3 PATH
177 INTEGER I, IA, IMAT, IN, INFO, IRHS, IX, IZERO, J, K,
178 $ KL, KU, LDA, MODE, N, NERRS, NFAIL, NIMAT,
179 $ NRHS, NRUN
180 REAL AINVNM, ANORM, COND, DMAX, RCOND, RCONDC
181
182
183 INTEGER ISEED( 4 ), ISEEDY( 4 )
184 REAL RESULT( NTESTS ), Z( 3 )
185
186
187 INTEGER ISAMAX
188 REAL SASUM, SGET06, SLANST
190
191
196
197
198 INTRINSIC abs, max
199
200
201 LOGICAL LERR, OK
202 CHARACTER*32 SRNAMT
203 INTEGER INFOT, NUNIT
204
205
206 COMMON / infoc / infot, nunit, ok, lerr
207 COMMON / srnamc / srnamt
208
209
210 DATA iseedy / 0, 0, 0, 1 /
211
212
213
214 path( 1: 1 ) = 'Single precision'
215 path( 2: 3 ) = 'PT'
216 nrun = 0
217 nfail = 0
218 nerrs = 0
219 DO 10 i = 1, 4
220 iseed( i ) = iseedy( i )
221 10 CONTINUE
222
223
224
225 IF( tsterr )
226 $
CALL serrgt( path, nout )
227 infot = 0
228
229 DO 110 in = 1, nn
230
231
232
233 n = nval( in )
234 lda = max( 1, n )
235 nimat = ntypes
236 IF( n.LE.0 )
237 $ nimat = 1
238
239 DO 100 imat = 1, nimat
240
241
242
243 IF( n.GT.0 .AND. .NOT.dotype( imat ) )
244 $ GO TO 100
245
246
247
248 CALL slatb4( path, imat, n, n,
TYPE, KL, KU, ANORM, MODE,
249 $ COND, DIST )
250
251 zerot = imat.GE.8 .AND. imat.LE.10
252 IF( imat.LE.6 ) THEN
253
254
255
256
257 srnamt = 'SLATMS'
258 CALL slatms( n, n, dist, iseed,
TYPE, RWORK, MODE, COND,
259 $ ANORM, KL, KU, 'B', A, 2, WORK, INFO )
260
261
262
263 IF( info.NE.0 ) THEN
264 CALL alaerh( path,
'SLATMS', info, 0,
' ', n, n, kl,
265 $ ku, -1, imat, nfail, nerrs, nout )
266 GO TO 100
267 END IF
268 izero = 0
269
270
271
272 ia = 1
273 DO 20 i = 1, n - 1
274 d( i ) = a( ia )
275 e( i ) = a( ia+1 )
276 ia = ia + 2
277 20 CONTINUE
278 IF( n.GT.0 )
279 $ d( n ) = a( ia )
280 ELSE
281
282
283
284
285 IF( .NOT.zerot .OR. .NOT.dotype( 7 ) ) THEN
286
287
288
289 CALL slarnv( 2, iseed, n, d )
290 CALL slarnv( 2, iseed, n-1, e )
291
292
293
294 IF( n.EQ.1 ) THEN
295 d( 1 ) = abs( d( 1 ) )
296 ELSE
297 d( 1 ) = abs( d( 1 ) ) + abs( e( 1 ) )
298 d( n ) = abs( d( n ) ) + abs( e( n-1 ) )
299 DO 30 i = 2, n - 1
300 d( i ) = abs( d( i ) ) + abs( e( i ) ) +
301 $ abs( e( i-1 ) )
302 30 CONTINUE
303 END IF
304
305
306
308 dmax = d( ix )
309 CALL sscal( n, anorm / dmax, d, 1 )
310 CALL sscal( n-1, anorm / dmax, e, 1 )
311
312 ELSE IF( izero.GT.0 ) THEN
313
314
315
316
317 IF( izero.EQ.1 ) THEN
318 d( 1 ) = z( 2 )
319 IF( n.GT.1 )
320 $ e( 1 ) = z( 3 )
321 ELSE IF( izero.EQ.n ) THEN
322 e( n-1 ) = z( 1 )
323 d( n ) = z( 2 )
324 ELSE
325 e( izero-1 ) = z( 1 )
326 d( izero ) = z( 2 )
327 e( izero ) = z( 3 )
328 END IF
329 END IF
330
331
332
333
334 izero = 0
335 IF( imat.EQ.8 ) THEN
336 izero = 1
337 z( 2 ) = d( 1 )
338 d( 1 ) = zero
339 IF( n.GT.1 ) THEN
340 z( 3 ) = e( 1 )
341 e( 1 ) = zero
342 END IF
343 ELSE IF( imat.EQ.9 ) THEN
344 izero = n
345 IF( n.GT.1 ) THEN
346 z( 1 ) = e( n-1 )
347 e( n-1 ) = zero
348 END IF
349 z( 2 ) = d( n )
350 d( n ) = zero
351 ELSE IF( imat.EQ.10 ) THEN
352 izero = ( n+1 ) / 2
353 IF( izero.GT.1 ) THEN
354 z( 1 ) = e( izero-1 )
355 e( izero-1 ) = zero
356 z( 3 ) = e( izero )
357 e( izero ) = zero
358 END IF
359 z( 2 ) = d( izero )
360 d( izero ) = zero
361 END IF
362 END IF
363
364 CALL scopy( n, d, 1, d( n+1 ), 1 )
365 IF( n.GT.1 )
366 $
CALL scopy( n-1, e, 1, e( n+1 ), 1 )
367
368
369
370
371
372 CALL spttrf( n, d( n+1 ), e( n+1 ), info )
373
374
375
376 IF( info.NE.izero ) THEN
377 CALL alaerh( path,
'SPTTRF', info, izero,
' ', n, n, -1,
378 $ -1, -1, imat, nfail, nerrs, nout )
379 GO TO 100
380 END IF
381
382 IF( info.GT.0 ) THEN
383 rcondc = zero
384 GO TO 90
385 END IF
386
387 CALL sptt01( n, d, e, d( n+1 ), e( n+1 ), work,
388 $ result( 1 ) )
389
390
391
392 IF( result( 1 ).GE.thresh ) THEN
393 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
394 $
CALL alahd( nout, path )
395 WRITE( nout, fmt = 9999 )n, imat, 1, result( 1 )
396 nfail = nfail + 1
397 END IF
398 nrun = nrun + 1
399
400
401
402
403
404 anorm =
slanst(
'1', n, d, e )
405
406
407
408
409 ainvnm = zero
410 DO 50 i = 1, n
411 DO 40 j = 1, n
412 x( j ) = zero
413 40 CONTINUE
414 x( i ) = one
415 CALL spttrs( n, 1, d( n+1 ), e( n+1 ), x, lda, info )
416 ainvnm = max( ainvnm,
sasum( n, x, 1 ) )
417 50 CONTINUE
418 rcondc = one / max( one, anorm*ainvnm )
419
420 DO 80 irhs = 1, nns
421 nrhs = nsval( irhs )
422
423
424
425 ix = 1
426 DO 60 j = 1, nrhs
427 CALL slarnv( 2, iseed, n, xact( ix ) )
428 ix = ix + lda
429 60 CONTINUE
430
431
432
433 CALL slaptm( n, nrhs, one, d, e, xact, lda, zero, b,
434 $ lda )
435
436
437
438
439 CALL slacpy(
'Full', n, nrhs, b, lda, x, lda )
440 CALL spttrs( n, nrhs, d( n+1 ), e( n+1 ), x, lda, info )
441
442
443
444 IF( info.NE.0 )
445 $
CALL alaerh( path,
'SPTTRS', info, 0,
' ', n, n, -1,
446 $ -1, nrhs, imat, nfail, nerrs, nout )
447
448 CALL slacpy(
'Full', n, nrhs, b, lda, work, lda )
449 CALL sptt02( n, nrhs, d, e, x, lda, work, lda,
450 $ result( 2 ) )
451
452
453
454
455 CALL sget04( n, nrhs, x, lda, xact, lda, rcondc,
456 $ result( 3 ) )
457
458
459
460
461 srnamt = 'SPTRFS'
462 CALL sptrfs( n, nrhs, d, e, d( n+1 ), e( n+1 ), b, lda,
463 $ x, lda, rwork, rwork( nrhs+1 ), work, info )
464
465
466
467 IF( info.NE.0 )
468 $
CALL alaerh( path,
'SPTRFS', info, 0,
' ', n, n, -1,
469 $ -1, nrhs, imat, nfail, nerrs, nout )
470
471 CALL sget04( n, nrhs, x, lda, xact, lda, rcondc,
472 $ result( 4 ) )
473 CALL sptt05( n, nrhs, d, e, b, lda, x, lda, xact, lda,
474 $ rwork, rwork( nrhs+1 ), result( 5 ) )
475
476
477
478
479 DO 70 k = 2, 6
480 IF( result( k ).GE.thresh ) THEN
481 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
482 $
CALL alahd( nout, path )
483 WRITE( nout, fmt = 9998 )n, nrhs, imat, k,
484 $ result( k )
485 nfail = nfail + 1
486 END IF
487 70 CONTINUE
488 nrun = nrun + 5
489 80 CONTINUE
490
491
492
493
494
495 90 CONTINUE
496 srnamt = 'SPTCON'
497 CALL sptcon( n, d( n+1 ), e( n+1 ), anorm, rcond, rwork,
498 $ info )
499
500
501
502 IF( info.NE.0 )
503 $
CALL alaerh( path,
'SPTCON', info, 0,
' ', n, n, -1, -1,
504 $ -1, imat, nfail, nerrs, nout )
505
506 result( 7 ) =
sget06( rcond, rcondc )
507
508
509
510 IF( result( 7 ).GE.thresh ) THEN
511 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
512 $
CALL alahd( nout, path )
513 WRITE( nout, fmt = 9999 )n, imat, 7, result( 7 )
514 nfail = nfail + 1
515 END IF
516 nrun = nrun + 1
517 100 CONTINUE
518 110 CONTINUE
519
520
521
522 CALL alasum( path, nout, nfail, nrun, nerrs )
523
524 9999 FORMAT( ' N =', i5, ', type ', i2, ', test ', i2, ', ratio = ',
525 $ g12.5 )
526 9998 FORMAT( ' N =', i5, ', NRHS=', i3, ', type ', i2, ', test(', i2,
527 $ ') = ', g12.5 )
528 RETURN
529
530
531
subroutine alasum(type, nout, nfail, nrun, nerrs)
ALASUM
subroutine alaerh(path, subnam, info, infoe, opts, m, n, kl, ku, n5, imat, nfail, nerrs, nout)
ALAERH
subroutine alahd(iounit, path)
ALAHD
real function sasum(n, sx, incx)
SASUM
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
integer function isamax(n, sx, incx)
ISAMAX
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
real function slanst(norm, n, d, e)
SLANST returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
subroutine slarnv(idist, iseed, n, x)
SLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine sptcon(n, d, e, anorm, rcond, work, info)
SPTCON
subroutine sptrfs(n, nrhs, d, e, df, ef, b, ldb, x, ldx, ferr, berr, work, info)
SPTRFS
subroutine spttrf(n, d, e, info)
SPTTRF
subroutine spttrs(n, nrhs, d, e, b, ldb, info)
SPTTRS
subroutine sscal(n, sa, sx, incx)
SSCAL
subroutine serrgt(path, nunit)
SERRGT
subroutine sget04(n, nrhs, x, ldx, xact, ldxact, rcond, resid)
SGET04
real function sget06(rcond, rcondc)
SGET06
subroutine slaptm(n, nrhs, alpha, d, e, x, ldx, beta, b, ldb)
SLAPTM
subroutine slatb4(path, imat, m, n, type, kl, ku, anorm, mode, cndnum, dist)
SLATB4
subroutine slatms(m, n, dist, iseed, sym, d, mode, cond, dmax, kl, ku, pack, a, lda, work, info)
SLATMS
subroutine sptt01(n, d, e, df, ef, work, resid)
SPTT01
subroutine sptt02(n, nrhs, d, e, x, ldx, b, ldb, resid)
SPTT02
subroutine sptt05(n, nrhs, d, e, b, ldb, x, ldx, xact, ldxact, ferr, berr, reslts)
SPTT05