001:       SUBROUTINE CLA_PORFSX_EXTENDED( PREC_TYPE, UPLO, N, NRHS, A, LDA,
002:      $                                AF, LDAF, COLEQU, C, B, LDB, Y,
003:      $                                LDY, BERR_OUT, N_NORMS,
004:      $                                ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
005:      $                                AYB, DY, Y_TAIL, RCOND, ITHRESH,
006:      $                                RTHRESH, DZ_UB, IGNORE_CWISE,
007:      $                                INFO )
008: *
009: *     -- LAPACK routine (version 3.2.1)                                 --
010: *     -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and --
011: *     -- Jason Riedy of Univ. of California Berkeley.                 --
012: *     -- April 2009                                                   --
013: *
014: *     -- LAPACK is a software package provided by Univ. of Tennessee, --
015: *     -- Univ. of California Berkeley and NAG Ltd.                    --
016: *
017:       IMPLICIT NONE
018: *     ..
019: *     .. Scalar Arguments ..
020:       INTEGER            INFO, LDA, LDAF, LDB, LDY, N, NRHS, PREC_TYPE,
021:      $                   N_NORMS, ITHRESH
022:       CHARACTER          UPLO
023:       LOGICAL            COLEQU, IGNORE_CWISE
024:       REAL               RTHRESH, DZ_UB
025: *     ..
026: *     .. Array Arguments ..
027:       COMPLEX            A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
028:      $                   Y( LDY, * ), RES( * ), DY( * ), Y_TAIL( * )
029:       REAL               C( * ), AYB( * ), RCOND, BERR_OUT( * ),
030:      $                   ERR_BNDS_NORM( NRHS, * ),
031:      $                   ERR_BNDS_COMP( NRHS, * )
032: *     ..
033: *
034: *  Purpose
035: *  =======
036: *
037: *  CLA_PORFSX_EXTENDED improves the computed solution to a system of
038: *  linear equations by performing extra-precise iterative refinement
039: *  and provides error bounds and backward error estimates for the solution.
040: *  This subroutine is called by CPORFSX to perform iterative refinement.
041: *  In addition to normwise error bound, the code provides maximum
042: *  componentwise error bound if possible. See comments for ERR_BNDS_NORM
043: *  and ERR_BNDS_COMP for details of the error bounds. Note that this
044: *  subroutine is only resonsible for setting the second fields of
045: *  ERR_BNDS_NORM and ERR_BNDS_COMP.
046: *
047: *  Arguments
048: *  =========
049: *
050: *     PREC_TYPE      (input) INTEGER
051: *     Specifies the intermediate precision to be used in refinement.
052: *     The value is defined by ILAPREC(P) where P is a CHARACTER and
053: *     P    = 'S':  Single
054: *          = 'D':  Double
055: *          = 'I':  Indigenous
056: *          = 'X', 'E':  Extra
057: *
058: *     UPLO    (input) CHARACTER*1
059: *       = 'U':  Upper triangle of A is stored;
060: *       = 'L':  Lower triangle of A is stored.
061: *
062: *     N              (input) INTEGER
063: *     The number of linear equations, i.e., the order of the
064: *     matrix A.  N >= 0.
065: *
066: *     NRHS           (input) INTEGER
067: *     The number of right-hand-sides, i.e., the number of columns of the
068: *     matrix B.
069: *
070: *     A              (input) COMPLEX array, dimension (LDA,N)
071: *     On entry, the N-by-N matrix A.
072: *
073: *     LDA            (input) INTEGER
074: *     The leading dimension of the array A.  LDA >= max(1,N).
075: *
076: *     AF             (input) COMPLEX array, dimension (LDAF,N)
077: *     The triangular factor U or L from the Cholesky factorization
078: *     A = U**T*U or A = L*L**T, as computed by CPOTRF.
079: *
080: *     LDAF           (input) INTEGER
081: *     The leading dimension of the array AF.  LDAF >= max(1,N).
082: *
083: *     COLEQU         (input) LOGICAL
084: *     If .TRUE. then column equilibration was done to A before calling
085: *     this routine. This is needed to compute the solution and error
086: *     bounds correctly.
087: *
088: *     C              (input) REAL array, dimension (N)
089: *     The column scale factors for A. If COLEQU = .FALSE., C
090: *     is not accessed. If C is input, each element of C should be a power
091: *     of the radix to ensure a reliable solution and error estimates.
092: *     Scaling by powers of the radix does not cause rounding errors unless
093: *     the result underflows or overflows. Rounding errors during scaling
094: *     lead to refining with a matrix that is not equivalent to the
095: *     input matrix, producing error estimates that may not be
096: *     reliable.
097: *
098: *     B              (input) COMPLEX array, dimension (LDB,NRHS)
099: *     The right-hand-side matrix B.
100: *
101: *     LDB            (input) INTEGER
102: *     The leading dimension of the array B.  LDB >= max(1,N).
103: *
104: *     Y              (input/output) COMPLEX array, dimension
105: *                    (LDY,NRHS)
106: *     On entry, the solution matrix X, as computed by CPOTRS.
107: *     On exit, the improved solution matrix Y.
108: *
109: *     LDY            (input) INTEGER
110: *     The leading dimension of the array Y.  LDY >= max(1,N).
111: *
112: *     BERR_OUT       (output) REAL array, dimension (NRHS)
113: *     On exit, BERR_OUT(j) contains the componentwise relative backward
114: *     error for right-hand-side j from the formula
115: *         max(i) ( abs(RES(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
116: *     where abs(Z) is the componentwise absolute value of the matrix
117: *     or vector Z. This is computed by CLA_LIN_BERR.
118: *
119: *     N_NORMS        (input) INTEGER
120: *     Determines which error bounds to return (see ERR_BNDS_NORM
121: *     and ERR_BNDS_COMP).
122: *     If N_NORMS >= 1 return normwise error bounds.
123: *     If N_NORMS >= 2 return componentwise error bounds.
124: *
125: *     ERR_BNDS_NORM  (input/output) REAL array, dimension
126: *                    (NRHS, N_ERR_BNDS)
127: *     For each right-hand side, this array contains information about
128: *     various error bounds and condition numbers corresponding to the
129: *     normwise relative error, which is defined as follows:
130: *
131: *     Normwise relative error in the ith solution vector:
132: *             max_j (abs(XTRUE(j,i) - X(j,i)))
133: *            ------------------------------
134: *                  max_j abs(X(j,i))
135: *
136: *     The array is indexed by the type of error information as described
137: *     below. There currently are up to three pieces of information
138: *     returned.
139: *
140: *     The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
141: *     right-hand side.
142: *
143: *     The second index in ERR_BNDS_NORM(:,err) contains the following
144: *     three fields:
145: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
146: *              reciprocal condition number is less than the threshold
147: *              sqrt(n) * slamch('Epsilon').
148: *
149: *     err = 2 "Guaranteed" error bound: The estimated forward error,
150: *              almost certainly within a factor of 10 of the true error
151: *              so long as the next entry is greater than the threshold
152: *              sqrt(n) * slamch('Epsilon'). This error bound should only
153: *              be trusted if the previous boolean is true.
154: *
155: *     err = 3  Reciprocal condition number: Estimated normwise
156: *              reciprocal condition number.  Compared with the threshold
157: *              sqrt(n) * slamch('Epsilon') to determine if the error
158: *              estimate is "guaranteed". These reciprocal condition
159: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
160: *              appropriately scaled matrix Z.
161: *              Let Z = S*A, where S scales each row by a power of the
162: *              radix so all absolute row sums of Z are approximately 1.
163: *
164: *     This subroutine is only responsible for setting the second field
165: *     above.
166: *     See Lapack Working Note 165 for further details and extra
167: *     cautions.
168: *
169: *     ERR_BNDS_COMP  (input/output) REAL array, dimension
170: *                    (NRHS, N_ERR_BNDS)
171: *     For each right-hand side, this array contains information about
172: *     various error bounds and condition numbers corresponding to the
173: *     componentwise relative error, which is defined as follows:
174: *
175: *     Componentwise relative error in the ith solution vector:
176: *                    abs(XTRUE(j,i) - X(j,i))
177: *             max_j ----------------------
178: *                         abs(X(j,i))
179: *
180: *     The array is indexed by the right-hand side i (on which the
181: *     componentwise relative error depends), and the type of error
182: *     information as described below. There currently are up to three
183: *     pieces of information returned for each right-hand side. If
184: *     componentwise accuracy is not requested (PARAMS(3) = 0.0), then
185: *     ERR_BNDS_COMP is not accessed.  If N_ERR_BNDS .LT. 3, then at most
186: *     the first (:,N_ERR_BNDS) entries are returned.
187: *
188: *     The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
189: *     right-hand side.
190: *
191: *     The second index in ERR_BNDS_COMP(:,err) contains the following
192: *     three fields:
193: *     err = 1 "Trust/don't trust" boolean. Trust the answer if the
194: *              reciprocal condition number is less than the threshold
195: *              sqrt(n) * slamch('Epsilon').
196: *
197: *     err = 2 "Guaranteed" error bound: The estimated forward error,
198: *              almost certainly within a factor of 10 of the true error
199: *              so long as the next entry is greater than the threshold
200: *              sqrt(n) * slamch('Epsilon'). This error bound should only
201: *              be trusted if the previous boolean is true.
202: *
203: *     err = 3  Reciprocal condition number: Estimated componentwise
204: *              reciprocal condition number.  Compared with the threshold
205: *              sqrt(n) * slamch('Epsilon') to determine if the error
206: *              estimate is "guaranteed". These reciprocal condition
207: *              numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
208: *              appropriately scaled matrix Z.
209: *              Let Z = S*(A*diag(x)), where x is the solution for the
210: *              current right-hand side and S scales each row of
211: *              A*diag(x) by a power of the radix so all absolute row
212: *              sums of Z are approximately 1.
213: *
214: *     This subroutine is only responsible for setting the second field
215: *     above.
216: *     See Lapack Working Note 165 for further details and extra
217: *     cautions.
218: *
219: *     RES            (input) COMPLEX array, dimension (N)
220: *     Workspace to hold the intermediate residual.
221: *
222: *     AYB            (input) REAL array, dimension (N)
223: *     Workspace.
224: *
225: *     DY             (input) COMPLEX array, dimension (N)
226: *     Workspace to hold the intermediate solution.
227: *
228: *     Y_TAIL         (input) COMPLEX array, dimension (N)
229: *     Workspace to hold the trailing bits of the intermediate solution.
230: *
231: *     RCOND          (input) REAL
232: *     Reciprocal scaled condition number.  This is an estimate of the
233: *     reciprocal Skeel condition number of the matrix A after
234: *     equilibration (if done).  If this is less than the machine
235: *     precision (in particular, if it is zero), the matrix is singular
236: *     to working precision.  Note that the error may still be small even
237: *     if this number is very small and the matrix appears ill-
238: *     conditioned.
239: *
240: *     ITHRESH        (input) INTEGER
241: *     The maximum number of residual computations allowed for
242: *     refinement. The default is 10. For 'aggressive' set to 100 to
243: *     permit convergence using approximate factorizations or
244: *     factorizations other than LU. If the factorization uses a
245: *     technique other than Gaussian elimination, the guarantees in
246: *     ERR_BNDS_NORM and ERR_BNDS_COMP may no longer be trustworthy.
247: *
248: *     RTHRESH        (input) REAL
249: *     Determines when to stop refinement if the error estimate stops
250: *     decreasing. Refinement will stop when the next solution no longer
251: *     satisfies norm(dx_{i+1}) < RTHRESH * norm(dx_i) where norm(Z) is
252: *     the infinity norm of Z. RTHRESH satisfies 0 < RTHRESH <= 1. The
253: *     default value is 0.5. For 'aggressive' set to 0.9 to permit
254: *     convergence on extremely ill-conditioned matrices. See LAWN 165
255: *     for more details.
256: *
257: *     DZ_UB          (input) REAL
258: *     Determines when to start considering componentwise convergence.
259: *     Componentwise convergence is only considered after each component
260: *     of the solution Y is stable, which we definte as the relative
261: *     change in each component being less than DZ_UB. The default value
262: *     is 0.25, requiring the first bit to be stable. See LAWN 165 for
263: *     more details.
264: *
265: *     IGNORE_CWISE   (input) LOGICAL
266: *     If .TRUE. then ignore componentwise convergence. Default value
267: *     is .FALSE..
268: *
269: *     INFO           (output) INTEGER
270: *       = 0:  Successful exit.
271: *       < 0:  if INFO = -i, the ith argument to CPOTRS had an illegal
272: *             value
273: *
274: *  =====================================================================
275: *
276: *     .. Local Scalars ..
277:       INTEGER            UPLO2, CNT, I, J, X_STATE, Z_STATE,
278:      $                   Y_PREC_STATE
279:       REAL               YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
280:      $                   DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
281:      $                   DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
282:      $                   EPS, HUGEVAL, INCR_THRESH
283:       LOGICAL            INCR_PREC
284:       COMPLEX            ZDUM
285: *     ..
286: *     .. Parameters ..
287:       INTEGER            UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
288:      $                   NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
289:      $                   EXTRA_Y
290:       PARAMETER          ( UNSTABLE_STATE = 0, WORKING_STATE = 1,
291:      $                   CONV_STATE = 2, NOPROG_STATE = 3 )
292:       PARAMETER          ( BASE_RESIDUAL = 0, EXTRA_RESIDUAL = 1,
293:      $                   EXTRA_Y = 2 )
294:       INTEGER            FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
295:       INTEGER            RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
296:       INTEGER            CMP_ERR_I, PIV_GROWTH_I
297:       PARAMETER          ( FINAL_NRM_ERR_I = 1, FINAL_CMP_ERR_I = 2,
298:      $                   BERR_I = 3 )
299:       PARAMETER          ( RCOND_I = 4, NRM_RCOND_I = 5, NRM_ERR_I = 6 )
300:       PARAMETER          ( CMP_RCOND_I = 7, CMP_ERR_I = 8,
301:      $                   PIV_GROWTH_I = 9 )
302:       INTEGER            LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
303:      $                   LA_LINRX_CWISE_I
304:       PARAMETER          ( LA_LINRX_ITREF_I = 1,
305:      $                   LA_LINRX_ITHRESH_I = 2 )
306:       PARAMETER          ( LA_LINRX_CWISE_I = 3 )
307:       INTEGER            LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
308:      $                   LA_LINRX_RCOND_I
309:       PARAMETER          ( LA_LINRX_TRUST_I = 1, LA_LINRX_ERR_I = 2 )
310:       PARAMETER          ( LA_LINRX_RCOND_I = 3 )
311: *     ..
312: *     .. External Functions ..
313:       LOGICAL            LSAME
314:       EXTERNAL           ILAUPLO
315:       INTEGER            ILAUPLO
316: *     ..
317: *     .. External Subroutines ..
318:       EXTERNAL           CAXPY, CCOPY, CPOTRS, CHEMV, BLAS_CHEMV_X,
319:      $                   BLAS_CHEMV2_X, CLA_HEAMV, CLA_WWADDW,
320:      $                   CLA_LIN_BERR, SLAMCH
321:       REAL               SLAMCH
322: *     ..
323: *     .. Intrinsic Functions ..
324:       INTRINSIC          ABS, REAL, AIMAG, MAX, MIN
325: *     ..
326: *     .. Statement Functions ..
327:       REAL               CABS1
328: *     ..
329: *     .. Statement Function Definitions ..
330:       CABS1( ZDUM ) = ABS( REAL( ZDUM ) ) + ABS( AIMAG( ZDUM ) )
331: *     ..
332: *     .. Executable Statements ..
333: *
334:       IF (INFO.NE.0) RETURN
335:       EPS = SLAMCH( 'Epsilon' )
336:       HUGEVAL = SLAMCH( 'Overflow' )
337: *     Force HUGEVAL to Inf
338:       HUGEVAL = HUGEVAL * HUGEVAL
339: *     Using HUGEVAL may lead to spurious underflows.
340:       INCR_THRESH = REAL(N) * EPS
341: 
342:       IF (LSAME (UPLO, 'L')) THEN
343:          UPLO2 = ILAUPLO( 'L' )
344:       ELSE
345:          UPLO2 = ILAUPLO( 'U' )
346:       ENDIF
347: 
348:       DO J = 1, NRHS
349:          Y_PREC_STATE = EXTRA_RESIDUAL
350:          IF (Y_PREC_STATE .EQ. EXTRA_Y) THEN
351:             DO I = 1, N
352:                Y_TAIL( I ) = 0.0
353:             END DO
354:          END IF
355: 
356:          DXRAT = 0.0
357:          DXRATMAX = 0.0
358:          DZRAT = 0.0
359:          DZRATMAX = 0.0
360:          FINAL_DX_X = HUGEVAL
361:          FINAL_DZ_Z = HUGEVAL
362:          PREVNORMDX = HUGEVAL
363:          PREV_DZ_Z = HUGEVAL
364:          DZ_Z = HUGEVAL
365:          DX_X = HUGEVAL
366: 
367:          X_STATE = WORKING_STATE
368:          Z_STATE = UNSTABLE_STATE
369:          INCR_PREC = .FALSE.
370: 
371:          DO CNT = 1, ITHRESH
372: *
373: *         Compute residual RES = B_s - op(A_s) * Y,
374: *             op(A) = A, A**T, or A**H depending on TRANS (and type).
375: *
376:             CALL CCOPY( N, B( 1, J ), 1, RES, 1 )
377:             IF (Y_PREC_STATE .EQ. BASE_RESIDUAL) THEN
378:                CALL CHEMV(UPLO, N, CMPLX(-1.0), A, LDA, Y(1,J), 1,
379:      $              CMPLX(1.0), RES, 1)
380:             ELSE IF (Y_PREC_STATE .EQ. EXTRA_RESIDUAL) THEN
381:                CALL BLAS_CHEMV_X(UPLO2, N, CMPLX(-1.0), A, LDA,
382:      $              Y( 1, J ), 1, CMPLX(1.0), RES, 1, PREC_TYPE)
383:             ELSE
384:                CALL BLAS_CHEMV2_X(UPLO2, N, CMPLX(-1.0), A, LDA,
385:      $              Y(1, J), Y_TAIL, 1, CMPLX(1.0), RES, 1, PREC_TYPE)
386:             END IF
387: 
388: !         XXX: RES is no longer needed.
389:             CALL CCOPY( N, RES, 1, DY, 1 )
390:             CALL CPOTRS( UPLO, N, NRHS, AF, LDAF, DY, N, INFO)
391: *
392: *         Calculate relative changes DX_X, DZ_Z and ratios DXRAT, DZRAT.
393: *
394:             NORMX = 0.0
395:             NORMY = 0.0
396:             NORMDX = 0.0
397:             DZ_Z = 0.0
398:             YMIN = HUGEVAL
399: 
400:             DO I = 1, N
401:                YK = CABS1(Y(I, J))
402:                DYK = CABS1(DY(I))
403: 
404:                IF (YK .NE. 0.0) THEN
405:                   DZ_Z = MAX( DZ_Z, DYK / YK )
406:                ELSE IF (DYK .NE. 0.0) THEN
407:                   DZ_Z = HUGEVAL
408:                END IF
409: 
410:                YMIN = MIN( YMIN, YK )
411: 
412:                NORMY = MAX( NORMY, YK )
413: 
414:                IF ( COLEQU ) THEN
415:                   NORMX = MAX(NORMX, YK * C(I))
416:                   NORMDX = MAX(NORMDX, DYK * C(I))
417:                ELSE
418:                   NORMX = NORMY
419:                   NORMDX = MAX(NORMDX, DYK)
420:                END IF
421:             END DO
422: 
423:             IF (NORMX .NE. 0.0) THEN
424:                DX_X = NORMDX / NORMX
425:             ELSE IF (NORMDX .EQ. 0.0) THEN
426:                DX_X = 0.0
427:             ELSE
428:                DX_X = HUGEVAL
429:             END IF
430: 
431:             DXRAT = NORMDX / PREVNORMDX
432:             DZRAT = DZ_Z / PREV_DZ_Z
433: *
434: *         Check termination criteria.
435: *
436:             IF (YMIN*RCOND .LT. INCR_THRESH*NORMY
437:      $           .AND. Y_PREC_STATE .LT. EXTRA_Y)
438:      $           INCR_PREC = .TRUE.
439: 
440:             IF (X_STATE .EQ. NOPROG_STATE .AND. DXRAT .LE. RTHRESH)
441:      $           X_STATE = WORKING_STATE
442:             IF (X_STATE .EQ. WORKING_STATE) THEN
443:                IF (DX_X .LE. EPS) THEN
444:                   X_STATE = CONV_STATE
445:                ELSE IF (DXRAT .GT. RTHRESH) THEN
446:                   IF (Y_PREC_STATE .NE. EXTRA_Y) THEN
447:                      INCR_PREC = .TRUE.
448:                   ELSE
449:                      X_STATE = NOPROG_STATE
450:                   END IF
451:                ELSE
452:                   IF (DXRAT .GT. DXRATMAX) DXRATMAX = DXRAT
453:                END IF
454:                IF (X_STATE .GT. WORKING_STATE) FINAL_DX_X = DX_X
455:             END IF
456: 
457:             IF (Z_STATE .EQ. UNSTABLE_STATE .AND. DZ_Z .LE. DZ_UB)
458:      $           Z_STATE = WORKING_STATE
459:             IF (Z_STATE .EQ. NOPROG_STATE .AND. DZRAT .LE. RTHRESH)
460:      $           Z_STATE = WORKING_STATE
461:             IF (Z_STATE .EQ. WORKING_STATE) THEN
462:                IF (DZ_Z .LE. EPS) THEN
463:                   Z_STATE = CONV_STATE
464:                ELSE IF (DZ_Z .GT. DZ_UB) THEN
465:                   Z_STATE = UNSTABLE_STATE
466:                   DZRATMAX = 0.0
467:                   FINAL_DZ_Z = HUGEVAL
468:                ELSE IF (DZRAT .GT. RTHRESH) THEN
469:                   IF (Y_PREC_STATE .NE. EXTRA_Y) THEN
470:                      INCR_PREC = .TRUE.
471:                   ELSE
472:                      Z_STATE = NOPROG_STATE
473:                   END IF
474:                ELSE
475:                   IF (DZRAT .GT. DZRATMAX) DZRATMAX = DZRAT
476:                END IF
477:                IF (Z_STATE .GT. WORKING_STATE) FINAL_DZ_Z = DZ_Z
478:             END IF
479: 
480:             IF ( X_STATE.NE.WORKING_STATE.AND.
481:      $           (IGNORE_CWISE.OR.Z_STATE.NE.WORKING_STATE) )
482:      $           GOTO 666
483: 
484:             IF (INCR_PREC) THEN
485:                INCR_PREC = .FALSE.
486:                Y_PREC_STATE = Y_PREC_STATE + 1
487:                DO I = 1, N
488:                   Y_TAIL( I ) = 0.0
489:                END DO
490:             END IF
491: 
492:             PREVNORMDX = NORMDX
493:             PREV_DZ_Z = DZ_Z
494: *
495: *           Update soluton.
496: *
497:             IF (Y_PREC_STATE .LT. EXTRA_Y) THEN
498:                CALL CAXPY( N, CMPLX(1.0), DY, 1, Y(1,J), 1 )
499:             ELSE
500:                CALL CLA_WWADDW(N, Y(1,J), Y_TAIL, DY)
501:             END IF
502: 
503:          END DO
504: *        Target of "IF (Z_STOP .AND. X_STOP)".  Sun's f77 won't EXIT.
505:  666     CONTINUE
506: *
507: *     Set final_* when cnt hits ithresh.
508: *
509:          IF (X_STATE .EQ. WORKING_STATE) FINAL_DX_X = DX_X
510:          IF (Z_STATE .EQ. WORKING_STATE) FINAL_DZ_Z = DZ_Z
511: *
512: *     Compute error bounds.
513: *
514:          IF (N_NORMS .GE. 1) THEN
515:             ERR_BNDS_NORM( J, LA_LINRX_ERR_I ) =
516:      $           FINAL_DX_X / (1 - DXRATMAX)
517:          END IF
518:          IF (N_NORMS .GE. 2) THEN
519:             ERR_BNDS_COMP( J, LA_LINRX_ERR_I ) =
520:      $           FINAL_DZ_Z / (1 - DZRATMAX)
521:          END IF
522: *
523: *     Compute componentwise relative backward error from formula
524: *         max(i) ( abs(R(i)) / ( abs(op(A_s))*abs(Y) + abs(B_s) )(i) )
525: *     where abs(Z) is the componentwise absolute value of the matrix
526: *     or vector Z.
527: *
528: *        Compute residual RES = B_s - op(A_s) * Y,
529: *            op(A) = A, A**T, or A**H depending on TRANS (and type).
530: *
531:          CALL CCOPY( N, B( 1, J ), 1, RES, 1 )
532:          CALL CHEMV(UPLO, N, CMPLX(-1.0), A, LDA, Y(1,J), 1, CMPLX(1.0),
533:      $        RES, 1)
534: 
535:          DO I = 1, N
536:             AYB( I ) = CABS1( B( I, J ) )
537:          END DO
538: *
539: *     Compute abs(op(A_s))*abs(Y) + abs(B_s).
540: *
541:          CALL CLA_HEAMV (UPLO2, N, 1.0,
542:      $        A, LDA, Y(1, J), 1, 1.0, AYB, 1)
543: 
544:          CALL CLA_LIN_BERR (N, N, 1, RES, AYB, BERR_OUT(J))
545: *
546: *     End of loop for each RHS.
547: *
548:       END DO
549: *
550:       RETURN
551:       END
552: