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