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