167
168
169
170
171
172
173 LOGICAL TSTERR
174 INTEGER NMAX, NN, NOUT, NRHS
175 REAL THRESH
176
177
178 LOGICAL DOTYPE( * )
179 INTEGER IWORK( * ), NVAL( * )
180 REAL A( * ), AFAC( * ), ASAV( * ), B( * ),
181 $ BSAV( * ), RWORK( * ), S( * ), WORK( * ),
182 $ X( * ), XACT( * )
183
184
185
186
187
188 REAL ONE, ZERO
189 parameter( one = 1.0e+0, zero = 0.0e+0 )
190 INTEGER NTYPES
191 parameter( ntypes = 9 )
192 INTEGER NTESTS
193 parameter( ntests = 6 )
194
195
196 LOGICAL EQUIL, NOFACT, PREFAC, ZEROT
197 CHARACTER DIST, EQUED, FACT, PACKIT, TYPE, UPLO, XTYPE
198 CHARACTER*3 PATH
199 INTEGER I, IEQUED, IFACT, IMAT, IN, INFO, IOFF, IUPLO,
200 $ IZERO, K, K1, KL, KU, LDA, MODE, N, NERRS,
201 $ NFACT, NFAIL, NIMAT, NPP, NRUN, NT
202 REAL AINVNM, AMAX, ANORM, CNDNUM, RCOND, RCONDC,
203 $ ROLDC, SCOND
204
205
206 CHARACTER EQUEDS( 2 ), FACTS( 3 ), PACKS( 2 ), UPLOS( 2 )
207 INTEGER ISEED( 4 ), ISEEDY( 4 )
208 REAL RESULT( NTESTS )
209
210
211 LOGICAL LSAME
212 REAL SGET06, SLANSP
214
215
220
221
222 LOGICAL LERR, OK
223 CHARACTER*32 SRNAMT
224 INTEGER INFOT, NUNIT
225
226
227 COMMON / infoc / infot, nunit, ok, lerr
228 COMMON / srnamc / srnamt
229
230
231 INTRINSIC max
232
233
234 DATA iseedy / 1988, 1989, 1990, 1991 /
235 DATA uplos / 'U', 'L' / , facts / 'F', 'N', 'E' / ,
236 $ packs / 'C', 'R' / , equeds / 'N', 'Y' /
237
238
239
240
241
242 path( 1: 1 ) = 'Single precision'
243 path( 2: 3 ) = 'PP'
244 nrun = 0
245 nfail = 0
246 nerrs = 0
247 DO 10 i = 1, 4
248 iseed( i ) = iseedy( i )
249 10 CONTINUE
250
251
252
253 IF( tsterr )
254 $
CALL serrvx( path, nout )
255 infot = 0
256
257
258
259 DO 140 in = 1, nn
260 n = nval( in )
261 lda = max( n, 1 )
262 npp = n*( n+1 ) / 2
263 xtype = 'N'
264 nimat = ntypes
265 IF( n.LE.0 )
266 $ nimat = 1
267
268 DO 130 imat = 1, nimat
269
270
271
272 IF( .NOT.dotype( imat ) )
273 $ GO TO 130
274
275
276
277 zerot = imat.GE.3 .AND. imat.LE.5
278 IF( zerot .AND. n.LT.imat-2 )
279 $ GO TO 130
280
281
282
283 DO 120 iuplo = 1, 2
284 uplo = uplos( iuplo )
285 packit = packs( iuplo )
286
287
288
289
290 CALL slatb4( path, imat, n, n,
TYPE, KL, KU, ANORM, MODE,
291 $ CNDNUM, DIST )
292 rcondc = one / cndnum
293
294 srnamt = 'SLATMS'
295 CALL slatms( n, n, dist, iseed,
TYPE, RWORK, MODE,
296 $ CNDNUM, ANORM, KL, KU, PACKIT, A, LDA, WORK,
297 $ INFO )
298
299
300
301 IF( info.NE.0 ) THEN
302 CALL alaerh( path,
'SLATMS', info, 0, uplo, n, n, -1,
303 $ -1, -1, imat, nfail, nerrs, nout )
304 GO TO 120
305 END IF
306
307
308
309
310 IF( zerot ) THEN
311 IF( imat.EQ.3 ) THEN
312 izero = 1
313 ELSE IF( imat.EQ.4 ) THEN
314 izero = n
315 ELSE
316 izero = n / 2 + 1
317 END IF
318
319
320
321 IF( iuplo.EQ.1 ) THEN
322 ioff = ( izero-1 )*izero / 2
323 DO 20 i = 1, izero - 1
324 a( ioff+i ) = zero
325 20 CONTINUE
326 ioff = ioff + izero
327 DO 30 i = izero, n
328 a( ioff ) = zero
329 ioff = ioff + i
330 30 CONTINUE
331 ELSE
332 ioff = izero
333 DO 40 i = 1, izero - 1
334 a( ioff ) = zero
335 ioff = ioff + n - i
336 40 CONTINUE
337 ioff = ioff - izero
338 DO 50 i = izero, n
339 a( ioff+i ) = zero
340 50 CONTINUE
341 END IF
342 ELSE
343 izero = 0
344 END IF
345
346
347
348 CALL scopy( npp, a, 1, asav, 1 )
349
350 DO 110 iequed = 1, 2
351 equed = equeds( iequed )
352 IF( iequed.EQ.1 ) THEN
353 nfact = 3
354 ELSE
355 nfact = 1
356 END IF
357
358 DO 100 ifact = 1, nfact
359 fact = facts( ifact )
360 prefac =
lsame( fact,
'F' )
361 nofact =
lsame( fact,
'N' )
362 equil =
lsame( fact,
'E' )
363
364 IF( zerot ) THEN
365 IF( prefac )
366 $ GO TO 100
367 rcondc = zero
368
369 ELSE IF( .NOT.
lsame( fact,
'N' ) )
THEN
370
371
372
373
374
375
376 CALL scopy( npp, asav, 1, afac, 1 )
377 IF( equil .OR. iequed.GT.1 ) THEN
378
379
380
381
382 CALL sppequ( uplo, n, afac, s, scond, amax,
383 $ info )
384 IF( info.EQ.0 .AND. n.GT.0 ) THEN
385 IF( iequed.GT.1 )
386 $ scond = zero
387
388
389
390 CALL slaqsp( uplo, n, afac, s, scond,
391 $ amax, equed )
392 END IF
393 END IF
394
395
396
397
398 IF( equil )
399 $ roldc = rcondc
400
401
402
403 anorm =
slansp(
'1', uplo, n, afac, rwork )
404
405
406
407 CALL spptrf( uplo, n, afac, info )
408
409
410
411 CALL scopy( npp, afac, 1, a, 1 )
412 CALL spptri( uplo, n, a, info )
413
414
415
416 ainvnm =
slansp(
'1', uplo, n, a, rwork )
417 IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
418 rcondc = one
419 ELSE
420 rcondc = ( one / anorm ) / ainvnm
421 END IF
422 END IF
423
424
425
426 CALL scopy( npp, asav, 1, a, 1 )
427
428
429
430 srnamt = 'SLARHS'
431 CALL slarhs( path, xtype, uplo,
' ', n, n, kl, ku,
432 $ nrhs, a, lda, xact, lda, b, lda,
433 $ iseed, info )
434 xtype = 'C'
435 CALL slacpy(
'Full', n, nrhs, b, lda, bsav, lda )
436
437 IF( nofact ) THEN
438
439
440
441
442
443
444 CALL scopy( npp, a, 1, afac, 1 )
445 CALL slacpy(
'Full', n, nrhs, b, lda, x, lda )
446
447 srnamt = 'SPPSV '
448 CALL sppsv( uplo, n, nrhs, afac, x, lda, info )
449
450
451
452 IF( info.NE.izero ) THEN
453 CALL alaerh( path,
'SPPSV ', info, izero,
454 $ uplo, n, n, -1, -1, nrhs, imat,
455 $ nfail, nerrs, nout )
456 GO TO 70
457 ELSE IF( info.NE.0 ) THEN
458 GO TO 70
459 END IF
460
461
462
463
464 CALL sppt01( uplo, n, a, afac, rwork,
465 $ result( 1 ) )
466
467
468
469 CALL slacpy(
'Full', n, nrhs, b, lda, work,
470 $ lda )
471 CALL sppt02( uplo, n, nrhs, a, x, lda, work,
472 $ lda, rwork, result( 2 ) )
473
474
475
476 CALL sget04( n, nrhs, x, lda, xact, lda, rcondc,
477 $ result( 3 ) )
478 nt = 3
479
480
481
482
483 DO 60 k = 1, nt
484 IF( result( k ).GE.thresh ) THEN
485 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
486 $
CALL aladhd( nout, path )
487 WRITE( nout, fmt = 9999 )'SPPSV ', uplo,
488 $ n, imat, k, result( k )
489 nfail = nfail + 1
490 END IF
491 60 CONTINUE
492 nrun = nrun + nt
493 70 CONTINUE
494 END IF
495
496
497
498 IF( .NOT.prefac .AND. npp.GT.0 )
499 $
CALL slaset(
'Full', npp, 1, zero, zero, afac,
500 $ npp )
501 CALL slaset(
'Full', n, nrhs, zero, zero, x, lda )
502 IF( iequed.GT.1 .AND. n.GT.0 ) THEN
503
504
505
506
507 CALL slaqsp( uplo, n, a, s, scond, amax, equed )
508 END IF
509
510
511
512
513 srnamt = 'SPPSVX'
514 CALL sppsvx( fact, uplo, n, nrhs, a, afac, equed,
515 $ s, b, lda, x, lda, rcond, rwork,
516 $ rwork( nrhs+1 ), work, iwork, info )
517
518
519
520 IF( info.NE.izero ) THEN
521 CALL alaerh( path,
'SPPSVX', info, izero,
522 $ fact // uplo, n, n, -1, -1, nrhs,
523 $ imat, nfail, nerrs, nout )
524 GO TO 90
525 END IF
526
527 IF( info.EQ.0 ) THEN
528 IF( .NOT.prefac ) THEN
529
530
531
532
533 CALL sppt01( uplo, n, a, afac,
534 $ rwork( 2*nrhs+1 ), result( 1 ) )
535 k1 = 1
536 ELSE
537 k1 = 2
538 END IF
539
540
541
542 CALL slacpy(
'Full', n, nrhs, bsav, lda, work,
543 $ lda )
544 CALL sppt02( uplo, n, nrhs, asav, x, lda, work,
545 $ lda, rwork( 2*nrhs+1 ),
546 $ result( 2 ) )
547
548
549
550 IF( nofact .OR. ( prefac .AND.
lsame( equed,
551 $ 'N' ) ) ) THEN
552 CALL sget04( n, nrhs, x, lda, xact, lda,
553 $ rcondc, result( 3 ) )
554 ELSE
555 CALL sget04( n, nrhs, x, lda, xact, lda,
556 $ roldc, result( 3 ) )
557 END IF
558
559
560
561
562 CALL sppt05( uplo, n, nrhs, asav, b, lda, x,
563 $ lda, xact, lda, rwork,
564 $ rwork( nrhs+1 ), result( 4 ) )
565 ELSE
566 k1 = 6
567 END IF
568
569
570
571
572 result( 6 ) =
sget06( rcond, rcondc )
573
574
575
576
577 DO 80 k = k1, 6
578 IF( result( k ).GE.thresh ) THEN
579 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
580 $
CALL aladhd( nout, path )
581 IF( prefac ) THEN
582 WRITE( nout, fmt = 9997 )'SPPSVX', fact,
583 $ uplo, n, equed, imat, k, result( k )
584 ELSE
585 WRITE( nout, fmt = 9998 )'SPPSVX', fact,
586 $ uplo, n, imat, k, result( k )
587 END IF
588 nfail = nfail + 1
589 END IF
590 80 CONTINUE
591 nrun = nrun + 7 - k1
592 90 CONTINUE
593 100 CONTINUE
594 110 CONTINUE
595 120 CONTINUE
596 130 CONTINUE
597 140 CONTINUE
598
599
600
601 CALL alasvm( path, nout, nfail, nrun, nerrs )
602
603 9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', type ', i1,
604 $ ', test(', i1, ')=', g12.5 )
605 9998 FORMAT( 1x, a, ', FACT=''', a1, ''', UPLO=''', a1, ''', N=', i5,
606 $ ', type ', i1, ', test(', i1, ')=', g12.5 )
607 9997 FORMAT( 1x, a, ', FACT=''', a1, ''', UPLO=''', a1, ''', N=', i5,
608 $ ', EQUED=''', a1, ''', type ', i1, ', test(', i1, ')=',
609 $ g12.5 )
610 RETURN
611
612
613
subroutine alasvm(type, nout, nfail, nrun, nerrs)
ALASVM
subroutine slarhs(path, xtype, uplo, trans, m, n, kl, ku, nrhs, a, lda, x, ldx, b, ldb, iseed, info)
SLARHS
subroutine aladhd(iounit, path)
ALADHD
subroutine alaerh(path, subnam, info, infoe, opts, m, n, kl, ku, n5, imat, nfail, nerrs, nout)
ALAERH
subroutine scopy(n, sx, incx, sy, incy)
SCOPY
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
real function slansp(norm, uplo, n, ap, work)
SLANSP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
subroutine slaqsp(uplo, n, ap, s, scond, amax, equed)
SLAQSP scales a symmetric/Hermitian matrix in packed storage, using scaling factors computed by sppeq...
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.
logical function lsame(ca, cb)
LSAME
subroutine sppequ(uplo, n, ap, s, scond, amax, info)
SPPEQU
subroutine sppsv(uplo, n, nrhs, ap, b, ldb, info)
SPPSV computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine sppsvx(fact, uplo, n, nrhs, ap, afp, equed, s, b, ldb, x, ldx, rcond, ferr, berr, work, iwork, info)
SPPSVX computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine spptrf(uplo, n, ap, info)
SPPTRF
subroutine spptri(uplo, n, ap, info)
SPPTRI
subroutine serrvx(path, nunit)
SERRVX
subroutine sget04(n, nrhs, x, ldx, xact, ldxact, rcond, resid)
SGET04
real function sget06(rcond, rcondc)
SGET06
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 sppt01(uplo, n, a, afac, rwork, resid)
SPPT01
subroutine sppt02(uplo, n, nrhs, a, x, ldx, b, ldb, rwork, resid)
SPPT02
subroutine sppt05(uplo, n, nrhs, ap, b, ldb, x, ldx, xact, ldxact, ferr, berr, reslts)
SPPT05