LAPACK  3.9.1
LAPACK: Linear Algebra PACKage
cdrvgbx.f
Go to the documentation of this file.
1 *> \brief \b CDRVGBX
2 *
3 * =========== DOCUMENTATION ===========
4 *
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
7 *
8 * Definition:
9 * ===========
10 *
11 * SUBROUTINE CDRVGB( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, A, LA,
12 * AFB, LAFB, ASAV, B, BSAV, X, XACT, S, WORK,
13 * RWORK, IWORK, NOUT )
14 *
15 * .. Scalar Arguments ..
16 * LOGICAL TSTERR
17 * INTEGER LA, LAFB, NN, NOUT, NRHS
18 * REAL THRESH
19 * ..
20 * .. Array Arguments ..
21 * LOGICAL DOTYPE( * )
22 * INTEGER IWORK( * ), NVAL( * )
23 * REAL RWORK( * ), S( * )
24 * COMPLEX A( * ), AFB( * ), ASAV( * ), B( * ), BSAV( * ),
25 * $ WORK( * ), X( * ), XACT( * )
26 * ..
27 *
28 *
29 *> \par Purpose:
30 * =============
31 *>
32 *> \verbatim
33 *>
34 *> CDRVGB tests the driver routines CGBSV, -SVX, and -SVXX.
35 *>
36 *> Note that this file is used only when the XBLAS are available,
37 *> otherwise cdrvgb.f defines this subroutine.
38 *> \endverbatim
39 *
40 * Arguments:
41 * ==========
42 *
43 *> \param[in] DOTYPE
44 *> \verbatim
45 *> DOTYPE is LOGICAL array, dimension (NTYPES)
46 *> The matrix types to be used for testing. Matrices of type j
47 *> (for 1 <= j <= NTYPES) are used for testing if DOTYPE(j) =
48 *> .TRUE.; if DOTYPE(j) = .FALSE., then type j is not used.
49 *> \endverbatim
50 *>
51 *> \param[in] NN
52 *> \verbatim
53 *> NN is INTEGER
54 *> The number of values of N contained in the vector NVAL.
55 *> \endverbatim
56 *>
57 *> \param[in] NVAL
58 *> \verbatim
59 *> NVAL is INTEGER array, dimension (NN)
60 *> The values of the matrix column dimension N.
61 *> \endverbatim
62 *>
63 *> \param[in] NRHS
64 *> \verbatim
65 *> NRHS is INTEGER
66 *> The number of right hand side vectors to be generated for
67 *> each linear system.
68 *> \endverbatim
69 *>
70 *> \param[in] THRESH
71 *> \verbatim
72 *> THRESH is REAL
73 *> The threshold value for the test ratios. A result is
74 *> included in the output file if RESULT >= THRESH. To have
75 *> every test ratio printed, use THRESH = 0.
76 *> \endverbatim
77 *>
78 *> \param[in] TSTERR
79 *> \verbatim
80 *> TSTERR is LOGICAL
81 *> Flag that indicates whether error exits are to be tested.
82 *> \endverbatim
83 *>
84 *> \param[out] A
85 *> \verbatim
86 *> A is COMPLEX array, dimension (LA)
87 *> \endverbatim
88 *>
89 *> \param[in] LA
90 *> \verbatim
91 *> LA is INTEGER
92 *> The length of the array A. LA >= (2*NMAX-1)*NMAX
93 *> where NMAX is the largest entry in NVAL.
94 *> \endverbatim
95 *>
96 *> \param[out] AFB
97 *> \verbatim
98 *> AFB is COMPLEX array, dimension (LAFB)
99 *> \endverbatim
100 *>
101 *> \param[in] LAFB
102 *> \verbatim
103 *> LAFB is INTEGER
104 *> The length of the array AFB. LAFB >= (3*NMAX-2)*NMAX
105 *> where NMAX is the largest entry in NVAL.
106 *> \endverbatim
107 *>
108 *> \param[out] ASAV
109 *> \verbatim
110 *> ASAV is COMPLEX array, dimension (LA)
111 *> \endverbatim
112 *>
113 *> \param[out] B
114 *> \verbatim
115 *> B is COMPLEX array, dimension (NMAX*NRHS)
116 *> \endverbatim
117 *>
118 *> \param[out] BSAV
119 *> \verbatim
120 *> BSAV is COMPLEX array, dimension (NMAX*NRHS)
121 *> \endverbatim
122 *>
123 *> \param[out] X
124 *> \verbatim
125 *> X is COMPLEX array, dimension (NMAX*NRHS)
126 *> \endverbatim
127 *>
128 *> \param[out] XACT
129 *> \verbatim
130 *> XACT is COMPLEX array, dimension (NMAX*NRHS)
131 *> \endverbatim
132 *>
133 *> \param[out] S
134 *> \verbatim
135 *> S is REAL array, dimension (2*NMAX)
136 *> \endverbatim
137 *>
138 *> \param[out] WORK
139 *> \verbatim
140 *> WORK is COMPLEX array, dimension
141 *> (NMAX*max(3,NRHS,NMAX))
142 *> \endverbatim
143 *>
144 *> \param[out] RWORK
145 *> \verbatim
146 *> RWORK is REAL array, dimension
147 *> (max(NMAX,2*NRHS))
148 *> \endverbatim
149 *>
150 *> \param[out] IWORK
151 *> \verbatim
152 *> IWORK is INTEGER array, dimension (NMAX)
153 *> \endverbatim
154 *>
155 *> \param[in] NOUT
156 *> \verbatim
157 *> NOUT is INTEGER
158 *> The unit number for output.
159 *> \endverbatim
160 *
161 * Authors:
162 * ========
163 *
164 *> \author Univ. of Tennessee
165 *> \author Univ. of California Berkeley
166 *> \author Univ. of Colorado Denver
167 *> \author NAG Ltd.
168 *
169 *> \ingroup complex_lin
170 *
171 * =====================================================================
172  SUBROUTINE cdrvgb( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, A, LA,
173  $ AFB, LAFB, ASAV, B, BSAV, X, XACT, S, WORK,
174  $ RWORK, IWORK, NOUT )
175 *
176 * -- LAPACK test routine --
177 * -- LAPACK is a software package provided by Univ. of Tennessee, --
178 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
179 *
180 * .. Scalar Arguments ..
181  LOGICAL TSTERR
182  INTEGER LA, LAFB, NN, NOUT, NRHS
183  REAL THRESH
184 * ..
185 * .. Array Arguments ..
186  LOGICAL DOTYPE( * )
187  INTEGER IWORK( * ), NVAL( * )
188  REAL RWORK( * ), S( * )
189  COMPLEX A( * ), AFB( * ), ASAV( * ), B( * ), BSAV( * ),
190  $ work( * ), x( * ), xact( * )
191 * ..
192 *
193 * =====================================================================
194 *
195 * .. Parameters ..
196  REAL ONE, ZERO
197  PARAMETER ( ONE = 1.0e+0, zero = 0.0e+0 )
198  INTEGER NTYPES
199  parameter( ntypes = 8 )
200  INTEGER NTESTS
201  parameter( ntests = 7 )
202  INTEGER NTRAN
203  parameter( ntran = 3 )
204 * ..
205 * .. Local Scalars ..
206  LOGICAL EQUIL, NOFACT, PREFAC, TRFCON, ZEROT
207  CHARACTER DIST, EQUED, FACT, TRANS, TYPE, XTYPE
208  CHARACTER*3 PATH
209  INTEGER I, I1, I2, IEQUED, IFACT, IKL, IKU, IMAT, IN,
210  $ info, ioff, itran, izero, j, k, k1, kl, ku,
211  $ lda, ldafb, ldb, mode, n, nb, nbmin, nerrs,
212  $ nfact, nfail, nimat, nkl, nku, nrun, nt,
213  $ n_err_bnds
214  REAL AINVNM, AMAX, ANORM, ANORMI, ANORMO, ANRMPV,
215  $ CNDNUM, COLCND, RCOND, RCONDC, RCONDI, RCONDO,
216  $ roldc, roldi, roldo, rowcnd, rpvgrw,
217  $ rpvgrw_svxx
218 * ..
219 * .. Local Arrays ..
220  CHARACTER EQUEDS( 4 ), FACTS( 3 ), TRANSS( NTRAN )
221  INTEGER ISEED( 4 ), ISEEDY( 4 )
222  REAL RDUM( 1 ), RESULT( NTESTS ), BERR( NRHS ),
223  $ errbnds_n( nrhs,3 ), errbnds_c( nrhs, 3 )
224 * ..
225 * .. External Functions ..
226  LOGICAL LSAME
227  REAL CLANGB, CLANGE, CLANTB, SGET06, SLAMCH,
228  $ cla_gbrpvgrw
229  EXTERNAL lsame, clangb, clange, clantb, sget06, slamch,
230  $ cla_gbrpvgrw
231 * ..
232 * .. External Subroutines ..
233  EXTERNAL aladhd, alaerh, alasvm, cerrvx, cgbequ, cgbsv,
236  $ clatms, xlaenv, cgbsvxx
237 * ..
238 * .. Intrinsic Functions ..
239  INTRINSIC abs, cmplx, max, min
240 * ..
241 * .. Scalars in Common ..
242  LOGICAL LERR, OK
243  CHARACTER*32 SRNAMT
244  INTEGER INFOT, NUNIT
245 * ..
246 * .. Common blocks ..
247  COMMON / infoc / infot, nunit, ok, lerr
248  COMMON / srnamc / srnamt
249 * ..
250 * .. Data statements ..
251  DATA iseedy / 1988, 1989, 1990, 1991 /
252  DATA transs / 'N', 'T', 'C' /
253  DATA facts / 'F', 'N', 'E' /
254  DATA equeds / 'N', 'R', 'C', 'B' /
255 * ..
256 * .. Executable Statements ..
257 *
258 * Initialize constants and the random number seed.
259 *
260  path( 1: 1 ) = 'Complex precision'
261  path( 2: 3 ) = 'GB'
262  nrun = 0
263  nfail = 0
264  nerrs = 0
265  DO 10 i = 1, 4
266  iseed( i ) = iseedy( i )
267  10 CONTINUE
268 *
269 * Test the error exits
270 *
271  IF( tsterr )
272  $ CALL cerrvx( path, nout )
273  infot = 0
274 *
275 * Set the block size and minimum block size for testing.
276 *
277  nb = 1
278  nbmin = 2
279  CALL xlaenv( 1, nb )
280  CALL xlaenv( 2, nbmin )
281 *
282 * Do for each value of N in NVAL
283 *
284  DO 150 in = 1, nn
285  n = nval( in )
286  ldb = max( n, 1 )
287  xtype = 'N'
288 *
289 * Set limits on the number of loop iterations.
290 *
291  nkl = max( 1, min( n, 4 ) )
292  IF( n.EQ.0 )
293  $ nkl = 1
294  nku = nkl
295  nimat = ntypes
296  IF( n.LE.0 )
297  $ nimat = 1
298 *
299  DO 140 ikl = 1, nkl
300 *
301 * Do for KL = 0, N-1, (3N-1)/4, and (N+1)/4. This order makes
302 * it easier to skip redundant values for small values of N.
303 *
304  IF( ikl.EQ.1 ) THEN
305  kl = 0
306  ELSE IF( ikl.EQ.2 ) THEN
307  kl = max( n-1, 0 )
308  ELSE IF( ikl.EQ.3 ) THEN
309  kl = ( 3*n-1 ) / 4
310  ELSE IF( ikl.EQ.4 ) THEN
311  kl = ( n+1 ) / 4
312  END IF
313  DO 130 iku = 1, nku
314 *
315 * Do for KU = 0, N-1, (3N-1)/4, and (N+1)/4. This order
316 * makes it easier to skip redundant values for small
317 * values of N.
318 *
319  IF( iku.EQ.1 ) THEN
320  ku = 0
321  ELSE IF( iku.EQ.2 ) THEN
322  ku = max( n-1, 0 )
323  ELSE IF( iku.EQ.3 ) THEN
324  ku = ( 3*n-1 ) / 4
325  ELSE IF( iku.EQ.4 ) THEN
326  ku = ( n+1 ) / 4
327  END IF
328 *
329 * Check that A and AFB are big enough to generate this
330 * matrix.
331 *
332  lda = kl + ku + 1
333  ldafb = 2*kl + ku + 1
334  IF( lda*n.GT.la .OR. ldafb*n.GT.lafb ) THEN
335  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
336  $ CALL aladhd( nout, path )
337  IF( lda*n.GT.la ) THEN
338  WRITE( nout, fmt = 9999 )la, n, kl, ku,
339  $ n*( kl+ku+1 )
340  nerrs = nerrs + 1
341  END IF
342  IF( ldafb*n.GT.lafb ) THEN
343  WRITE( nout, fmt = 9998 )lafb, n, kl, ku,
344  $ n*( 2*kl+ku+1 )
345  nerrs = nerrs + 1
346  END IF
347  GO TO 130
348  END IF
349 *
350  DO 120 imat = 1, nimat
351 *
352 * Do the tests only if DOTYPE( IMAT ) is true.
353 *
354  IF( .NOT.dotype( imat ) )
355  $ GO TO 120
356 *
357 * Skip types 2, 3, or 4 if the matrix is too small.
358 *
359  zerot = imat.GE.2 .AND. imat.LE.4
360  IF( zerot .AND. n.LT.imat-1 )
361  $ GO TO 120
362 *
363 * Set up parameters with CLATB4 and generate a
364 * test matrix with CLATMS.
365 *
366  CALL clatb4( path, imat, n, n, TYPE, KL, KU, ANORM,
367  $ MODE, CNDNUM, DIST )
368  rcondc = one / cndnum
369 *
370  srnamt = 'CLATMS'
371  CALL clatms( n, n, dist, iseed, TYPE, RWORK, MODE,
372  $ cndnum, anorm, kl, ku, 'Z', a, lda, work,
373  $ info )
374 *
375 * Check the error code from CLATMS.
376 *
377  IF( info.NE.0 ) THEN
378  CALL alaerh( path, 'CLATMS', info, 0, ' ', n, n,
379  $ kl, ku, -1, imat, nfail, nerrs, nout )
380  GO TO 120
381  END IF
382 *
383 * For types 2, 3, and 4, zero one or more columns of
384 * the matrix to test that INFO is returned correctly.
385 *
386  izero = 0
387  IF( zerot ) THEN
388  IF( imat.EQ.2 ) THEN
389  izero = 1
390  ELSE IF( imat.EQ.3 ) THEN
391  izero = n
392  ELSE
393  izero = n / 2 + 1
394  END IF
395  ioff = ( izero-1 )*lda
396  IF( imat.LT.4 ) THEN
397  i1 = max( 1, ku+2-izero )
398  i2 = min( kl+ku+1, ku+1+( n-izero ) )
399  DO 20 i = i1, i2
400  a( ioff+i ) = zero
401  20 CONTINUE
402  ELSE
403  DO 40 j = izero, n
404  DO 30 i = max( 1, ku+2-j ),
405  $ min( kl+ku+1, ku+1+( n-j ) )
406  a( ioff+i ) = zero
407  30 CONTINUE
408  ioff = ioff + lda
409  40 CONTINUE
410  END IF
411  END IF
412 *
413 * Save a copy of the matrix A in ASAV.
414 *
415  CALL clacpy( 'Full', kl+ku+1, n, a, lda, asav, lda )
416 *
417  DO 110 iequed = 1, 4
418  equed = equeds( iequed )
419  IF( iequed.EQ.1 ) THEN
420  nfact = 3
421  ELSE
422  nfact = 1
423  END IF
424 *
425  DO 100 ifact = 1, nfact
426  fact = facts( ifact )
427  prefac = lsame( fact, 'F' )
428  nofact = lsame( fact, 'N' )
429  equil = lsame( fact, 'E' )
430 *
431  IF( zerot ) THEN
432  IF( prefac )
433  $ GO TO 100
434  rcondo = zero
435  rcondi = zero
436 *
437  ELSE IF( .NOT.nofact ) THEN
438 *
439 * Compute the condition number for comparison
440 * with the value returned by SGESVX (FACT =
441 * 'N' reuses the condition number from the
442 * previous iteration with FACT = 'F').
443 *
444  CALL clacpy( 'Full', kl+ku+1, n, asav, lda,
445  $ afb( kl+1 ), ldafb )
446  IF( equil .OR. iequed.GT.1 ) THEN
447 *
448 * Compute row and column scale factors to
449 * equilibrate the matrix A.
450 *
451  CALL cgbequ( n, n, kl, ku, afb( kl+1 ),
452  $ ldafb, s, s( n+1 ), rowcnd,
453  $ colcnd, amax, info )
454  IF( info.EQ.0 .AND. n.GT.0 ) THEN
455  IF( lsame( equed, 'R' ) ) THEN
456  rowcnd = zero
457  colcnd = one
458  ELSE IF( lsame( equed, 'C' ) ) THEN
459  rowcnd = one
460  colcnd = zero
461  ELSE IF( lsame( equed, 'B' ) ) THEN
462  rowcnd = zero
463  colcnd = zero
464  END IF
465 *
466 * Equilibrate the matrix.
467 *
468  CALL claqgb( n, n, kl, ku, afb( kl+1 ),
469  $ ldafb, s, s( n+1 ),
470  $ rowcnd, colcnd, amax,
471  $ equed )
472  END IF
473  END IF
474 *
475 * Save the condition number of the
476 * non-equilibrated system for use in CGET04.
477 *
478  IF( equil ) THEN
479  roldo = rcondo
480  roldi = rcondi
481  END IF
482 *
483 * Compute the 1-norm and infinity-norm of A.
484 *
485  anormo = clangb( '1', n, kl, ku, afb( kl+1 ),
486  $ ldafb, rwork )
487  anormi = clangb( 'I', n, kl, ku, afb( kl+1 ),
488  $ ldafb, rwork )
489 *
490 * Factor the matrix A.
491 *
492  CALL cgbtrf( n, n, kl, ku, afb, ldafb, iwork,
493  $ info )
494 *
495 * Form the inverse of A.
496 *
497  CALL claset( 'Full', n, n, cmplx( zero ),
498  $ cmplx( one ), work, ldb )
499  srnamt = 'CGBTRS'
500  CALL cgbtrs( 'No transpose', n, kl, ku, n,
501  $ afb, ldafb, iwork, work, ldb,
502  $ info )
503 *
504 * Compute the 1-norm condition number of A.
505 *
506  ainvnm = clange( '1', n, n, work, ldb,
507  $ rwork )
508  IF( anormo.LE.zero .OR. ainvnm.LE.zero ) THEN
509  rcondo = one
510  ELSE
511  rcondo = ( one / anormo ) / ainvnm
512  END IF
513 *
514 * Compute the infinity-norm condition number
515 * of A.
516 *
517  ainvnm = clange( 'I', n, n, work, ldb,
518  $ rwork )
519  IF( anormi.LE.zero .OR. ainvnm.LE.zero ) THEN
520  rcondi = one
521  ELSE
522  rcondi = ( one / anormi ) / ainvnm
523  END IF
524  END IF
525 *
526  DO 90 itran = 1, ntran
527 *
528 * Do for each value of TRANS.
529 *
530  trans = transs( itran )
531  IF( itran.EQ.1 ) THEN
532  rcondc = rcondo
533  ELSE
534  rcondc = rcondi
535  END IF
536 *
537 * Restore the matrix A.
538 *
539  CALL clacpy( 'Full', kl+ku+1, n, asav, lda,
540  $ a, lda )
541 *
542 * Form an exact solution and set the right hand
543 * side.
544 *
545  srnamt = 'CLARHS'
546  CALL clarhs( path, xtype, 'Full', trans, n,
547  $ n, kl, ku, nrhs, a, lda, xact,
548  $ ldb, b, ldb, iseed, info )
549  xtype = 'C'
550  CALL clacpy( 'Full', n, nrhs, b, ldb, bsav,
551  $ ldb )
552 *
553  IF( nofact .AND. itran.EQ.1 ) THEN
554 *
555 * --- Test CGBSV ---
556 *
557 * Compute the LU factorization of the matrix
558 * and solve the system.
559 *
560  CALL clacpy( 'Full', kl+ku+1, n, a, lda,
561  $ afb( kl+1 ), ldafb )
562  CALL clacpy( 'Full', n, nrhs, b, ldb, x,
563  $ ldb )
564 *
565  srnamt = 'CGBSV '
566  CALL cgbsv( n, kl, ku, nrhs, afb, ldafb,
567  $ iwork, x, ldb, info )
568 *
569 * Check error code from CGBSV .
570 *
571  IF( info.NE.izero )
572  $ CALL alaerh( path, 'CGBSV ', info,
573  $ izero, ' ', n, n, kl, ku,
574  $ nrhs, imat, nfail, nerrs,
575  $ nout )
576 *
577 * Reconstruct matrix from factors and
578 * compute residual.
579 *
580  CALL cgbt01( n, n, kl, ku, a, lda, afb,
581  $ ldafb, iwork, work,
582  $ result( 1 ) )
583  nt = 1
584  IF( izero.EQ.0 ) THEN
585 *
586 * Compute residual of the computed
587 * solution.
588 *
589  CALL clacpy( 'Full', n, nrhs, b, ldb,
590  $ work, ldb )
591  CALL cgbt02( 'No transpose', n, n, kl,
592  $ ku, nrhs, a, lda, x, ldb,
593  $ work, ldb, result( 2 ) )
594 *
595 * Check solution from generated exact
596 * solution.
597 *
598  CALL cget04( n, nrhs, x, ldb, xact,
599  $ ldb, rcondc, result( 3 ) )
600  nt = 3
601  END IF
602 *
603 * Print information about the tests that did
604 * not pass the threshold.
605 *
606  DO 50 k = 1, nt
607  IF( result( k ).GE.thresh ) THEN
608  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
609  $ CALL aladhd( nout, path )
610  WRITE( nout, fmt = 9997 )'CGBSV ',
611  $ n, kl, ku, imat, k, result( k )
612  nfail = nfail + 1
613  END IF
614  50 CONTINUE
615  nrun = nrun + nt
616  END IF
617 *
618 * --- Test CGBSVX ---
619 *
620  IF( .NOT.prefac )
621  $ CALL claset( 'Full', 2*kl+ku+1, n,
622  $ cmplx( zero ), cmplx( zero ),
623  $ afb, ldafb )
624  CALL claset( 'Full', n, nrhs, cmplx( zero ),
625  $ cmplx( zero ), x, ldb )
626  IF( iequed.GT.1 .AND. n.GT.0 ) THEN
627 *
628 * Equilibrate the matrix if FACT = 'F' and
629 * EQUED = 'R', 'C', or 'B'.
630 *
631  CALL claqgb( n, n, kl, ku, a, lda, s,
632  $ s( n+1 ), rowcnd, colcnd,
633  $ amax, equed )
634  END IF
635 *
636 * Solve the system and compute the condition
637 * number and error bounds using CGBSVX.
638 *
639  srnamt = 'CGBSVX'
640  CALL cgbsvx( fact, trans, n, kl, ku, nrhs, a,
641  $ lda, afb, ldafb, iwork, equed,
642  $ s, s( ldb+1 ), b, ldb, x, ldb,
643  $ rcond, rwork, rwork( nrhs+1 ),
644  $ work, rwork( 2*nrhs+1 ), info )
645 *
646 * Check the error code from CGBSVX.
647 *
648  IF( info.NE.izero )
649  $ CALL alaerh( path, 'CGBSVX', info, izero,
650  $ fact // trans, n, n, kl, ku,
651  $ nrhs, imat, nfail, nerrs,
652  $ nout )
653 *
654 * Compare RWORK(2*NRHS+1) from CGBSVX with the
655 * computed reciprocal pivot growth RPVGRW
656 *
657  IF( info.NE.0 ) THEN
658  anrmpv = zero
659  DO 70 j = 1, info
660  DO 60 i = max( ku+2-j, 1 ),
661  $ min( n+ku+1-j, kl+ku+1 )
662  anrmpv = max( anrmpv,
663  $ abs( a( i+( j-1 )*lda ) ) )
664  60 CONTINUE
665  70 CONTINUE
666  rpvgrw = clantb( 'M', 'U', 'N', info,
667  $ min( info-1, kl+ku ),
668  $ afb( max( 1, kl+ku+2-info ) ),
669  $ ldafb, rdum )
670  IF( rpvgrw.EQ.zero ) THEN
671  rpvgrw = one
672  ELSE
673  rpvgrw = anrmpv / rpvgrw
674  END IF
675  ELSE
676  rpvgrw = clantb( 'M', 'U', 'N', n, kl+ku,
677  $ afb, ldafb, rdum )
678  IF( rpvgrw.EQ.zero ) THEN
679  rpvgrw = one
680  ELSE
681  rpvgrw = clangb( 'M', n, kl, ku, a,
682  $ lda, rdum ) / rpvgrw
683  END IF
684  END IF
685  result( 7 ) = abs( rpvgrw-rwork( 2*nrhs+1 ) )
686  $ / max( rwork( 2*nrhs+1 ),
687  $ rpvgrw ) / slamch( 'E' )
688 *
689  IF( .NOT.prefac ) THEN
690 *
691 * Reconstruct matrix from factors and
692 * compute residual.
693 *
694  CALL cgbt01( n, n, kl, ku, a, lda, afb,
695  $ ldafb, iwork, work,
696  $ result( 1 ) )
697  k1 = 1
698  ELSE
699  k1 = 2
700  END IF
701 *
702  IF( info.EQ.0 ) THEN
703  trfcon = .false.
704 *
705 * Compute residual of the computed solution.
706 *
707  CALL clacpy( 'Full', n, nrhs, bsav, ldb,
708  $ work, ldb )
709  CALL cgbt02( trans, n, n, kl, ku, nrhs,
710  $ asav, lda, x, ldb, work, ldb,
711  $ result( 2 ) )
712 *
713 * Check solution from generated exact
714 * solution.
715 *
716  IF( nofact .OR. ( prefac .AND.
717  $ lsame( equed, 'N' ) ) ) THEN
718  CALL cget04( n, nrhs, x, ldb, xact,
719  $ ldb, rcondc, result( 3 ) )
720  ELSE
721  IF( itran.EQ.1 ) THEN
722  roldc = roldo
723  ELSE
724  roldc = roldi
725  END IF
726  CALL cget04( n, nrhs, x, ldb, xact,
727  $ ldb, roldc, result( 3 ) )
728  END IF
729 *
730 * Check the error bounds from iterative
731 * refinement.
732 *
733  CALL cgbt05( trans, n, kl, ku, nrhs, asav,
734  $ lda, bsav, ldb, x, ldb, xact,
735  $ ldb, rwork, rwork( nrhs+1 ),
736  $ result( 4 ) )
737  ELSE
738  trfcon = .true.
739  END IF
740 *
741 * Compare RCOND from CGBSVX with the computed
742 * value in RCONDC.
743 *
744  result( 6 ) = sget06( rcond, rcondc )
745 *
746 * Print information about the tests that did
747 * not pass the threshold.
748 *
749  IF( .NOT.trfcon ) THEN
750  DO 80 k = k1, ntests
751  IF( result( k ).GE.thresh ) THEN
752  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
753  $ CALL aladhd( nout, path )
754  IF( prefac ) THEN
755  WRITE( nout, fmt = 9995 )
756  $ 'CGBSVX', fact, trans, n, kl,
757  $ ku, equed, imat, k,
758  $ result( k )
759  ELSE
760  WRITE( nout, fmt = 9996 )
761  $ 'CGBSVX', fact, trans, n, kl,
762  $ ku, imat, k, result( k )
763  END IF
764  nfail = nfail + 1
765  END IF
766  80 CONTINUE
767  nrun = nrun + 7 - k1
768  ELSE
769  IF( result( 1 ).GE.thresh .AND. .NOT.
770  $ prefac ) THEN
771  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
772  $ CALL aladhd( nout, path )
773  IF( prefac ) THEN
774  WRITE( nout, fmt = 9995 )'CGBSVX',
775  $ fact, trans, n, kl, ku, equed,
776  $ imat, 1, result( 1 )
777  ELSE
778  WRITE( nout, fmt = 9996 )'CGBSVX',
779  $ fact, trans, n, kl, ku, imat, 1,
780  $ result( 1 )
781  END IF
782  nfail = nfail + 1
783  nrun = nrun + 1
784  END IF
785  IF( result( 6 ).GE.thresh ) THEN
786  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
787  $ CALL aladhd( nout, path )
788  IF( prefac ) THEN
789  WRITE( nout, fmt = 9995 )'CGBSVX',
790  $ fact, trans, n, kl, ku, equed,
791  $ imat, 6, result( 6 )
792  ELSE
793  WRITE( nout, fmt = 9996 )'CGBSVX',
794  $ fact, trans, n, kl, ku, imat, 6,
795  $ result( 6 )
796  END IF
797  nfail = nfail + 1
798  nrun = nrun + 1
799  END IF
800  IF( result( 7 ).GE.thresh ) THEN
801  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
802  $ CALL aladhd( nout, path )
803  IF( prefac ) THEN
804  WRITE( nout, fmt = 9995 )'CGBSVX',
805  $ fact, trans, n, kl, ku, equed,
806  $ imat, 7, result( 7 )
807  ELSE
808  WRITE( nout, fmt = 9996 )'CGBSVX',
809  $ fact, trans, n, kl, ku, imat, 7,
810  $ result( 7 )
811  END IF
812  nfail = nfail + 1
813  nrun = nrun + 1
814  END IF
815  END IF
816 
817 * --- Test CGBSVXX ---
818 
819 * Restore the matrices A and B.
820 
821 c write(*,*) 'begin cgbsvxx testing'
822 
823  CALL clacpy( 'Full', kl+ku+1, n, asav, lda, a,
824  $ lda )
825  CALL clacpy( 'Full', n, nrhs, bsav, ldb, b, ldb )
826 
827  IF( .NOT.prefac )
828  $ CALL claset( 'Full', 2*kl+ku+1, n,
829  $ cmplx( zero ), cmplx( zero ),
830  $ afb, ldafb )
831  CALL claset( 'Full', n, nrhs,
832  $ cmplx( zero ), cmplx( zero ),
833  $ x, ldb )
834  IF( iequed.GT.1 .AND. n.GT.0 ) THEN
835 *
836 * Equilibrate the matrix if FACT = 'F' and
837 * EQUED = 'R', 'C', or 'B'.
838 *
839  CALL claqgb( n, n, kl, ku, a, lda, s,
840  $ s( n+1 ), rowcnd, colcnd, amax, equed )
841  END IF
842 *
843 * Solve the system and compute the condition number
844 * and error bounds using CGBSVXX.
845 *
846  srnamt = 'CGBSVXX'
847  n_err_bnds = 3
848  CALL cgbsvxx( fact, trans, n, kl, ku, nrhs, a, lda,
849  $ afb, ldafb, iwork, equed, s, s( n+1 ), b, ldb,
850  $ x, ldb, rcond, rpvgrw_svxx, berr, n_err_bnds,
851  $ errbnds_n, errbnds_c, 0, zero, work,
852  $ rwork, info )
853 *
854 * Check the error code from CGBSVXX.
855 *
856  IF( info.EQ.n+1 ) GOTO 90
857  IF( info.NE.izero ) THEN
858  CALL alaerh( path, 'CGBSVXX', info, izero,
859  $ fact // trans, n, n, -1, -1, nrhs,
860  $ imat, nfail, nerrs, nout )
861  GOTO 90
862  END IF
863 *
864 * Compare rpvgrw_svxx from CGESVXX with the computed
865 * reciprocal pivot growth factor RPVGRW
866 *
867 
868  IF ( info .GT. 0 .AND. info .LT. n+1 ) THEN
869  rpvgrw = cla_gbrpvgrw(n, kl, ku, info, a, lda,
870  $ afb, ldafb)
871  ELSE
872  rpvgrw = cla_gbrpvgrw(n, kl, ku, n, a, lda,
873  $ afb, ldafb)
874  ENDIF
875 
876  result( 7 ) = abs( rpvgrw-rpvgrw_svxx ) /
877  $ max( rpvgrw_svxx, rpvgrw ) /
878  $ slamch( 'E' )
879 *
880  IF( .NOT.prefac ) THEN
881 *
882 * Reconstruct matrix from factors and compute
883 * residual.
884 *
885  CALL cgbt01( n, n, kl, ku, a, lda, afb, ldafb,
886  $ iwork, work( 2*nrhs+1 ), result( 1 ) )
887  k1 = 1
888  ELSE
889  k1 = 2
890  END IF
891 *
892  IF( info.EQ.0 ) THEN
893  trfcon = .false.
894 *
895 * Compute residual of the computed solution.
896 *
897  CALL clacpy( 'Full', n, nrhs, bsav, ldb, work,
898  $ ldb )
899  CALL cgbt02( trans, n, n, kl, ku, nrhs, asav,
900  $ lda, x, ldb, work, ldb, result( 2 ) )
901 *
902 * Check solution from generated exact solution.
903 *
904  IF( nofact .OR. ( prefac .AND. lsame( equed,
905  $ 'N' ) ) ) THEN
906  CALL cget04( n, nrhs, x, ldb, xact, ldb,
907  $ rcondc, result( 3 ) )
908  ELSE
909  IF( itran.EQ.1 ) THEN
910  roldc = roldo
911  ELSE
912  roldc = roldi
913  END IF
914  CALL cget04( n, nrhs, x, ldb, xact, ldb,
915  $ roldc, result( 3 ) )
916  END IF
917  ELSE
918  trfcon = .true.
919  END IF
920 *
921 * Compare RCOND from CGBSVXX with the computed value
922 * in RCONDC.
923 *
924  result( 6 ) = sget06( rcond, rcondc )
925 *
926 * Print information about the tests that did not pass
927 * the threshold.
928 *
929  IF( .NOT.trfcon ) THEN
930  DO 45 k = k1, ntests
931  IF( result( k ).GE.thresh ) THEN
932  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
933  $ CALL aladhd( nout, path )
934  IF( prefac ) THEN
935  WRITE( nout, fmt = 9995 )'CGBSVXX',
936  $ fact, trans, n, kl, ku, equed,
937  $ imat, k, result( k )
938  ELSE
939  WRITE( nout, fmt = 9996 )'CGBSVXX',
940  $ fact, trans, n, kl, ku, imat, k,
941  $ result( k )
942  END IF
943  nfail = nfail + 1
944  END IF
945  45 CONTINUE
946  nrun = nrun + 7 - k1
947  ELSE
948  IF( result( 1 ).GE.thresh .AND. .NOT.prefac )
949  $ THEN
950  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
951  $ CALL aladhd( nout, path )
952  IF( prefac ) THEN
953  WRITE( nout, fmt = 9995 )'CGBSVXX', fact,
954  $ trans, n, kl, ku, equed, imat, 1,
955  $ result( 1 )
956  ELSE
957  WRITE( nout, fmt = 9996 )'CGBSVXX', fact,
958  $ trans, n, kl, ku, imat, 1,
959  $ result( 1 )
960  END IF
961  nfail = nfail + 1
962  nrun = nrun + 1
963  END IF
964  IF( result( 6 ).GE.thresh ) THEN
965  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
966  $ CALL aladhd( nout, path )
967  IF( prefac ) THEN
968  WRITE( nout, fmt = 9995 )'CGBSVXX', fact,
969  $ trans, n, kl, ku, equed, imat, 6,
970  $ result( 6 )
971  ELSE
972  WRITE( nout, fmt = 9996 )'CGBSVXX', fact,
973  $ trans, n, kl, ku, imat, 6,
974  $ result( 6 )
975  END IF
976  nfail = nfail + 1
977  nrun = nrun + 1
978  END IF
979  IF( result( 7 ).GE.thresh ) THEN
980  IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
981  $ CALL aladhd( nout, path )
982  IF( prefac ) THEN
983  WRITE( nout, fmt = 9995 )'CGBSVXX', fact,
984  $ trans, n, kl, ku, equed, imat, 7,
985  $ result( 7 )
986  ELSE
987  WRITE( nout, fmt = 9996 )'CGBSVXX', fact,
988  $ trans, n, kl, ku, imat, 7,
989  $ result( 7 )
990  END IF
991  nfail = nfail + 1
992  nrun = nrun + 1
993  END IF
994 *
995  END IF
996 *
997  90 CONTINUE
998  100 CONTINUE
999  110 CONTINUE
1000  120 CONTINUE
1001  130 CONTINUE
1002  140 CONTINUE
1003  150 CONTINUE
1004 *
1005 * Print a summary of the results.
1006 *
1007  CALL alasvm( path, nout, nfail, nrun, nerrs )
1008 *
1009 
1010 * Test Error Bounds from CGBSVXX
1011 
1012  CALL cebchvxx(thresh, path)
1013 
1014  9999 FORMAT( ' *** In CDRVGB, LA=', i5, ' is too small for N=', i5,
1015  $ ', KU=', i5, ', KL=', i5, / ' ==> Increase LA to at least ',
1016  $ i5 )
1017  9998 FORMAT( ' *** In CDRVGB, LAFB=', i5, ' is too small for N=', i5,
1018  $ ', KU=', i5, ', KL=', i5, /
1019  $ ' ==> Increase LAFB to at least ', i5 )
1020  9997 FORMAT( 1x, a, ', N=', i5, ', KL=', i5, ', KU=', i5, ', type ',
1021  $ i1, ', test(', i1, ')=', g12.5 )
1022  9996 FORMAT( 1x, a, '( ''', a1, ''',''', a1, ''',', i5, ',', i5, ',',
1023  $ i5, ',...), type ', i1, ', test(', i1, ')=', g12.5 )
1024  9995 FORMAT( 1x, a, '( ''', a1, ''',''', a1, ''',', i5, ',', i5, ',',
1025  $ i5, ',...), EQUED=''', a1, ''', type ', i1, ', test(', i1,
1026  $ ')=', g12.5 )
1027 *
1028  RETURN
1029 *
1030 * End of CDRVGB
1031 *
1032  END
subroutine alasvm(TYPE, NOUT, NFAIL, NRUN, NERRS)
ALASVM
Definition: alasvm.f:73
subroutine xlaenv(ISPEC, NVALUE)
XLAENV
Definition: xlaenv.f:81
subroutine aladhd(IOUNIT, PATH)
ALADHD
Definition: aladhd.f:90
subroutine alaerh(PATH, SUBNAM, INFO, INFOE, OPTS, M, N, KL, KU, N5, IMAT, NFAIL, NERRS, NOUT)
ALAERH
Definition: alaerh.f:147
subroutine clarhs(PATH, XTYPE, UPLO, TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, ISEED, INFO)
CLARHS
Definition: clarhs.f:209
subroutine clatb4(PATH, IMAT, M, N, TYPE, KL, KU, ANORM, MODE, CNDNUM, DIST)
CLATB4
Definition: clatb4.f:121
subroutine cget04(N, NRHS, X, LDX, XACT, LDXACT, RCOND, RESID)
CGET04
Definition: cget04.f:102
subroutine cgbt05(TRANS, N, KL, KU, NRHS, AB, LDAB, B, LDB, X, LDX, XACT, LDXACT, FERR, BERR, RESLTS)
CGBT05
Definition: cgbt05.f:176
subroutine cebchvxx(THRESH, PATH)
CEBCHVXX
Definition: cebchvxx.f:96
subroutine cdrvgb(DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, A, LA, AFB, LAFB, ASAV, B, BSAV, X, XACT, S, WORK, RWORK, IWORK, NOUT)
CDRVGB
Definition: cdrvgb.f:172
subroutine cgbt01(M, N, KL, KU, A, LDA, AFAC, LDAFAC, IPIV, WORK, RESID)
CGBT01
Definition: cgbt01.f:126
subroutine cgbt02(TRANS, M, N, KL, KU, NRHS, A, LDA, X, LDX, B, LDB, RESID)
CGBT02
Definition: cgbt02.f:139
subroutine cerrvx(PATH, NUNIT)
CERRVX
Definition: cerrvx.f:55
subroutine clatms(M, N, DIST, ISEED, SYM, D, MODE, COND, DMAX, KL, KU, PACK, A, LDA, WORK, INFO)
CLATMS
Definition: clatms.f:332
subroutine claqgb(M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX, EQUED)
CLAQGB scales a general band matrix, using row and column scaling factors computed by sgbequ.
Definition: claqgb.f:160
subroutine cgbtrf(M, N, KL, KU, AB, LDAB, IPIV, INFO)
CGBTRF
Definition: cgbtrf.f:144
real function cla_gbrpvgrw(N, KL, KU, NCOLS, AB, LDAB, AFB, LDAFB)
CLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix.
Definition: cla_gbrpvgrw.f:117
subroutine cgbtrs(TRANS, N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
CGBTRS
Definition: cgbtrs.f:138
subroutine cgbequ(M, N, KL, KU, AB, LDAB, R, C, ROWCND, COLCND, AMAX, INFO)
CGBEQU
Definition: cgbequ.f:154
subroutine cgbsvxx(FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX, RCOND, RPVGRW, BERR, N_ERR_BNDS, ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, RWORK, INFO)
CGBSVXX computes the solution to system of linear equations A * X = B for GB matrices
Definition: cgbsvxx.f:563
subroutine cgbsvx(FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX, RCOND, FERR, BERR, WORK, RWORK, INFO)
CGBSVX computes the solution to system of linear equations A * X = B for GB matrices
Definition: cgbsvx.f:370
subroutine cgbsv(N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO)
CGBSV computes the solution to system of linear equations A * X = B for GB matrices (simple driver)
Definition: cgbsv.f:162
subroutine claset(UPLO, M, N, ALPHA, BETA, A, LDA)
CLASET initializes the off-diagonal elements and the diagonal elements of a matrix to given values.
Definition: claset.f:106
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:103