140
141
142
143
144
145
146 LOGICAL TSTERR
147 INTEGER NN, NOUT, NRHS
148 REAL THRESH
149
150
151 LOGICAL DOTYPE( * )
152 INTEGER NVAL( * )
153 REAL A( * ), B( * ), D( * ), E( * ), RWORK( * ),
154 $ WORK( * ), X( * ), XACT( * )
155
156
157
158
159
160 REAL ONE, ZERO
161 parameter( one = 1.0e+0, zero = 0.0e+0 )
162 INTEGER NTYPES
163 parameter( ntypes = 12 )
164 INTEGER NTESTS
165 parameter( ntests = 6 )
166
167
168 LOGICAL ZEROT
169 CHARACTER DIST, FACT, TYPE
170 CHARACTER*3 PATH
171 INTEGER I, IA, IFACT, IMAT, IN, INFO, IX, IZERO, J, K,
172 $ K1, KL, KU, LDA, MODE, N, NERRS, NFAIL, NIMAT,
173 $ NRUN, NT
174 REAL AINVNM, ANORM, COND, DMAX, RCOND, RCONDC
175
176
177 INTEGER ISEED( 4 ), ISEEDY( 4 )
178 REAL RESULT( NTESTS ), Z( 3 )
179
180
181 INTEGER ISAMAX
182 REAL SASUM, SGET06, SLANST
184
185
190
191
192 INTRINSIC abs, max
193
194
195 LOGICAL LERR, OK
196 CHARACTER*32 SRNAMT
197 INTEGER INFOT, NUNIT
198
199
200 COMMON / infoc / infot, nunit, ok, lerr
201 COMMON / srnamc / srnamt
202
203
204 DATA iseedy / 0, 0, 0, 1 /
205
206
207
208 path( 1: 1 ) = 'Single precision'
209 path( 2: 3 ) = 'PT'
210 nrun = 0
211 nfail = 0
212 nerrs = 0
213 DO 10 i = 1, 4
214 iseed( i ) = iseedy( i )
215 10 CONTINUE
216
217
218
219 IF( tsterr )
220 $
CALL serrvx( path, nout )
221 infot = 0
222
223 DO 120 in = 1, nn
224
225
226
227 n = nval( in )
228 lda = max( 1, n )
229 nimat = ntypes
230 IF( n.LE.0 )
231 $ nimat = 1
232
233 DO 110 imat = 1, nimat
234
235
236
237 IF( n.GT.0 .AND. .NOT.dotype( imat ) )
238 $ GO TO 110
239
240
241
242 CALL slatb4( path, imat, n, n,
TYPE, KL, KU, ANORM, MODE,
243 $ COND, DIST )
244
245 zerot = imat.GE.8 .AND. imat.LE.10
246 IF( imat.LE.6 ) THEN
247
248
249
250
251 srnamt = 'SLATMS'
252 CALL slatms( n, n, dist, iseed,
TYPE, RWORK, MODE, COND,
253 $ ANORM, KL, KU, 'B', A, 2, WORK, INFO )
254
255
256
257 IF( info.NE.0 ) THEN
258 CALL alaerh( path,
'SLATMS', info, 0,
' ', n, n, kl,
259 $ ku, -1, imat, nfail, nerrs, nout )
260 GO TO 110
261 END IF
262 izero = 0
263
264
265
266 ia = 1
267 DO 20 i = 1, n - 1
268 d( i ) = a( ia )
269 e( i ) = a( ia+1 )
270 ia = ia + 2
271 20 CONTINUE
272 IF( n.GT.0 )
273 $ d( n ) = a( ia )
274 ELSE
275
276
277
278
279 IF( .NOT.zerot .OR. .NOT.dotype( 7 ) ) THEN
280
281
282
283 CALL slarnv( 2, iseed, n, d )
284 CALL slarnv( 2, iseed, n-1, e )
285
286
287
288 IF( n.EQ.1 ) THEN
289 d( 1 ) = abs( d( 1 ) )
290 ELSE
291 d( 1 ) = abs( d( 1 ) ) + abs( e( 1 ) )
292 d( n ) = abs( d( n ) ) + abs( e( n-1 ) )
293 DO 30 i = 2, n - 1
294 d( i ) = abs( d( i ) ) + abs( e( i ) ) +
295 $ abs( e( i-1 ) )
296 30 CONTINUE
297 END IF
298
299
300
302 dmax = d( ix )
303 CALL sscal( n, anorm / dmax, d, 1 )
304 IF( n.GT.1 )
305 $
CALL sscal( n-1, anorm / dmax, e, 1 )
306
307 ELSE IF( izero.GT.0 ) THEN
308
309
310
311
312 IF( izero.EQ.1 ) THEN
313 d( 1 ) = z( 2 )
314 IF( n.GT.1 )
315 $ e( 1 ) = z( 3 )
316 ELSE IF( izero.EQ.n ) THEN
317 e( n-1 ) = z( 1 )
318 d( n ) = z( 2 )
319 ELSE
320 e( izero-1 ) = z( 1 )
321 d( izero ) = z( 2 )
322 e( izero ) = z( 3 )
323 END IF
324 END IF
325
326
327
328
329 izero = 0
330 IF( imat.EQ.8 ) THEN
331 izero = 1
332 z( 2 ) = d( 1 )
333 d( 1 ) = zero
334 IF( n.GT.1 ) THEN
335 z( 3 ) = e( 1 )
336 e( 1 ) = zero
337 END IF
338 ELSE IF( imat.EQ.9 ) THEN
339 izero = n
340 IF( n.GT.1 ) THEN
341 z( 1 ) = e( n-1 )
342 e( n-1 ) = zero
343 END IF
344 z( 2 ) = d( n )
345 d( n ) = zero
346 ELSE IF( imat.EQ.10 ) THEN
347 izero = ( n+1 ) / 2
348 IF( izero.GT.1 ) THEN
349 z( 1 ) = e( izero-1 )
350 z( 3 ) = e( izero )
351 e( izero-1 ) = zero
352 e( izero ) = zero
353 END IF
354 z( 2 ) = d( izero )
355 d( izero ) = zero
356 END IF
357 END IF
358
359
360
361 ix = 1
362 DO 40 j = 1, nrhs
363 CALL slarnv( 2, iseed, n, xact( ix ) )
364 ix = ix + lda
365 40 CONTINUE
366
367
368
369 CALL slaptm( n, nrhs, one, d, e, xact, lda, zero, b, lda )
370
371 DO 100 ifact = 1, 2
372 IF( ifact.EQ.1 ) THEN
373 fact = 'F'
374 ELSE
375 fact = 'N'
376 END IF
377
378
379
380
381 IF( zerot ) THEN
382 IF( ifact.EQ.1 )
383 $ GO TO 100
384 rcondc = zero
385
386 ELSE IF( ifact.EQ.1 ) THEN
387
388
389
390 anorm =
slanst(
'1', n, d, e )
391
392 CALL scopy( n, d, 1, d( n+1 ), 1 )
393 IF( n.GT.1 )
394 $
CALL scopy( n-1, e, 1, e( n+1 ), 1 )
395
396
397
398 CALL spttrf( n, d( n+1 ), e( n+1 ), info )
399
400
401
402
403 ainvnm = zero
404 DO 60 i = 1, n
405 DO 50 j = 1, n
406 x( j ) = zero
407 50 CONTINUE
408 x( i ) = one
409 CALL spttrs( n, 1, d( n+1 ), e( n+1 ), x, lda,
410 $ info )
411 ainvnm = max( ainvnm,
sasum( n, x, 1 ) )
412 60 CONTINUE
413
414
415
416 IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
417 rcondc = one
418 ELSE
419 rcondc = ( one / anorm ) / ainvnm
420 END IF
421 END IF
422
423 IF( ifact.EQ.2 ) THEN
424
425
426
427 CALL scopy( n, d, 1, d( n+1 ), 1 )
428 IF( n.GT.1 )
429 $
CALL scopy( n-1, e, 1, e( n+1 ), 1 )
430 CALL slacpy(
'Full', n, nrhs, b, lda, x, lda )
431
432
433
434 srnamt = 'SPTSV '
435 CALL sptsv( n, nrhs, d( n+1 ), e( n+1 ), x, lda,
436 $ info )
437
438
439
440 IF( info.NE.izero )
441 $
CALL alaerh( path,
'SPTSV ', info, izero,
' ', n,
442 $ n, 1, 1, nrhs, imat, nfail, nerrs,
443 $ nout )
444 nt = 0
445 IF( izero.EQ.0 ) THEN
446
447
448
449
450 CALL sptt01( n, d, e, d( n+1 ), e( n+1 ), work,
451 $ result( 1 ) )
452
453
454
455 CALL slacpy(
'Full', n, nrhs, b, lda, work, lda )
456 CALL sptt02( n, nrhs, d, e, x, lda, work, lda,
457 $ result( 2 ) )
458
459
460
461 CALL sget04( n, nrhs, x, lda, xact, lda, rcondc,
462 $ result( 3 ) )
463 nt = 3
464 END IF
465
466
467
468
469 DO 70 k = 1, nt
470 IF( result( k ).GE.thresh ) THEN
471 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
472 $
CALL aladhd( nout, path )
473 WRITE( nout, fmt = 9999 )'SPTSV ', n, imat, k,
474 $ result( k )
475 nfail = nfail + 1
476 END IF
477 70 CONTINUE
478 nrun = nrun + nt
479 END IF
480
481
482
483 IF( ifact.GT.1 ) THEN
484
485
486
487 DO 80 i = 1, n - 1
488 d( n+i ) = zero
489 e( n+i ) = zero
490 80 CONTINUE
491 IF( n.GT.0 )
492 $ d( n+n ) = zero
493 END IF
494
495 CALL slaset(
'Full', n, nrhs, zero, zero, x, lda )
496
497
498
499
500 srnamt = 'SPTSVX'
501 CALL sptsvx( fact, n, nrhs, d, e, d( n+1 ), e( n+1 ), b,
502 $ lda, x, lda, rcond, rwork, rwork( nrhs+1 ),
503 $ work, info )
504
505
506
507 IF( info.NE.izero )
508 $
CALL alaerh( path,
'SPTSVX', info, izero, fact, n, n,
509 $ 1, 1, nrhs, imat, nfail, nerrs, nout )
510 IF( izero.EQ.0 ) THEN
511 IF( ifact.EQ.2 ) THEN
512
513
514
515
516 k1 = 1
517 CALL sptt01( n, d, e, d( n+1 ), e( n+1 ), work,
518 $ result( 1 ) )
519 ELSE
520 k1 = 2
521 END IF
522
523
524
525 CALL slacpy(
'Full', n, nrhs, b, lda, work, lda )
526 CALL sptt02( n, nrhs, d, e, x, lda, work, lda,
527 $ result( 2 ) )
528
529
530
531 CALL sget04( n, nrhs, x, lda, xact, lda, rcondc,
532 $ result( 3 ) )
533
534
535
536 CALL sptt05( n, nrhs, d, e, b, lda, x, lda, xact, lda,
537 $ rwork, rwork( nrhs+1 ), result( 4 ) )
538 ELSE
539 k1 = 6
540 END IF
541
542
543
544 result( 6 ) =
sget06( rcond, rcondc )
545
546
547
548
549 DO 90 k = k1, 6
550 IF( result( k ).GE.thresh ) THEN
551 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
552 $
CALL aladhd( nout, path )
553 WRITE( nout, fmt = 9998 )'SPTSVX', fact, n, imat,
554 $ k, result( k )
555 nfail = nfail + 1
556 END IF
557 90 CONTINUE
558 nrun = nrun + 7 - k1
559 100 CONTINUE
560 110 CONTINUE
561 120 CONTINUE
562
563
564
565 CALL alasvm( path, nout, nfail, nrun, nerrs )
566
567 9999 FORMAT( 1x, a, ', N =', i5, ', type ', i2, ', test ', i2,
568 $ ', ratio = ', g12.5 )
569 9998 FORMAT( 1x, a, ', FACT=''', a1, ''', N =', i5, ', type ', i2,
570 $ ', test ', i2, ', ratio = ', g12.5 )
571 RETURN
572
573
574
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine aladhd(iounit, path)
ALADHD
subroutine alaerh(path, subnam, info, infoe, opts, m, n, kl, ku, n5, imat, nfail, nerrs, nout)
ALAERH
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 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 sptsv(n, nrhs, d, e, b, ldb, info)
SPTSV computes the solution to system of linear equations A * X = B for PT matrices
subroutine sptsvx(fact, n, nrhs, d, e, df, ef, b, ldb, x, ldx, rcond, ferr, berr, work, info)
SPTSVX computes the solution to system of linear equations A * X = B for PT matrices
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 serrvx(path, nunit)
SERRVX
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