164
165
166
167
168
169
170 LOGICAL TSTERR
171 INTEGER NMAX, NN, NOUT, NRHS
172 REAL THRESH
173
174
175 LOGICAL DOTYPE( * )
176 INTEGER IWORK( * ), NVAL( * )
177 REAL A( * ), AFAC( * ), ASAV( * ), B( * ),
178 $ BSAV( * ), RWORK( * ), S( * ), WORK( * ),
179 $ X( * ), XACT( * )
180
181
182
183
184
185 REAL ONE, ZERO
186 parameter( one = 1.0e+0, zero = 0.0e+0 )
187 INTEGER NTYPES, NTESTS
188 parameter( ntypes = 8, ntests = 6 )
189 INTEGER NBW
190 parameter( nbw = 4 )
191
192
193 LOGICAL EQUIL, NOFACT, PREFAC, ZEROT
194 CHARACTER DIST, EQUED, FACT, PACKIT, TYPE, UPLO, XTYPE
195 CHARACTER*3 PATH
196 INTEGER I, I1, I2, IEQUED, IFACT, IKD, IMAT, IN, INFO,
197 $ IOFF, IUPLO, IW, IZERO, K, K1, KD, KL, KOFF,
198 $ KU, LDA, LDAB, MODE, N, NB, NBMIN, NERRS,
199 $ NFACT, NFAIL, NIMAT, NKD, NRUN, NT
200 REAL AINVNM, AMAX, ANORM, CNDNUM, RCOND, RCONDC,
201 $ ROLDC, SCOND
202
203
204 CHARACTER EQUEDS( 2 ), FACTS( 3 )
205 INTEGER ISEED( 4 ), ISEEDY( 4 ), KDVAL( NBW )
206 REAL RESULT( NTESTS )
207
208
209 LOGICAL LSAME
210 REAL SGET06, SLANGE, SLANSB
212
213
218
219
220 INTRINSIC max, min
221
222
223 LOGICAL LERR, OK
224 CHARACTER*32 SRNAMT
225 INTEGER INFOT, NUNIT
226
227
228 COMMON / infoc / infot, nunit, ok, lerr
229 COMMON / srnamc / srnamt
230
231
232 DATA iseedy / 1988, 1989, 1990, 1991 /
233 DATA facts / 'F', 'N', 'E' /
234 DATA equeds / 'N', 'Y' /
235
236
237
238
239
240 path( 1: 1 ) = 'Single precision'
241 path( 2: 3 ) = 'PB'
242 nrun = 0
243 nfail = 0
244 nerrs = 0
245 DO 10 i = 1, 4
246 iseed( i ) = iseedy( i )
247 10 CONTINUE
248
249
250
251 IF( tsterr )
252 $
CALL serrvx( path, nout )
253 infot = 0
254 kdval( 1 ) = 0
255
256
257
258 nb = 1
259 nbmin = 2
262
263
264
265 DO 110 in = 1, nn
266 n = nval( in )
267 lda = max( n, 1 )
268 xtype = 'N'
269
270
271
272 nkd = max( 1, min( n, 4 ) )
273 nimat = ntypes
274 IF( n.EQ.0 )
275 $ nimat = 1
276
277 kdval( 2 ) = n + ( n+1 ) / 4
278 kdval( 3 ) = ( 3*n-1 ) / 4
279 kdval( 4 ) = ( n+1 ) / 4
280
281 DO 100 ikd = 1, nkd
282
283
284
285
286
287 kd = kdval( ikd )
288 ldab = kd + 1
289
290
291
292 DO 90 iuplo = 1, 2
293 koff = 1
294 IF( iuplo.EQ.1 ) THEN
295 uplo = 'U'
296 packit = 'Q'
297 koff = max( 1, kd+2-n )
298 ELSE
299 uplo = 'L'
300 packit = 'B'
301 END IF
302
303 DO 80 imat = 1, nimat
304
305
306
307 IF( .NOT.dotype( imat ) )
308 $ GO TO 80
309
310
311
312 zerot = imat.GE.2 .AND. imat.LE.4
313 IF( zerot .AND. n.LT.imat-1 )
314 $ GO TO 80
315
316 IF( .NOT.zerot .OR. .NOT.dotype( 1 ) ) THEN
317
318
319
320
321 CALL slatb4( path, imat, n, n,
TYPE, KL, KU, ANORM,
322 $ MODE, CNDNUM, DIST )
323
324 srnamt = 'SLATMS'
325 CALL slatms( n, n, dist, iseed,
TYPE, RWORK, MODE,
326 $ CNDNUM, ANORM, KD, KD, PACKIT,
327 $ A( KOFF ), LDAB, WORK, INFO )
328
329
330
331 IF( info.NE.0 ) THEN
332 CALL alaerh( path,
'SLATMS', info, 0, uplo, n,
333 $ n, -1, -1, -1, imat, nfail, nerrs,
334 $ nout )
335 GO TO 80
336 END IF
337 ELSE IF( izero.GT.0 ) THEN
338
339
340
341
342 iw = 2*lda + 1
343 IF( iuplo.EQ.1 ) THEN
344 ioff = ( izero-1 )*ldab + kd + 1
345 CALL scopy( izero-i1, work( iw ), 1,
346 $ a( ioff-izero+i1 ), 1 )
347 iw = iw + izero - i1
348 CALL scopy( i2-izero+1, work( iw ), 1,
349 $ a( ioff ), max( ldab-1, 1 ) )
350 ELSE
351 ioff = ( i1-1 )*ldab + 1
352 CALL scopy( izero-i1, work( iw ), 1,
353 $ a( ioff+izero-i1 ),
354 $ max( ldab-1, 1 ) )
355 ioff = ( izero-1 )*ldab + 1
356 iw = iw + izero - i1
357 CALL scopy( i2-izero+1, work( iw ), 1,
358 $ a( ioff ), 1 )
359 END IF
360 END IF
361
362
363
364
365 izero = 0
366 IF( zerot ) THEN
367 IF( imat.EQ.2 ) THEN
368 izero = 1
369 ELSE IF( imat.EQ.3 ) THEN
370 izero = n
371 ELSE
372 izero = n / 2 + 1
373 END IF
374
375
376
377 iw = 2*lda
378 DO 20 i = 1, min( 2*kd+1, n )
379 work( iw+i ) = zero
380 20 CONTINUE
381 iw = iw + 1
382 i1 = max( izero-kd, 1 )
383 i2 = min( izero+kd, n )
384
385 IF( iuplo.EQ.1 ) THEN
386 ioff = ( izero-1 )*ldab + kd + 1
387 CALL sswap( izero-i1, a( ioff-izero+i1 ), 1,
388 $ work( iw ), 1 )
389 iw = iw + izero - i1
390 CALL sswap( i2-izero+1, a( ioff ),
391 $ max( ldab-1, 1 ), work( iw ), 1 )
392 ELSE
393 ioff = ( i1-1 )*ldab + 1
394 CALL sswap( izero-i1, a( ioff+izero-i1 ),
395 $ max( ldab-1, 1 ), work( iw ), 1 )
396 ioff = ( izero-1 )*ldab + 1
397 iw = iw + izero - i1
398 CALL sswap( i2-izero+1, a( ioff ), 1,
399 $ work( iw ), 1 )
400 END IF
401 END IF
402
403
404
405 CALL slacpy(
'Full', kd+1, n, a, ldab, asav, ldab )
406
407 DO 70 iequed = 1, 2
408 equed = equeds( iequed )
409 IF( iequed.EQ.1 ) THEN
410 nfact = 3
411 ELSE
412 nfact = 1
413 END IF
414
415 DO 60 ifact = 1, nfact
416 fact = facts( ifact )
417 prefac =
lsame( fact,
'F' )
418 nofact =
lsame( fact,
'N' )
419 equil =
lsame( fact,
'E' )
420
421 IF( zerot ) THEN
422 IF( prefac )
423 $ GO TO 60
424 rcondc = zero
425
426 ELSE IF( .NOT.
lsame( fact,
'N' ) )
THEN
427
428
429
430
431
432
433 CALL slacpy(
'Full', kd+1, n, asav, ldab,
434 $ afac, ldab )
435 IF( equil .OR. iequed.GT.1 ) THEN
436
437
438
439
440 CALL spbequ( uplo, n, kd, afac, ldab, s,
441 $ scond, amax, info )
442 IF( info.EQ.0 .AND. n.GT.0 ) THEN
443 IF( iequed.GT.1 )
444 $ scond = zero
445
446
447
448 CALL slaqsb( uplo, n, kd, afac, ldab,
449 $ s, scond, amax, equed )
450 END IF
451 END IF
452
453
454
455
456 IF( equil )
457 $ roldc = rcondc
458
459
460
461 anorm =
slansb(
'1', uplo, n, kd, afac, ldab,
462 $ rwork )
463
464
465
466 CALL spbtrf( uplo, n, kd, afac, ldab, info )
467
468
469
470 CALL slaset(
'Full', n, n, zero, one, a,
471 $ lda )
472 srnamt = 'SPBTRS'
473 CALL spbtrs( uplo, n, kd, n, afac, ldab, a,
474 $ lda, info )
475
476
477
478 ainvnm =
slange(
'1', n, n, a, lda, rwork )
479 IF( anorm.LE.zero .OR. ainvnm.LE.zero ) THEN
480 rcondc = one
481 ELSE
482 rcondc = ( one / anorm ) / ainvnm
483 END IF
484 END IF
485
486
487
488 CALL slacpy(
'Full', kd+1, n, asav, ldab, a,
489 $ ldab )
490
491
492
493
494 srnamt = 'SLARHS'
495 CALL slarhs( path, xtype, uplo,
' ', n, n, kd,
496 $ kd, nrhs, a, ldab, xact, lda, b,
497 $ lda, iseed, info )
498 xtype = 'C'
499 CALL slacpy(
'Full', n, nrhs, b, lda, bsav,
500 $ lda )
501
502 IF( nofact ) THEN
503
504
505
506
507
508
509 CALL slacpy(
'Full', kd+1, n, a, ldab, afac,
510 $ ldab )
511 CALL slacpy(
'Full', n, nrhs, b, lda, x,
512 $ lda )
513
514 srnamt = 'SPBSV '
515 CALL spbsv( uplo, n, kd, nrhs, afac, ldab, x,
516 $ lda, info )
517
518
519
520 IF( info.NE.izero ) THEN
521 CALL alaerh( path,
'SPBSV ', info, izero,
522 $ uplo, n, n, kd, kd, nrhs,
523 $ imat, nfail, nerrs, nout )
524 GO TO 40
525 ELSE IF( info.NE.0 ) THEN
526 GO TO 40
527 END IF
528
529
530
531
532 CALL spbt01( uplo, n, kd, a, ldab, afac,
533 $ ldab, rwork, result( 1 ) )
534
535
536
537 CALL slacpy(
'Full', n, nrhs, b, lda, work,
538 $ lda )
539 CALL spbt02( uplo, n, kd, nrhs, a, ldab, x,
540 $ lda, work, lda, rwork,
541 $ result( 2 ) )
542
543
544
545 CALL sget04( n, nrhs, x, lda, xact, lda,
546 $ rcondc, result( 3 ) )
547 nt = 3
548
549
550
551
552 DO 30 k = 1, nt
553 IF( result( k ).GE.thresh ) THEN
554 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
555 $
CALL aladhd( nout, path )
556 WRITE( nout, fmt = 9999 )'SPBSV ',
557 $ uplo, n, kd, imat, k, result( k )
558 nfail = nfail + 1
559 END IF
560 30 CONTINUE
561 nrun = nrun + nt
562 40 CONTINUE
563 END IF
564
565
566
567 IF( .NOT.prefac )
568 $
CALL slaset(
'Full', kd+1, n, zero, zero,
569 $ afac, ldab )
570 CALL slaset(
'Full', n, nrhs, zero, zero, x,
571 $ lda )
572 IF( iequed.GT.1 .AND. n.GT.0 ) THEN
573
574
575
576
577 CALL slaqsb( uplo, n, kd, a, ldab, s, scond,
578 $ amax, equed )
579 END IF
580
581
582
583
584 srnamt = 'SPBSVX'
585 CALL spbsvx( fact, uplo, n, kd, nrhs, a, ldab,
586 $ afac, ldab, equed, s, b, lda, x,
587 $ lda, rcond, rwork, rwork( nrhs+1 ),
588 $ work, iwork, info )
589
590
591
592 IF( info.NE.izero ) THEN
593 CALL alaerh( path,
'SPBSVX', info, izero,
594 $ fact // uplo, n, n, kd, kd,
595 $ nrhs, imat, nfail, nerrs, nout )
596 GO TO 60
597 END IF
598
599 IF( info.EQ.0 ) THEN
600 IF( .NOT.prefac ) THEN
601
602
603
604
605 CALL spbt01( uplo, n, kd, a, ldab, afac,
606 $ ldab, rwork( 2*nrhs+1 ),
607 $ result( 1 ) )
608 k1 = 1
609 ELSE
610 k1 = 2
611 END IF
612
613
614
615 CALL slacpy(
'Full', n, nrhs, bsav, lda,
616 $ work, lda )
617 CALL spbt02( uplo, n, kd, nrhs, asav, ldab,
618 $ x, lda, work, lda,
619 $ rwork( 2*nrhs+1 ), result( 2 ) )
620
621
622
623 IF( nofact .OR. ( prefac .AND.
lsame( equed,
624 $ 'N' ) ) ) THEN
625 CALL sget04( n, nrhs, x, lda, xact, lda,
626 $ rcondc, result( 3 ) )
627 ELSE
628 CALL sget04( n, nrhs, x, lda, xact, lda,
629 $ roldc, result( 3 ) )
630 END IF
631
632
633
634
635 CALL spbt05( uplo, n, kd, nrhs, asav, ldab,
636 $ b, lda, x, lda, xact, lda,
637 $ rwork, rwork( nrhs+1 ),
638 $ result( 4 ) )
639 ELSE
640 k1 = 6
641 END IF
642
643
644
645
646 result( 6 ) =
sget06( rcond, rcondc )
647
648
649
650
651 DO 50 k = k1, 6
652 IF( result( k ).GE.thresh ) THEN
653 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
654 $
CALL aladhd( nout, path )
655 IF( prefac ) THEN
656 WRITE( nout, fmt = 9997 )'SPBSVX',
657 $ fact, uplo, n, kd, equed, imat, k,
658 $ result( k )
659 ELSE
660 WRITE( nout, fmt = 9998 )'SPBSVX',
661 $ fact, uplo, n, kd, imat, k,
662 $ result( k )
663 END IF
664 nfail = nfail + 1
665 END IF
666 50 CONTINUE
667 nrun = nrun + 7 - k1
668 60 CONTINUE
669 70 CONTINUE
670 80 CONTINUE
671 90 CONTINUE
672 100 CONTINUE
673 110 CONTINUE
674
675
676
677 CALL alasvm( path, nout, nfail, nrun, nerrs )
678
679 9999 FORMAT( 1x, a, ', UPLO=''', a1, ''', N =', i5, ', KD =', i5,
680 $ ', type ', i1, ', test(', i1, ')=', g12.5 )
681 9998 FORMAT( 1x, a, '( ''', a1, ''', ''', a1, ''', ', i5, ', ', i5,
682 $ ', ... ), type ', i1, ', test(', i1, ')=', g12.5 )
683 9997 FORMAT( 1x, a, '( ''', a1, ''', ''', a1, ''', ', i5, ', ', i5,
684 $ ', ... ), EQUED=''', a1, ''', type ', i1, ', test(', i1,
685 $ ')=', g12.5 )
686 RETURN
687
688
689
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 xlaenv(ispec, nvalue)
XLAENV
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 slange(norm, m, n, a, lda, work)
SLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
real function slansb(norm, uplo, n, k, ab, ldab, work)
SLANSB returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
subroutine slaqsb(uplo, n, kd, ab, ldab, s, scond, amax, equed)
SLAQSB scales a symmetric/Hermitian band matrix, using scaling factors computed by spbequ.
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 spbequ(uplo, n, kd, ab, ldab, s, scond, amax, info)
SPBEQU
subroutine spbsv(uplo, n, kd, nrhs, ab, ldab, b, ldb, info)
SPBSV computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine spbsvx(fact, uplo, n, kd, nrhs, ab, ldab, afb, ldafb, equed, s, b, ldb, x, ldx, rcond, ferr, berr, work, iwork, info)
SPBSVX computes the solution to system of linear equations A * X = B for OTHER matrices
subroutine spbtrf(uplo, n, kd, ab, ldab, info)
SPBTRF
subroutine spbtrs(uplo, n, kd, nrhs, ab, ldab, b, ldb, info)
SPBTRS
subroutine sswap(n, sx, incx, sy, incy)
SSWAP
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 spbt01(uplo, n, kd, a, lda, afac, ldafac, rwork, resid)
SPBT01
subroutine spbt02(uplo, n, kd, nrhs, a, lda, x, ldx, b, ldb, rwork, resid)
SPBT02
subroutine spbt05(uplo, n, kd, nrhs, ab, ldab, b, ldb, x, ldx, xact, ldxact, ferr, berr, reslts)
SPBT05