LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dla_gbrfsx_extended.f
Go to the documentation of this file.
1*> \brief \b DLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded matrices by performing extra-precise iterative refinement and provides error bounds and backward error estimates for the solution.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DLA_GBRFSX_EXTENDED + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dla_gbrfsx_extended.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dla_gbrfsx_extended.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dla_gbrfsx_extended.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DLA_GBRFSX_EXTENDED( PREC_TYPE, TRANS_TYPE, N, KL, KU,
20* NRHS, AB, LDAB, AFB, LDAFB, IPIV,
21* COLEQU, C, B, LDB, Y, LDY,
22* BERR_OUT, N_NORMS, ERR_BNDS_NORM,
23* ERR_BNDS_COMP, RES, AYB, DY,
24* Y_TAIL, RCOND, ITHRESH, RTHRESH,
25* DZ_UB, IGNORE_CWISE, INFO )
26*
27* .. Scalar Arguments ..
28* INTEGER INFO, LDAB, LDAFB, LDB, LDY, N, KL, KU, NRHS,
29* $ PREC_TYPE, TRANS_TYPE, N_NORMS, ITHRESH
30* LOGICAL COLEQU, IGNORE_CWISE
31* DOUBLE PRECISION RTHRESH, DZ_UB
32* ..
33* .. Array Arguments ..
34* INTEGER IPIV( * )
35* DOUBLE PRECISION AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
36* $ Y( LDY, * ), RES(*), DY(*), Y_TAIL(*)
37* DOUBLE PRECISION C( * ), AYB(*), RCOND, BERR_OUT(*),
38* $ ERR_BNDS_NORM( NRHS, * ),
39* $ ERR_BNDS_COMP( NRHS, * )
40* ..
41*
42*
43*> \par Purpose:
44* =============
45*>
46*> \verbatim
47*>
48*>
49*> DLA_GBRFSX_EXTENDED improves the computed solution to a system of
50*> linear equations by performing extra-precise iterative refinement
51*> and provides error bounds and backward error estimates for the solution.
52*> This subroutine is called by DGBRFSX to perform iterative refinement.
53*> In addition to normwise error bound, the code provides maximum
54*> componentwise error bound if possible. See comments for ERR_BNDS_NORM
55*> and ERR_BNDS_COMP for details of the error bounds. Note that this
56*> subroutine is only responsible for setting the second fields of
57*> ERR_BNDS_NORM and ERR_BNDS_COMP.
58*> \endverbatim
59*
60* Arguments:
61* ==========
62*
63*> \param[in] PREC_TYPE
64*> \verbatim
65*> PREC_TYPE is INTEGER
66*> Specifies the intermediate precision to be used in refinement.
67*> The value is defined by ILAPREC(P) where P is a CHARACTER and P
68*> = 'S': Single
69*> = 'D': Double
70*> = 'I': Indigenous
71*> = 'X' or 'E': Extra
72*> \endverbatim
73*>
74*> \param[in] TRANS_TYPE
75*> \verbatim
76*> TRANS_TYPE is INTEGER
77*> Specifies the transposition operation on A.
78*> The value is defined by ILATRANS(T) where T is a CHARACTER and T
79*> = 'N': No transpose
80*> = 'T': Transpose
81*> = 'C': Conjugate transpose
82*> \endverbatim
83*>
84*> \param[in] N
85*> \verbatim
86*> N is INTEGER
87*> The number of linear equations, i.e., the order of the
88*> matrix A. N >= 0.
89*> \endverbatim
90*>
91*> \param[in] KL
92*> \verbatim
93*> KL is INTEGER
94*> The number of subdiagonals within the band of A. KL >= 0.
95*> \endverbatim
96*>
97*> \param[in] KU
98*> \verbatim
99*> KU is INTEGER
100*> The number of superdiagonals within the band of A. KU >= 0
101*> \endverbatim
102*>
103*> \param[in] NRHS
104*> \verbatim
105*> NRHS is INTEGER
106*> The number of right-hand-sides, i.e., the number of columns of the
107*> matrix B.
108*> \endverbatim
109*>
110*> \param[in] AB
111*> \verbatim
112*> AB is DOUBLE PRECISION array, dimension (LDAB,N)
113*> On entry, the N-by-N matrix AB.
114*> \endverbatim
115*>
116*> \param[in] LDAB
117*> \verbatim
118*> LDAB is INTEGER
119*> The leading dimension of the array AB. LDBA >= max(1,N).
120*> \endverbatim
121*>
122*> \param[in] AFB
123*> \verbatim
124*> AFB is DOUBLE PRECISION array, dimension (LDAFB,N)
125*> The factors L and U from the factorization
126*> A = P*L*U as computed by DGBTRF.
127*> \endverbatim
128*>
129*> \param[in] LDAFB
130*> \verbatim
131*> LDAFB is INTEGER
132*> The leading dimension of the array AF. LDAFB >= max(1,N).
133*> \endverbatim
134*>
135*> \param[in] IPIV
136*> \verbatim
137*> IPIV is INTEGER array, dimension (N)
138*> The pivot indices from the factorization A = P*L*U
139*> as computed by DGBTRF; row i of the matrix was interchanged
140*> with row IPIV(i).
141*> \endverbatim
142*>
143*> \param[in] COLEQU
144*> \verbatim
145*> COLEQU is LOGICAL
146*> If .TRUE. then column equilibration was done to A before calling
147*> this routine. This is needed to compute the solution and error
148*> bounds correctly.
149*> \endverbatim
150*>
151*> \param[in] C
152*> \verbatim
153*> C is DOUBLE PRECISION array, dimension (N)
154*> The column scale factors for A. If COLEQU = .FALSE., C
155*> is not accessed. If C is input, each element of C should be a power
156*> of the radix to ensure a reliable solution and error estimates.
157*> Scaling by powers of the radix does not cause rounding errors unless
158*> the result underflows or overflows. Rounding errors during scaling
159*> lead to refining with a matrix that is not equivalent to the
160*> input matrix, producing error estimates that may not be
161*> reliable.
162*> \endverbatim
163*>
164*> \param[in] B
165*> \verbatim
166*> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
167*> The right-hand-side matrix B.
168*> \endverbatim
169*>
170*> \param[in] LDB
171*> \verbatim
172*> LDB is INTEGER
173*> The leading dimension of the array B. LDB >= max(1,N).
174*> \endverbatim
175*>
176*> \param[in,out] Y
177*> \verbatim
178*> Y is DOUBLE PRECISION array, dimension (LDY,NRHS)
179*> On entry, the solution matrix X, as computed by DGBTRS.
180*> On exit, the improved solution matrix Y.
181*> \endverbatim
182*>
183*> \param[in] LDY
184*> \verbatim
185*> LDY is INTEGER
186*> The leading dimension of the array Y. LDY >= max(1,N).
187*> \endverbatim
188*>
189*> \param[out] BERR_OUT
190*> \verbatim
191*> BERR_OUT is DOUBLE PRECISION array, dimension (NRHS)
192*> On exit, BERR_OUT(j) contains the componentwise relative backward
193*> error for right-hand-side j from the formula
194*> max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
195*> where abs(Z) is the componentwise absolute value of the matrix
196*> or vector Z. This is computed by DLA_LIN_BERR.
197*> \endverbatim
198*>
199*> \param[in] N_NORMS
200*> \verbatim
201*> N_NORMS is INTEGER
202*> Determines which error bounds to return (see ERR_BNDS_NORM
203*> and ERR_BNDS_COMP).
204*> If N_NORMS >= 1 return normwise error bounds.
205*> If N_NORMS >= 2 return componentwise error bounds.
206*> \endverbatim
207*>
208*> \param[in,out] ERR_BNDS_NORM
209*> \verbatim
210*> ERR_BNDS_NORM is DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
211*> For each right-hand side, this array contains information about
212*> various error bounds and condition numbers corresponding to the
213*> normwise relative error, which is defined as follows:
214*>
215*> Normwise relative error in the ith solution vector:
216*> max_j (abs(XTRUE(j,i) - X(j,i)))
217*> ------------------------------
218*> max_j abs(X(j,i))
219*>
220*> The array is indexed by the type of error information as described
221*> below. There currently are up to three pieces of information
222*> returned.
223*>
224*> The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
225*> right-hand side.
226*>
227*> The second index in ERR_BNDS_NORM(:,err) contains the following
228*> three fields:
229*> err = 1 "Trust/don't trust" boolean. Trust the answer if the
230*> reciprocal condition number is less than the threshold
231*> sqrt(n) * slamch('Epsilon').
232*>
233*> err = 2 "Guaranteed" error bound: The estimated forward error,
234*> almost certainly within a factor of 10 of the true error
235*> so long as the next entry is greater than the threshold
236*> sqrt(n) * slamch('Epsilon'). This error bound should only
237*> be trusted if the previous boolean is true.
238*>
239*> err = 3 Reciprocal condition number: Estimated normwise
240*> reciprocal condition number. Compared with the threshold
241*> sqrt(n) * slamch('Epsilon') to determine if the error
242*> estimate is "guaranteed". These reciprocal condition
243*> numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
244*> appropriately scaled matrix Z.
245*> Let Z = S*A, where S scales each row by a power of the
246*> radix so all absolute row sums of Z are approximately 1.
247*>
248*> This subroutine is only responsible for setting the second field
249*> above.
250*> See Lapack Working Note 165 for further details and extra
251*> cautions.
252*> \endverbatim
253*>
254*> \param[in,out] ERR_BNDS_COMP
255*> \verbatim
256*> ERR_BNDS_COMP is DOUBLE PRECISION array, dimension (NRHS, N_ERR_BNDS)
257*> For each right-hand side, this array contains information about
258*> various error bounds and condition numbers corresponding to the
259*> componentwise relative error, which is defined as follows:
260*>
261*> Componentwise relative error in the ith solution vector:
262*> abs(XTRUE(j,i) - X(j,i))
263*> max_j ----------------------
264*> abs(X(j,i))
265*>
266*> The array is indexed by the right-hand side i (on which the
267*> componentwise relative error depends), and the type of error
268*> information as described below. There currently are up to three
269*> pieces of information returned for each right-hand side. If
270*> componentwise accuracy is not requested (PARAMS(3) = 0.0), then
271*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most
272*> the first (:,N_ERR_BNDS) entries are returned.
273*>
274*> The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
275*> right-hand side.
276*>
277*> The second index in ERR_BNDS_COMP(:,err) contains the following
278*> three fields:
279*> err = 1 "Trust/don't trust" boolean. Trust the answer if the
280*> reciprocal condition number is less than the threshold
281*> sqrt(n) * slamch('Epsilon').
282*>
283*> err = 2 "Guaranteed" error bound: The estimated forward error,
284*> almost certainly within a factor of 10 of the true error
285*> so long as the next entry is greater than the threshold
286*> sqrt(n) * slamch('Epsilon'). This error bound should only
287*> be trusted if the previous boolean is true.
288*>
289*> err = 3 Reciprocal condition number: Estimated componentwise
290*> reciprocal condition number. Compared with the threshold
291*> sqrt(n) * slamch('Epsilon') to determine if the error
292*> estimate is "guaranteed". These reciprocal condition
293*> numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
294*> appropriately scaled matrix Z.
295*> Let Z = S*(A*diag(x)), where x is the solution for the
296*> current right-hand side and S scales each row of
297*> A*diag(x) by a power of the radix so all absolute row
298*> sums of Z are approximately 1.
299*>
300*> This subroutine is only responsible for setting the second field
301*> above.
302*> See Lapack Working Note 165 for further details and extra
303*> cautions.
304*> \endverbatim
305*>
306*> \param[in] RES
307*> \verbatim
308*> RES is DOUBLE PRECISION array, dimension (N)
309*> Workspace to hold the intermediate residual.
310*> \endverbatim
311*>
312*> \param[in] AYB
313*> \verbatim
314*> AYB is DOUBLE PRECISION array, dimension (N)
315*> Workspace. This can be the same workspace passed for Y_TAIL.
316*> \endverbatim
317*>
318*> \param[in] DY
319*> \verbatim
320*> DY is DOUBLE PRECISION array, dimension (N)
321*> Workspace to hold the intermediate solution.
322*> \endverbatim
323*>
324*> \param[in] Y_TAIL
325*> \verbatim
326*> Y_TAIL is DOUBLE PRECISION array, dimension (N)
327*> Workspace to hold the trailing bits of the intermediate solution.
328*> \endverbatim
329*>
330*> \param[in] RCOND
331*> \verbatim
332*> RCOND is DOUBLE PRECISION
333*> Reciprocal scaled condition number. This is an estimate of the
334*> reciprocal Skeel condition number of the matrix A after
335*> equilibration (if done). If this is less than the machine
336*> precision (in particular, if it is zero), the matrix is singular
337*> to working precision. Note that the error may still be small even
338*> if this number is very small and the matrix appears ill-
339*> conditioned.
340*> \endverbatim
341*>
342*> \param[in] ITHRESH
343*> \verbatim
344*> ITHRESH is INTEGER
345*> The maximum number of residual computations allowed for
346*> refinement. The default is 10. For 'aggressive' set to 100 to
347*> permit convergence using approximate factorizations or
348*> factorizations other than LU. If the factorization uses a
349*> technique other than Gaussian elimination, the guarantees in
350*> ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
351*> \endverbatim
352*>
353*> \param[in] RTHRESH
354*> \verbatim
355*> RTHRESH is DOUBLE PRECISION
356*> Determines when to stop refinement if the error estimate stops
357*> decreasing. Refinement will stop when the next solution no longer
358*> satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
359*> the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
360*> default value is 0.5. For 'aggressive' set to 0.9 to permit
361*> convergence on extremely ill-conditioned matrices. See LAWN 165
362*> for more details.
363*> \endverbatim
364*>
365*> \param[in] DZ_UB
366*> \verbatim
367*> DZ_UB is DOUBLE PRECISION
368*> Determines when to start considering componentwise convergence.
369*> Componentwise convergence is only considered after each component
370*> of the solution Y is stable, which we define as the relative
371*> change in each component being less than DZ_UB. The default value
372*> is 0.25, requiring the first bit to be stable. See LAWN 165 for
373*> more details.
374*> \endverbatim
375*>
376*> \param[in] IGNORE_CWISE
377*> \verbatim
378*> IGNORE_CWISE is LOGICAL
379*> If .TRUE. then ignore componentwise convergence. Default value
380*> is .FALSE..
381*> \endverbatim
382*>
383*> \param[out] INFO
384*> \verbatim
385*> INFO is INTEGER
386*> = 0: Successful exit.
387*> < 0: if INFO = -i, the ith argument to DGBTRS had an illegal
388*> value
389*> \endverbatim
390*
391* Authors:
392* ========
393*
394*> \author Univ. of Tennessee
395*> \author Univ. of California Berkeley
396*> \author Univ. of Colorado Denver
397*> \author NAG Ltd.
398*
399*> \ingroup la_gbrfsx_extended
400*
401* =====================================================================
402 SUBROUTINE dla_gbrfsx_extended( PREC_TYPE, TRANS_TYPE, N, KL,
403 $ KU,
404 $ NRHS, AB, LDAB, AFB, LDAFB, IPIV,
405 $ COLEQU, C, B, LDB, Y, LDY,
406 $ BERR_OUT, N_NORMS, ERR_BNDS_NORM,
407 $ ERR_BNDS_COMP, RES, AYB, DY,
408 $ Y_TAIL, RCOND, ITHRESH, RTHRESH,
409 $ DZ_UB, IGNORE_CWISE, INFO )
410*
411* -- LAPACK computational routine --
412* -- LAPACK is a software package provided by Univ. of Tennessee, --
413* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
414*
415* .. Scalar Arguments ..
416 INTEGER INFO, LDAB, LDAFB, LDB, LDY, N, KL, KU, NRHS,
417 $ PREC_TYPE, TRANS_TYPE, N_NORMS, ITHRESH
418 LOGICAL COLEQU, IGNORE_CWISE
419 DOUBLE PRECISION RTHRESH, DZ_UB
420* ..
421* .. Array Arguments ..
422 INTEGER IPIV( * )
423 DOUBLE PRECISION AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
424 $ Y( LDY, * ), RES(*), DY(*), Y_TAIL(*)
425 DOUBLE PRECISION C( * ), AYB(*), RCOND, BERR_OUT(*),
426 $ err_bnds_norm( nrhs, * ),
427 $ err_bnds_comp( nrhs, * )
428* ..
429*
430* =====================================================================
431*
432* .. Local Scalars ..
433 CHARACTER TRANS
434 INTEGER CNT, I, J, M, X_STATE, Z_STATE, Y_PREC_STATE
435 DOUBLE PRECISION YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
436 $ DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
437 $ DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
438 $ EPS, HUGEVAL, INCR_THRESH
439 LOGICAL INCR_PREC
440* ..
441* .. Parameters ..
442 INTEGER UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
443 $ NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
444 $ EXTRA_Y
445 PARAMETER ( UNSTABLE_STATE = 0, working_state = 1,
446 $ conv_state = 2, noprog_state = 3 )
447 parameter( base_residual = 0, extra_residual = 1,
448 $ extra_y = 2 )
449 INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
450 INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
451 INTEGER CMP_ERR_I, PIV_GROWTH_I
452 parameter( final_nrm_err_i = 1, final_cmp_err_i = 2,
453 $ berr_i = 3 )
454 parameter( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
455 parameter( cmp_rcond_i = 7, cmp_err_i = 8,
456 $ piv_growth_i = 9 )
457 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
458 $ la_linrx_cwise_i
459 parameter( la_linrx_itref_i = 1,
460 $ la_linrx_ithresh_i = 2 )
461 parameter( la_linrx_cwise_i = 3 )
462 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
463 $ LA_LINRX_RCOND_I
464 parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
465 parameter( la_linrx_rcond_i = 3 )
466* ..
467* .. External Subroutines ..
468 EXTERNAL daxpy, dcopy, dgbtrs, dgbmv,
469 $ blas_dgbmv_x,
470 $ blas_dgbmv2_x, dla_gbamv, dla_wwaddw, dlamch,
472 DOUBLE PRECISION DLAMCH
473 CHARACTER CHLA_TRANSTYPE
474* ..
475* .. Intrinsic Functions ..
476 INTRINSIC abs, max, min
477* ..
478* .. Executable Statements ..
479*
480 IF (info.NE.0) RETURN
481 trans = chla_transtype(trans_type)
482 eps = dlamch( 'Epsilon' )
483 hugeval = dlamch( 'Overflow' )
484* Force HUGEVAL to Inf
485 hugeval = hugeval * hugeval
486* Using HUGEVAL may lead to spurious underflows.
487 incr_thresh = dble( n ) * eps
488 m = kl+ku+1
489
490 DO j = 1, nrhs
491 y_prec_state = extra_residual
492 IF ( y_prec_state .EQ. extra_y ) THEN
493 DO i = 1, n
494 y_tail( i ) = 0.0d+0
495 END DO
496 END IF
497
498 dxrat = 0.0d+0
499 dxratmax = 0.0d+0
500 dzrat = 0.0d+0
501 dzratmax = 0.0d+0
502 final_dx_x = hugeval
503 final_dz_z = hugeval
504 prevnormdx = hugeval
505 prev_dz_z = hugeval
506 dz_z = hugeval
507 dx_x = hugeval
508
509 x_state = working_state
510 z_state = unstable_state
511 incr_prec = .false.
512
513 DO cnt = 1, ithresh
514*
515* Compute residual RES = B_s - op(A_s) * Y,
516* op(A) = A, A**T, or A**H depending on TRANS (and type).
517*
518 CALL dcopy( n, b( 1, j ), 1, res, 1 )
519 IF ( y_prec_state .EQ. base_residual ) THEN
520 CALL dgbmv( trans, m, n, kl, ku, -1.0d+0, ab, ldab,
521 $ y( 1, j ), 1, 1.0d+0, res, 1 )
522 ELSE IF ( y_prec_state .EQ. extra_residual ) THEN
523 CALL blas_dgbmv_x( trans_type, n, n, kl, ku,
524 $ -1.0d+0, ab, ldab, y( 1, j ), 1, 1.0d+0, res, 1,
525 $ prec_type )
526 ELSE
527 CALL blas_dgbmv2_x( trans_type, n, n, kl, ku, -1.0d+0,
528 $ ab, ldab, y( 1, j ), y_tail, 1, 1.0d+0, res, 1,
529 $ prec_type )
530 END IF
531
532! XXX: RES is no longer needed.
533 CALL dcopy( n, res, 1, dy, 1 )
534 CALL dgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv, dy,
535 $ n,
536 $ info )
537*
538* Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
539*
540 normx = 0.0d+0
541 normy = 0.0d+0
542 normdx = 0.0d+0
543 dz_z = 0.0d+0
544 ymin = hugeval
545
546 DO i = 1, n
547 yk = abs( y( i, j ) )
548 dyk = abs( dy( i ) )
549
550 IF ( yk .NE. 0.0d+0 ) THEN
551 dz_z = max( dz_z, dyk / yk )
552 ELSE IF ( dyk .NE. 0.0d+0 ) THEN
553 dz_z = hugeval
554 END IF
555
556 ymin = min( ymin, yk )
557
558 normy = max( normy, yk )
559
560 IF ( colequ ) THEN
561 normx = max( normx, yk * c( i ) )
562 normdx = max( normdx, dyk * c( i ) )
563 ELSE
564 normx = normy
565 normdx = max( normdx, dyk )
566 END IF
567 END DO
568
569 IF ( normx .NE. 0.0d+0 ) THEN
570 dx_x = normdx / normx
571 ELSE IF ( normdx .EQ. 0.0d+0 ) THEN
572 dx_x = 0.0d+0
573 ELSE
574 dx_x = hugeval
575 END IF
576
577 dxrat = normdx / prevnormdx
578 dzrat = dz_z / prev_dz_z
579*
580* Check termination criteria.
581*
582 IF ( .NOT.ignore_cwise
583 $ .AND. ymin*rcond .LT. incr_thresh*normy
584 $ .AND. y_prec_state .LT. extra_y )
585 $ incr_prec = .true.
586
587 IF ( x_state .EQ. noprog_state .AND. dxrat .LE. rthresh )
588 $ x_state = working_state
589 IF ( x_state .EQ. working_state ) THEN
590 IF ( dx_x .LE. eps ) THEN
591 x_state = conv_state
592 ELSE IF ( dxrat .GT. rthresh ) THEN
593 IF ( y_prec_state .NE. extra_y ) THEN
594 incr_prec = .true.
595 ELSE
596 x_state = noprog_state
597 END IF
598 ELSE
599 IF ( dxrat .GT. dxratmax ) dxratmax = dxrat
600 END IF
601 IF ( x_state .GT. working_state ) final_dx_x = dx_x
602 END IF
603
604 IF ( z_state .EQ. unstable_state .AND. dz_z .LE. dz_ub )
605 $ z_state = working_state
606 IF ( z_state .EQ. noprog_state .AND. dzrat .LE. rthresh )
607 $ z_state = working_state
608 IF ( z_state .EQ. working_state ) THEN
609 IF ( dz_z .LE. eps ) THEN
610 z_state = conv_state
611 ELSE IF ( dz_z .GT. dz_ub ) THEN
612 z_state = unstable_state
613 dzratmax = 0.0d+0
614 final_dz_z = hugeval
615 ELSE IF ( dzrat .GT. rthresh ) THEN
616 IF ( y_prec_state .NE. extra_y ) THEN
617 incr_prec = .true.
618 ELSE
619 z_state = noprog_state
620 END IF
621 ELSE
622 IF ( dzrat .GT. dzratmax ) dzratmax = dzrat
623 END IF
624 IF ( z_state .GT. working_state ) final_dz_z = dz_z
625 END IF
626*
627* Exit if both normwise and componentwise stopped working,
628* but if componentwise is unstable, let it go at least two
629* iterations.
630*
631 IF ( x_state.NE.working_state ) THEN
632 IF ( ignore_cwise ) GOTO 666
633 IF ( z_state.EQ.noprog_state .OR. z_state.EQ.conv_state )
634 $ GOTO 666
635 IF ( z_state.EQ.unstable_state .AND. cnt.GT.1 ) GOTO 666
636 END IF
637
638 IF ( incr_prec ) THEN
639 incr_prec = .false.
640 y_prec_state = y_prec_state + 1
641 DO i = 1, n
642 y_tail( i ) = 0.0d+0
643 END DO
644 END IF
645
646 prevnormdx = normdx
647 prev_dz_z = dz_z
648*
649* Update solution.
650*
651 IF (y_prec_state .LT. extra_y) THEN
652 CALL daxpy( n, 1.0d+0, dy, 1, y(1,j), 1 )
653 ELSE
654 CALL dla_wwaddw( n, y(1,j), y_tail, dy )
655 END IF
656
657 END DO
658* Target of "IF (Z_STOP .AND. X_STOP)". Sun's f77 won't EXIT.
659 666 CONTINUE
660*
661* Set final_* when cnt hits ithresh.
662*
663 IF ( x_state .EQ. working_state ) final_dx_x = dx_x
664 IF ( z_state .EQ. working_state ) final_dz_z = dz_z
665*
666* Compute error bounds.
667*
668 IF ( n_norms .GE. 1 ) THEN
669 err_bnds_norm( j, la_linrx_err_i ) =
670 $ final_dx_x / (1 - dxratmax)
671 END IF
672 IF (n_norms .GE. 2) THEN
673 err_bnds_comp( j, la_linrx_err_i ) =
674 $ final_dz_z / (1 - dzratmax)
675 END IF
676*
677* Compute componentwise relative backward error from formula
678* max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
679* where abs(Z) is the componentwise absolute value of the matrix
680* or vector Z.
681*
682* Compute residual RES = B_s - op(A_s) * Y,
683* op(A) = A, A**T, or A**H depending on TRANS (and type).
684*
685 CALL dcopy( n, b( 1, j ), 1, res, 1 )
686 CALL dgbmv(trans, n, n, kl, ku, -1.0d+0, ab, ldab, y(1,j),
687 $ 1, 1.0d+0, res, 1 )
688
689 DO i = 1, n
690 ayb( i ) = abs( b( i, j ) )
691 END DO
692*
693* Compute abs(op(A_s))*abs(Y) + abs(B_s).
694*
695 CALL dla_gbamv( trans_type, n, n, kl, ku, 1.0d+0,
696 $ ab, ldab, y(1, j), 1, 1.0d+0, ayb, 1 )
697
698 CALL dla_lin_berr( n, n, 1, res, ayb, berr_out( j ) )
699*
700* End of loop for each RHS
701*
702 END DO
703*
704 RETURN
705*
706* End of DLA_GBRFSX_EXTENDED
707*
708 END
subroutine daxpy(n, da, dx, incx, dy, incy)
DAXPY
Definition daxpy.f:89
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
Definition dcopy.f:82
subroutine dgbmv(trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy)
DGBMV
Definition dgbmv.f:188
subroutine dgbtrs(trans, n, kl, ku, nrhs, ab, ldab, ipiv, b, ldb, info)
DGBTRS
Definition dgbtrs.f:137
subroutine dla_gbamv(trans, m, n, kl, ku, alpha, ab, ldab, x, incx, beta, y, incy)
DLA_GBAMV performs a matrix-vector operation to calculate error bounds.
Definition dla_gbamv.f:185
subroutine dla_gbrfsx_extended(prec_type, trans_type, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, colequ, c, b, ldb, y, ldy, berr_out, n_norms, err_bnds_norm, err_bnds_comp, res, ayb, dy, y_tail, rcond, ithresh, rthresh, dz_ub, ignore_cwise, info)
DLA_GBRFSX_EXTENDED improves the computed solution to a system of linear equations for general banded...
subroutine dla_lin_berr(n, nz, nrhs, res, ayb, berr)
DLA_LIN_BERR computes a component-wise relative backward error.
character *1 function chla_transtype(trans)
CHLA_TRANSTYPE
subroutine dla_wwaddw(n, x, y, w)
DLA_WWADDW adds a vector into a doubled-single vector.
Definition dla_wwaddw.f:79
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69