LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
sgbsvxx.f
Go to the documentation of this file.
1*> \brief <b> SGBSVXX computes the solution to system of linear equations A * X = B for GB matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download SGBSVXX + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sgbsvxx.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sgbsvxx.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgbsvxx.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE SGBSVXX( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB,
20* LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX,
21* RCOND, RPVGRW, BERR, N_ERR_BNDS,
22* ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
23* WORK, IWORK, INFO )
24*
25* .. Scalar Arguments ..
26* CHARACTER EQUED, FACT, TRANS
27* INTEGER INFO, LDAB, LDAFB, LDB, LDX, N, NRHS, NPARAMS,
28* $ N_ERR_BNDS
29* REAL RCOND, RPVGRW
30* ..
31* .. Array Arguments ..
32* INTEGER IPIV( * ), IWORK( * )
33* REAL AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
34* $ X( LDX , * ),WORK( * )
35* REAL R( * ), C( * ), PARAMS( * ), BERR( * ),
36* $ ERR_BNDS_NORM( NRHS, * ),
37* $ ERR_BNDS_COMP( NRHS, * )
38* ..
39*
40*
41*> \par Purpose:
42* =============
43*>
44*> \verbatim
45*>
46*> SGBSVXX uses the LU factorization to compute the solution to a
47*> real system of linear equations A * X = B, where A is an
48*> N-by-N matrix and X and B are N-by-NRHS matrices.
49*>
50*> If requested, both normwise and maximum componentwise error bounds
51*> are returned. SGBSVXX will return a solution with a tiny
52*> guaranteed error (O(eps) where eps is the working machine
53*> precision) unless the matrix is very ill-conditioned, in which
54*> case a warning is returned. Relevant condition numbers also are
55*> calculated and returned.
56*>
57*> SGBSVXX accepts user-provided factorizations and equilibration
58*> factors; see the definitions of the FACT and EQUED options.
59*> Solving with refinement and using a factorization from a previous
60*> SGBSVXX call will also produce a solution with either O(eps)
61*> errors or warnings, but we cannot make that claim for general
62*> user-provided factorizations and equilibration factors if they
63*> differ from what SGBSVXX would itself produce.
64*> \endverbatim
65*
66*> \par Description:
67* =================
68*>
69*> \verbatim
70*>
71*> The following steps are performed:
72*>
73*> 1. If FACT = 'E', real scaling factors are computed to equilibrate
74*> the system:
75*>
76*> TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B
77*> TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B
78*> TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B
79*>
80*> Whether or not the system will be equilibrated depends on the
81*> scaling of the matrix A, but if equilibration is used, A is
82*> overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N')
83*> or diag(C)*B (if TRANS = 'T' or 'C').
84*>
85*> 2. If FACT = 'N' or 'E', the LU decomposition is used to factor
86*> the matrix A (after equilibration if FACT = 'E') as
87*>
88*> A = P * L * U,
89*>
90*> where P is a permutation matrix, L is a unit lower triangular
91*> matrix, and U is upper triangular.
92*>
93*> 3. If some U(i,i)=0, so that U is exactly singular, then the
94*> routine returns with INFO = i. Otherwise, the factored form of A
95*> is used to estimate the condition number of the matrix A (see
96*> argument RCOND). If the reciprocal of the condition number is less
97*> than machine precision, the routine still goes on to solve for X
98*> and compute error bounds as described below.
99*>
100*> 4. The system of equations is solved for X using the factored form
101*> of A.
102*>
103*> 5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),
104*> the routine will use iterative refinement to try to get a small
105*> error and error bounds. Refinement calculates the residual to at
106*> least twice the working precision.
107*>
108*> 6. If equilibration was used, the matrix X is premultiplied by
109*> diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so
110*> that it solves the original system before equilibration.
111*> \endverbatim
112*
113* Arguments:
114* ==========
115*
116*> \verbatim
117*> Some optional parameters are bundled in the PARAMS array. These
118*> settings determine how refinement is performed, but often the
119*> defaults are acceptable. If the defaults are acceptable, users
120*> can pass NPARAMS = 0 which prevents the source code from accessing
121*> the PARAMS argument.
122*> \endverbatim
123*>
124*> \param[in] FACT
125*> \verbatim
126*> FACT is CHARACTER*1
127*> Specifies whether or not the factored form of the matrix A is
128*> supplied on entry, and if not, whether the matrix A should be
129*> equilibrated before it is factored.
130*> = 'F': On entry, AF and IPIV contain the factored form of A.
131*> If EQUED is not 'N', the matrix A has been
132*> equilibrated with scaling factors given by R and C.
133*> A, AF, and IPIV are not modified.
134*> = 'N': The matrix A will be copied to AF and factored.
135*> = 'E': The matrix A will be equilibrated if necessary, then
136*> copied to AF and factored.
137*> \endverbatim
138*>
139*> \param[in] TRANS
140*> \verbatim
141*> TRANS is CHARACTER*1
142*> Specifies the form of the system of equations:
143*> = 'N': A * X = B (No transpose)
144*> = 'T': A**T * X = B (Transpose)
145*> = 'C': A**H * X = B (Conjugate Transpose = Transpose)
146*> \endverbatim
147*>
148*> \param[in] N
149*> \verbatim
150*> N is INTEGER
151*> The number of linear equations, i.e., the order of the
152*> matrix A. N >= 0.
153*> \endverbatim
154*>
155*> \param[in] KL
156*> \verbatim
157*> KL is INTEGER
158*> The number of subdiagonals within the band of A. KL >= 0.
159*> \endverbatim
160*>
161*> \param[in] KU
162*> \verbatim
163*> KU is INTEGER
164*> The number of superdiagonals within the band of A. KU >= 0.
165*> \endverbatim
166*>
167*> \param[in] NRHS
168*> \verbatim
169*> NRHS is INTEGER
170*> The number of right hand sides, i.e., the number of columns
171*> of the matrices B and X. NRHS >= 0.
172*> \endverbatim
173*>
174*> \param[in,out] AB
175*> \verbatim
176*> AB is REAL array, dimension (LDAB,N)
177*> On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
178*> The j-th column of A is stored in the j-th column of the
179*> array AB as follows:
180*> AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
181*>
182*> If FACT = 'F' and EQUED is not 'N', then AB must have been
183*> equilibrated by the scaling factors in R and/or C. AB is not
184*> modified if FACT = 'F' or 'N', or if FACT = 'E' and
185*> EQUED = 'N' on exit.
186*>
187*> On exit, if EQUED .ne. 'N', A is scaled as follows:
188*> EQUED = 'R': A := diag(R) * A
189*> EQUED = 'C': A := A * diag(C)
190*> EQUED = 'B': A := diag(R) * A * diag(C).
191*> \endverbatim
192*>
193*> \param[in] LDAB
194*> \verbatim
195*> LDAB is INTEGER
196*> The leading dimension of the array AB. LDAB >= KL+KU+1.
197*> \endverbatim
198*>
199*> \param[in,out] AFB
200*> \verbatim
201*> AFB is REAL array, dimension (LDAFB,N)
202*> If FACT = 'F', then AFB is an input argument and on entry
203*> contains details of the LU factorization of the band matrix
204*> A, as computed by SGBTRF. U is stored as an upper triangular
205*> band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
206*> and the multipliers used during the factorization are stored
207*> in rows KL+KU+2 to 2*KL+KU+1. If EQUED .ne. 'N', then AFB is
208*> the factored form of the equilibrated matrix A.
209*>
210*> If FACT = 'N', then AF is an output argument and on exit
211*> returns the factors L and U from the factorization A = P*L*U
212*> of the original matrix A.
213*>
214*> If FACT = 'E', then AF is an output argument and on exit
215*> returns the factors L and U from the factorization A = P*L*U
216*> of the equilibrated matrix A (see the description of A for
217*> the form of the equilibrated matrix).
218*> \endverbatim
219*>
220*> \param[in] LDAFB
221*> \verbatim
222*> LDAFB is INTEGER
223*> The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
224*> \endverbatim
225*>
226*> \param[in,out] IPIV
227*> \verbatim
228*> IPIV is INTEGER array, dimension (N)
229*> If FACT = 'F', then IPIV is an input argument and on entry
230*> contains the pivot indices from the factorization A = P*L*U
231*> as computed by SGETRF; row i of the matrix was interchanged
232*> with row IPIV(i).
233*>
234*> If FACT = 'N', then IPIV is an output argument and on exit
235*> contains the pivot indices from the factorization A = P*L*U
236*> of the original matrix A.
237*>
238*> If FACT = 'E', then IPIV is an output argument and on exit
239*> contains the pivot indices from the factorization A = P*L*U
240*> of the equilibrated matrix A.
241*> \endverbatim
242*>
243*> \param[in,out] EQUED
244*> \verbatim
245*> EQUED is CHARACTER*1
246*> Specifies the form of equilibration that was done.
247*> = 'N': No equilibration (always true if FACT = 'N').
248*> = 'R': Row equilibration, i.e., A has been premultiplied by
249*> diag(R).
250*> = 'C': Column equilibration, i.e., A has been postmultiplied
251*> by diag(C).
252*> = 'B': Both row and column equilibration, i.e., A has been
253*> replaced by diag(R) * A * diag(C).
254*> EQUED is an input argument if FACT = 'F'; otherwise, it is an
255*> output argument.
256*> \endverbatim
257*>
258*> \param[in,out] R
259*> \verbatim
260*> R is REAL array, dimension (N)
261*> The row scale factors for A. If EQUED = 'R' or 'B', A is
262*> multiplied on the left by diag(R); if EQUED = 'N' or 'C', R
263*> is not accessed. R is an input argument if FACT = 'F';
264*> otherwise, R is an output argument. If FACT = 'F' and
265*> EQUED = 'R' or 'B', each element of R must be positive.
266*> If R is output, each element of R is a power of the radix.
267*> If R is input, each element of R should be a power of the radix
268*> to ensure a reliable solution and error estimates. Scaling by
269*> powers of the radix does not cause rounding errors unless the
270*> result underflows or overflows. Rounding errors during scaling
271*> lead to refining with a matrix that is not equivalent to the
272*> input matrix, producing error estimates that may not be
273*> reliable.
274*> \endverbatim
275*>
276*> \param[in,out] C
277*> \verbatim
278*> C is REAL array, dimension (N)
279*> The column scale factors for A. If EQUED = 'C' or 'B', A is
280*> multiplied on the right by diag(C); if EQUED = 'N' or 'R', C
281*> is not accessed. C is an input argument if FACT = 'F';
282*> otherwise, C is an output argument. If FACT = 'F' and
283*> EQUED = 'C' or 'B', each element of C must be positive.
284*> If C is output, each element of C is a power of the radix.
285*> If C is input, each element of C should be a power of the radix
286*> to ensure a reliable solution and error estimates. Scaling by
287*> powers of the radix does not cause rounding errors unless the
288*> result underflows or overflows. Rounding errors during scaling
289*> lead to refining with a matrix that is not equivalent to the
290*> input matrix, producing error estimates that may not be
291*> reliable.
292*> \endverbatim
293*>
294*> \param[in,out] B
295*> \verbatim
296*> B is REAL array, dimension (LDB,NRHS)
297*> On entry, the N-by-NRHS right hand side matrix B.
298*> On exit,
299*> if EQUED = 'N', B is not modified;
300*> if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by
301*> diag(R)*B;
302*> if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is
303*> overwritten by diag(C)*B.
304*> \endverbatim
305*>
306*> \param[in] LDB
307*> \verbatim
308*> LDB is INTEGER
309*> The leading dimension of the array B. LDB >= max(1,N).
310*> \endverbatim
311*>
312*> \param[out] X
313*> \verbatim
314*> X is REAL array, dimension (LDX,NRHS)
315*> If INFO = 0, the N-by-NRHS solution matrix X to the original
316*> system of equations. Note that A and B are modified on exit
317*> if EQUED .ne. 'N', and the solution to the equilibrated system is
318*> inv(diag(C))*X if TRANS = 'N' and EQUED = 'C' or 'B', or
319*> inv(diag(R))*X if TRANS = 'T' or 'C' and EQUED = 'R' or 'B'.
320*> \endverbatim
321*>
322*> \param[in] LDX
323*> \verbatim
324*> LDX is INTEGER
325*> The leading dimension of the array X. LDX >= max(1,N).
326*> \endverbatim
327*>
328*> \param[out] RCOND
329*> \verbatim
330*> RCOND is REAL
331*> Reciprocal scaled condition number. This is an estimate of the
332*> reciprocal Skeel condition number of the matrix A after
333*> equilibration (if done). If this is less than the machine
334*> precision (in particular, if it is zero), the matrix is singular
335*> to working precision. Note that the error may still be small even
336*> if this number is very small and the matrix appears ill-
337*> conditioned.
338*> \endverbatim
339*>
340*> \param[out] RPVGRW
341*> \verbatim
342*> RPVGRW is REAL
343*> Reciprocal pivot growth. On exit, this contains the reciprocal
344*> pivot growth factor norm(A)/norm(U). The "max absolute element"
345*> norm is used. If this is much less than 1, then the stability of
346*> the LU factorization of the (equilibrated) matrix A could be poor.
347*> This also means that the solution X, estimated condition numbers,
348*> and error bounds could be unreliable. If factorization fails with
349*> 0<INFO<=N, then this contains the reciprocal pivot growth factor
350*> for the leading INFO columns of A. In SGESVX, this quantity is
351*> returned in WORK(1).
352*> \endverbatim
353*>
354*> \param[out] BERR
355*> \verbatim
356*> BERR is REAL array, dimension (NRHS)
357*> Componentwise relative backward error. This is the
358*> componentwise relative backward error of each solution vector X(j)
359*> (i.e., the smallest relative change in any element of A or B that
360*> makes X(j) an exact solution).
361*> \endverbatim
362*>
363*> \param[in] N_ERR_BNDS
364*> \verbatim
365*> N_ERR_BNDS is INTEGER
366*> Number of error bounds to return for each right hand side
367*> and each type (normwise or componentwise). See ERR_BNDS_NORM and
368*> ERR_BNDS_COMP below.
369*> \endverbatim
370*>
371*> \param[out] ERR_BNDS_NORM
372*> \verbatim
373*> ERR_BNDS_NORM is REAL array, dimension (NRHS, N_ERR_BNDS)
374*> For each right-hand side, this array contains information about
375*> various error bounds and condition numbers corresponding to the
376*> normwise relative error, which is defined as follows:
377*>
378*> Normwise relative error in the ith solution vector:
379*> max_j (abs(XTRUE(j,i) - X(j,i)))
380*> ------------------------------
381*> max_j abs(X(j,i))
382*>
383*> The array is indexed by the type of error information as described
384*> below. There currently are up to three pieces of information
385*> returned.
386*>
387*> The first index in ERR_BNDS_NORM(i,:) corresponds to the ith
388*> right-hand side.
389*>
390*> The second index in ERR_BNDS_NORM(:,err) contains the following
391*> three fields:
392*> err = 1 "Trust/don't trust" boolean. Trust the answer if the
393*> reciprocal condition number is less than the threshold
394*> sqrt(n) * slamch('Epsilon').
395*>
396*> err = 2 "Guaranteed" error bound: The estimated forward error,
397*> almost certainly within a factor of 10 of the true error
398*> so long as the next entry is greater than the threshold
399*> sqrt(n) * slamch('Epsilon'). This error bound should only
400*> be trusted if the previous boolean is true.
401*>
402*> err = 3 Reciprocal condition number: Estimated normwise
403*> reciprocal condition number. Compared with the threshold
404*> sqrt(n) * slamch('Epsilon') to determine if the error
405*> estimate is "guaranteed". These reciprocal condition
406*> numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
407*> appropriately scaled matrix Z.
408*> Let Z = S*A, where S scales each row by a power of the
409*> radix so all absolute row sums of Z are approximately 1.
410*>
411*> See Lapack Working Note 165 for further details and extra
412*> cautions.
413*> \endverbatim
414*>
415*> \param[out] ERR_BNDS_COMP
416*> \verbatim
417*> ERR_BNDS_COMP is REAL array, dimension (NRHS, N_ERR_BNDS)
418*> For each right-hand side, this array contains information about
419*> various error bounds and condition numbers corresponding to the
420*> componentwise relative error, which is defined as follows:
421*>
422*> Componentwise relative error in the ith solution vector:
423*> abs(XTRUE(j,i) - X(j,i))
424*> max_j ----------------------
425*> abs(X(j,i))
426*>
427*> The array is indexed by the right-hand side i (on which the
428*> componentwise relative error depends), and the type of error
429*> information as described below. There currently are up to three
430*> pieces of information returned for each right-hand side. If
431*> componentwise accuracy is not requested (PARAMS(3) = 0.0), then
432*> ERR_BNDS_COMP is not accessed. If N_ERR_BNDS < 3, then at most
433*> the first (:,N_ERR_BNDS) entries are returned.
434*>
435*> The first index in ERR_BNDS_COMP(i,:) corresponds to the ith
436*> right-hand side.
437*>
438*> The second index in ERR_BNDS_COMP(:,err) contains the following
439*> three fields:
440*> err = 1 "Trust/don't trust" boolean. Trust the answer if the
441*> reciprocal condition number is less than the threshold
442*> sqrt(n) * slamch('Epsilon').
443*>
444*> err = 2 "Guaranteed" error bound: The estimated forward error,
445*> almost certainly within a factor of 10 of the true error
446*> so long as the next entry is greater than the threshold
447*> sqrt(n) * slamch('Epsilon'). This error bound should only
448*> be trusted if the previous boolean is true.
449*>
450*> err = 3 Reciprocal condition number: Estimated componentwise
451*> reciprocal condition number. Compared with the threshold
452*> sqrt(n) * slamch('Epsilon') to determine if the error
453*> estimate is "guaranteed". These reciprocal condition
454*> numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for some
455*> appropriately scaled matrix Z.
456*> Let Z = S*(A*diag(x)), where x is the solution for the
457*> current right-hand side and S scales each row of
458*> A*diag(x) by a power of the radix so all absolute row
459*> sums of Z are approximately 1.
460*>
461*> See Lapack Working Note 165 for further details and extra
462*> cautions.
463*> \endverbatim
464*>
465*> \param[in] NPARAMS
466*> \verbatim
467*> NPARAMS is INTEGER
468*> Specifies the number of parameters set in PARAMS. If <= 0, the
469*> PARAMS array is never referenced and default values are used.
470*> \endverbatim
471*>
472*> \param[in,out] PARAMS
473*> \verbatim
474*> PARAMS is REAL array, dimension NPARAMS
475*> Specifies algorithm parameters. If an entry is < 0.0, then
476*> that entry will be filled with default value used for that
477*> parameter. Only positions up to NPARAMS are accessed; defaults
478*> are used for higher-numbered parameters.
479*>
480*> PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
481*> refinement or not.
482*> Default: 1.0
483*> = 0.0: No refinement is performed, and no error bounds are
484*> computed.
485*> = 1.0: Use the double-precision refinement algorithm,
486*> possibly with doubled-single computations if the
487*> compilation environment does not support DOUBLE
488*> PRECISION.
489*> (other values are reserved for future use)
490*>
491*> PARAMS(LA_LINRX_ITHRESH_I = 2) : Maximum number of residual
492*> computations allowed for refinement.
493*> Default: 10
494*> Aggressive: Set to 100 to permit convergence using approximate
495*> factorizations or factorizations other than LU. If
496*> the factorization uses a technique other than
497*> Gaussian elimination, the guarantees in
498*> err_bnds_norm and err_bnds_comp may no longer be
499*> trustworthy.
500*>
501*> PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining if the code
502*> will attempt to find a solution with small componentwise
503*> relative error in the double-precision algorithm. Positive
504*> is true, 0.0 is false.
505*> Default: 1.0 (attempt componentwise convergence)
506*> \endverbatim
507*>
508*> \param[out] WORK
509*> \verbatim
510*> WORK is REAL array, dimension (4*N)
511*> \endverbatim
512*>
513*> \param[out] IWORK
514*> \verbatim
515*> IWORK is INTEGER array, dimension (N)
516*> \endverbatim
517*>
518*> \param[out] INFO
519*> \verbatim
520*> INFO is INTEGER
521*> = 0: Successful exit. The solution to every right-hand side is
522*> guaranteed.
523*> < 0: If INFO = -i, the i-th argument had an illegal value
524*> > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization
525*> has been completed, but the factor U is exactly singular, so
526*> the solution and error bounds could not be computed. RCOND = 0
527*> is returned.
528*> = N+J: The solution corresponding to the Jth right-hand side is
529*> not guaranteed. The solutions corresponding to other right-
530*> hand sides K with K > J may not be guaranteed as well, but
531*> only the first such right-hand side is reported. If a small
532*> componentwise error is not requested (PARAMS(3) = 0.0) then
533*> the Jth right-hand side is the first with a normwise error
534*> bound that is not guaranteed (the smallest J such
535*> that ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0)
536*> the Jth right-hand side is the first with either a normwise or
537*> componentwise error bound that is not guaranteed (the smallest
538*> J such that either ERR_BNDS_NORM(J,1) = 0.0 or
539*> ERR_BNDS_COMP(J,1) = 0.0). See the definition of
540*> ERR_BNDS_NORM(:,1) and ERR_BNDS_COMP(:,1). To get information
541*> about all of the right-hand sides check ERR_BNDS_NORM or
542*> ERR_BNDS_COMP.
543*> \endverbatim
544*
545* Authors:
546* ========
547*
548*> \author Univ. of Tennessee
549*> \author Univ. of California Berkeley
550*> \author Univ. of Colorado Denver
551*> \author NAG Ltd.
552*
553*> \ingroup gbsvxx
554*
555* =====================================================================
556 SUBROUTINE sgbsvxx( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB,
557 $ AFB,
558 $ LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX,
559 $ RCOND, RPVGRW, BERR, N_ERR_BNDS,
560 $ ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
561 $ WORK, IWORK, INFO )
562*
563* -- LAPACK driver routine --
564* -- LAPACK is a software package provided by Univ. of Tennessee, --
565* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
566*
567* .. Scalar Arguments ..
568 CHARACTER EQUED, FACT, TRANS
569 INTEGER INFO, LDAB, LDAFB, LDB, LDX, N, NRHS, NPARAMS,
570 $ N_ERR_BNDS
571 REAL RCOND, RPVGRW
572* ..
573* .. Array Arguments ..
574 INTEGER IPIV( * ), IWORK( * )
575 REAL AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
576 $ x( ldx , * ),work( * )
577 REAL R( * ), C( * ), PARAMS( * ), BERR( * ),
578 $ ERR_BNDS_NORM( NRHS, * ),
579 $ err_bnds_comp( nrhs, * )
580* ..
581*
582* ==================================================================
583*
584* .. Parameters ..
585 REAL ZERO, ONE
586 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
587 INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
588 INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
589 INTEGER CMP_ERR_I, PIV_GROWTH_I
590 parameter( final_nrm_err_i = 1, final_cmp_err_i = 2,
591 $ berr_i = 3 )
592 parameter( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
593 parameter( cmp_rcond_i = 7, cmp_err_i = 8,
594 $ piv_growth_i = 9 )
595* ..
596* .. Local Scalars ..
597 LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
598 INTEGER INFEQU, I, J, KL, KU
599 REAL AMAX, BIGNUM, COLCND, RCMAX, RCMIN,
600 $ ROWCND, SMLNUM
601* ..
602* .. External Functions ..
603 EXTERNAL lsame, slamch, sla_gbrpvgrw
604 LOGICAL LSAME
605 REAL SLAMCH, SLA_GBRPVGRW
606* ..
607* .. External Subroutines ..
608 EXTERNAL sgbequb, sgbtrf, sgbtrs, slacpy,
609 $ slaqgb,
611* ..
612* .. Intrinsic Functions ..
613 INTRINSIC max, min
614* ..
615* .. Executable Statements ..
616*
617 info = 0
618 nofact = lsame( fact, 'N' )
619 equil = lsame( fact, 'E' )
620 notran = lsame( trans, 'N' )
621 smlnum = slamch( 'Safe minimum' )
622 bignum = one / smlnum
623 IF( nofact .OR. equil ) THEN
624 equed = 'N'
625 rowequ = .false.
626 colequ = .false.
627 ELSE
628 rowequ = lsame( equed, 'R' ) .OR. lsame( equed, 'B' )
629 colequ = lsame( equed, 'C' ) .OR. lsame( equed, 'B' )
630 END IF
631*
632* Default is failure. If an input parameter is wrong or
633* factorization fails, make everything look horrible. Only the
634* pivot growth is set here, the rest is initialized in SGBRFSX.
635*
636 rpvgrw = zero
637*
638* Test the input parameters. PARAMS is not tested until SGBRFSX.
639*
640 IF( .NOT.nofact .AND. .NOT.equil .AND. .NOT.
641 $ lsame( fact, 'F' ) ) THEN
642 info = -1
643 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans, 'T' ) .AND. .NOT.
644 $ lsame( trans, 'C' ) ) THEN
645 info = -2
646 ELSE IF( n.LT.0 ) THEN
647 info = -3
648 ELSE IF( kl.LT.0 ) THEN
649 info = -4
650 ELSE IF( ku.LT.0 ) THEN
651 info = -5
652 ELSE IF( nrhs.LT.0 ) THEN
653 info = -6
654 ELSE IF( ldab.LT.kl+ku+1 ) THEN
655 info = -8
656 ELSE IF( ldafb.LT.2*kl+ku+1 ) THEN
657 info = -10
658 ELSE IF( lsame( fact, 'F' ) .AND. .NOT.
659 $ ( rowequ .OR. colequ .OR. lsame( equed, 'N' ) ) ) THEN
660 info = -12
661 ELSE
662 IF( rowequ ) THEN
663 rcmin = bignum
664 rcmax = zero
665 DO 10 j = 1, n
666 rcmin = min( rcmin, r( j ) )
667 rcmax = max( rcmax, r( j ) )
668 10 CONTINUE
669 IF( rcmin.LE.zero ) THEN
670 info = -13
671 ELSE IF( n.GT.0 ) THEN
672 rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
673 ELSE
674 rowcnd = one
675 END IF
676 END IF
677 IF( colequ .AND. info.EQ.0 ) THEN
678 rcmin = bignum
679 rcmax = zero
680 DO 20 j = 1, n
681 rcmin = min( rcmin, c( j ) )
682 rcmax = max( rcmax, c( j ) )
683 20 CONTINUE
684 IF( rcmin.LE.zero ) THEN
685 info = -14
686 ELSE IF( n.GT.0 ) THEN
687 colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
688 ELSE
689 colcnd = one
690 END IF
691 END IF
692 IF( info.EQ.0 ) THEN
693 IF( ldb.LT.max( 1, n ) ) THEN
694 info = -15
695 ELSE IF( ldx.LT.max( 1, n ) ) THEN
696 info = -16
697 END IF
698 END IF
699 END IF
700*
701 IF( info.NE.0 ) THEN
702 CALL xerbla( 'SGBSVXX', -info )
703 RETURN
704 END IF
705*
706 IF( equil ) THEN
707*
708* Compute row and column scalings to equilibrate the matrix A.
709*
710 CALL sgbequb( n, n, kl, ku, ab, ldab, r, c, rowcnd, colcnd,
711 $ amax, infequ )
712 IF( infequ.EQ.0 ) THEN
713*
714* Equilibrate the matrix.
715*
716 CALL slaqgb( n, n, kl, ku, ab, ldab, r, c, rowcnd,
717 $ colcnd,
718 $ amax, equed )
719 rowequ = lsame( equed, 'R' ) .OR. lsame( equed, 'B' )
720 colequ = lsame( equed, 'C' ) .OR. lsame( equed, 'B' )
721 END IF
722*
723* If the scaling factors are not applied, set them to 1.0.
724*
725 IF ( .NOT.rowequ ) THEN
726 DO j = 1, n
727 r( j ) = 1.0
728 END DO
729 END IF
730 IF ( .NOT.colequ ) THEN
731 DO j = 1, n
732 c( j ) = 1.0
733 END DO
734 END IF
735 END IF
736*
737* Scale the right hand side.
738*
739 IF( notran ) THEN
740 IF( rowequ ) CALL slascl2(n, nrhs, r, b, ldb)
741 ELSE
742 IF( colequ ) CALL slascl2(n, nrhs, c, b, ldb)
743 END IF
744*
745 IF( nofact .OR. equil ) THEN
746*
747* Compute the LU factorization of A.
748*
749 DO 40, j = 1, n
750 DO 30, i = kl+1, 2*kl+ku+1
751 afb( i, j ) = ab( i-kl, j )
752 30 CONTINUE
753 40 CONTINUE
754 CALL sgbtrf( n, n, kl, ku, afb, ldafb, ipiv, info )
755*
756* Return if INFO is non-zero.
757*
758 IF( info.GT.0 ) THEN
759*
760* Pivot in column INFO is exactly 0
761* Compute the reciprocal pivot growth factor of the
762* leading rank-deficient INFO columns of A.
763*
764 rpvgrw = sla_gbrpvgrw( n, kl, ku, info, ab, ldab, afb,
765 $ ldafb )
766 RETURN
767 END IF
768 END IF
769*
770* Compute the reciprocal pivot growth factor RPVGRW.
771*
772 rpvgrw = sla_gbrpvgrw( n, kl, ku, n, ab, ldab, afb, ldafb )
773*
774* Compute the solution matrix X.
775*
776 CALL slacpy( 'Full', n, nrhs, b, ldb, x, ldx )
777 CALL sgbtrs( trans, n, kl, ku, nrhs, afb, ldafb, ipiv, x, ldx,
778 $ info )
779*
780* Use iterative refinement to improve the computed solution and
781* compute error bounds and backward error estimates for it.
782*
783 CALL sgbrfsx( trans, equed, n, kl, ku, nrhs, ab, ldab, afb,
784 $ ldafb,
785 $ ipiv, r, c, b, ldb, x, ldx, rcond, berr,
786 $ n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params,
787 $ work, iwork, info )
788*
789* Scale solutions.
790*
791 IF ( colequ .AND. notran ) THEN
792 CALL slascl2 ( n, nrhs, c, x, ldx )
793 ELSE IF ( rowequ .AND. .NOT.notran ) THEN
794 CALL slascl2 ( n, nrhs, r, x, ldx )
795 END IF
796*
797 RETURN
798*
799* End of SGBSVXX
800*
801 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine sgbequb(m, n, kl, ku, ab, ldab, r, c, rowcnd, colcnd, amax, info)
SGBEQUB
Definition sgbequb.f:159
subroutine sgbrfsx(trans, equed, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, r, c, b, ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info)
SGBRFSX
Definition sgbrfsx.f:439
subroutine sgbsvxx(fact, trans, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, equed, r, c, b, ldb, x, ldx, rcond, rpvgrw, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork, info)
SGBSVXX computes the solution to system of linear equations A * X = B for GB matrices
Definition sgbsvxx.f:562
subroutine sgbtrf(m, n, kl, ku, ab, ldab, ipiv, info)
SGBTRF
Definition sgbtrf.f:142
subroutine sgbtrs(trans, n, kl, ku, nrhs, ab, ldab, ipiv, b, ldb, info)
SGBTRS
Definition sgbtrs.f:137
real function sla_gbrpvgrw(n, kl, ku, ncols, ab, ldab, afb, ldafb)
SLA_GBRPVGRW computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix.
subroutine slacpy(uplo, m, n, a, lda, b, ldb)
SLACPY copies all or part of one two-dimensional array to another.
Definition slacpy.f:101
real function slamch(cmach)
SLAMCH
Definition slamch.f:68
subroutine slaqgb(m, n, kl, ku, ab, ldab, r, c, rowcnd, colcnd, amax, equed)
SLAQGB scales a general band matrix, using row and column scaling factors computed by sgbequ.
Definition slaqgb.f:158
subroutine slascl2(m, n, d, x, ldx)
SLASCL2 performs diagonal scaling on a matrix.
Definition slascl2.f:88
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48