1SSYSVXX(1) LAPACK driver routine (version 3.2) SSYSVXX(1)
2
3
4
6 SSYSVXX - SSYSVXX use the diagonal pivoting factorization to compute
7 the solution to a real system of linear equations A * X = B, where A
8 is an N-by-N symmetric matrix and X and B are N-by-NRHS matrices
9
11 SUBROUTINE SSYSVXX( FACT, UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, EQUED,
12 S, B, LDB, X, LDX, RCOND, RPVGRW, BERR, N_ERR_BNDS,
13 ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
14 WORK, IWORK, INFO )
15
16 IMPLICIT NONE
17
18 CHARACTER EQUED, FACT, UPLO
19
20 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
21 N_ERR_BNDS
22
23 REAL RCOND, RPVGRW
24
25 INTEGER IPIV( * ), IWORK( * )
26
27 REAL A( LDA, * ), AF( LDAF, * ), B( LDB, * ), X( LDX, *
28 ), WORK( * )
29
30 REAL S( * ), PARAMS( * ), BERR( * ), ERR_BNDS_NORM(
31 NRHS, * ), ERR_BNDS_COMP( NRHS, * )
32
34 SSYSVXX uses the diagonal pivoting factorization to compute the
35 solution to a real system of linear equations A * X = B, where A
36 is an N-by-N symmetric matrix and X and B are N-by-NRHS matrices.
37 If requested, both normwise and maximum componentwise error bounds
38 are returned. SSYSVXX will return a solution with a tiny
39 guaranteed error (O(eps) where eps is the working machine
40 precision) unless the matrix is very ill-conditioned, in which
41 case a warning is returned. Relevant condition numbers also are
42 calculated and returned.
43 SSYSVXX accepts user-provided factorizations and equilibration
44 factors; see the definitions of the FACT and EQUED options.
45 Solving with refinement and using a factorization from a previous
46 SSYSVXX call will also produce a solution with either O(eps)
47 errors or warnings, but we cannot make that claim for general
48 user-provided factorizations and equilibration factors if they
49 differ from what SSYSVXX would itself produce.
50
52 The following steps are performed:
53 1. If FACT = 'E', real scaling factors are computed to equilibrate
54 the system:
55 diag(S)*A*diag(S) *inv(diag(S))*X = diag(S)*B
56 Whether or not the system will be equilibrated depends on the
57 scaling of the matrix A, but if equilibration is used, A is
58 overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
59 2. If FACT = 'N' or 'E', the LU decomposition is used to factor
60 the matrix A (after equilibration if FACT = 'E') as
61 A = U * D * U**T, if UPLO = 'U', or
62 A = L * D * L**T, if UPLO = 'L',
63 where U (or L) is a product of permutation and unit upper (lower)
64 triangular matrices, and D is symmetric and block diagonal with
65 1-by-1 and 2-by-2 diagonal blocks.
66 3. If some D(i,i)=0, so that D is exactly singular, then the
67 routine returns with INFO = i. Otherwise, the factored form of A
68 is used to estimate the condition number of the matrix A (see
69 argument RCOND). If the reciprocal of the condition number is
70 less than machine precision, the routine still goes on to solve
71 for X and compute error bounds as described below.
72 4. The system of equations is solved for X using the factored form
73 of A.
74 5. By default (unless PARAMS(LA_LINRX_ITREF_I) is set to zero),
75 the routine will use iterative refinement to try to get a small
76 error and error bounds. Refinement calculates the residual to at
77 least twice the working precision.
78 6. If equilibration was used, the matrix X is premultiplied by
79 diag(R) so that it solves the original system before
80 equilibration.
81
83 Some optional parameters are bundled in the PARAMS array. These set‐
84 tings determine how refinement is performed, but often the defaults are
85 acceptable. If the defaults are acceptable, users can pass NPARAMS = 0
86 which prevents the source code from accessing the PARAMS argument.
87
88 FACT (input) CHARACTER*1
89 Specifies whether or not the factored form of the matrix A is
90 supplied on entry, and if not, whether the matrix A should be
91 equilibrated before it is factored. = 'F': On entry, AF and
92 IPIV contain the factored form of A. If EQUED is not 'N', the
93 matrix A has been equilibrated with scaling factors given by S.
94 A, AF, and IPIV are not modified. = 'N': The matrix A will be
95 copied to AF and factored.
96 = 'E': The matrix A will be equilibrated if necessary, then
97 copied to AF and factored.
98
99 N (input) INTEGER
100 The number of linear equations, i.e., the order of the matrix
101 A. N >= 0.
102
103 NRHS (input) INTEGER
104 The number of right hand sides, i.e., the number of columns of
105 the matrices B and X. NRHS >= 0.
106
107 A (input/output) REAL array, dimension (LDA,N)
108 The symmetric matrix A. If UPLO = 'U', the leading N-by-N
109 upper triangular part of A contains the upper triangular part
110 of the matrix A, and the strictly lower triangular part of A is
111 not referenced. If UPLO = 'L', the leading N-by-N lower trian‐
112 gular part of A contains the lower triangular part of the
113 matrix A, and the strictly upper triangular part of A is not
114 referenced. On exit, if FACT = 'E' and EQUED = 'Y', A is over‐
115 written by diag(S)*A*diag(S).
116
117 LDA (input) INTEGER
118 The leading dimension of the array A. LDA >= max(1,N).
119
120 AF (input or output) REAL array, dimension (LDAF,N)
121 If FACT = 'F', then AF is an input argument and on entry con‐
122 tains the block diagonal matrix D and the multipliers used to
123 obtain the factor U or L from the factorization A = U*D*U**T or
124 A = L*D*L**T as computed by SSYTRF. If FACT = 'N', then AF is
125 an output argument and on exit returns the block diagonal
126 matrix D and the multipliers used to obtain the factor U or L
127 from the factorization A = U*D*U**T or A = L*D*L**T.
128
129 LDAF (input) INTEGER
130 The leading dimension of the array AF. LDAF >= max(1,N).
131
132 IPIV (input or output) INTEGER array, dimension (N)
133 If FACT = 'F', then IPIV is an input argument and on entry con‐
134 tains details of the interchanges and the block structure of D,
135 as determined by SSYTRF. If IPIV(k) > 0, then rows and columns
136 k and IPIV(k) were interchanged and D(k,k) is a 1-by-1 diagonal
137 block. If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows
138 and columns k-1 and -IPIV(k) were interchanged and
139 D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If UPLO = 'L' and
140 IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k)
141 were interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal
142 block. If FACT = 'N', then IPIV is an output argument and on
143 exit contains details of the interchanges and the block struc‐
144 ture of D, as determined by SSYTRF.
145
146 EQUED (input or output) CHARACTER*1
147 Specifies the form of equilibration that was done. = 'N': No
148 equilibration (always true if FACT = 'N').
149 = 'Y': Both row and column equilibration, i.e., A has been
150 replaced by diag(S) * A * diag(S). EQUED is an input argument
151 if FACT = 'F'; otherwise, it is an output argument.
152
153 S (input or output) REAL array, dimension (N)
154 The scale factors for A. If EQUED = 'Y', A is multiplied on
155 the left and right by diag(S). S is an input argument if FACT
156 = 'F'; otherwise, S is an output argument. If FACT = 'F' and
157 EQUED = 'Y', each element of S must be positive. If S is out‐
158 put, each element of S is a power of the radix. If S is input,
159 each element of S should be a power of the radix to ensure a
160 reliable solution and error estimates. Scaling by powers of the
161 radix does not cause rounding errors unless the result under‐
162 flows or overflows. Rounding errors during scaling lead to
163 refining with a matrix that is not equivalent to the input
164 matrix, producing error estimates that may not be reliable.
165
166 B (input/output) REAL array, dimension (LDB,NRHS)
167 On entry, the N-by-NRHS right hand side matrix B. On exit, if
168 EQUED = 'N', B is not modified; if EQUED = 'Y', B is overwrit‐
169 ten by diag(S)*B;
170
171 LDB (input) INTEGER
172 The leading dimension of the array B. LDB >= max(1,N).
173
174 X (output) REAL array, dimension (LDX,NRHS)
175 If INFO = 0, the N-by-NRHS solution matrix X to the original
176 system of equations. Note that A and B are modified on exit if
177 EQUED .ne. 'N', and the solution to the equilibrated system is
178 inv(diag(S))*X.
179
180 LDX (input) INTEGER
181 The leading dimension of the array X. LDX >= max(1,N).
182
183 RCOND (output) REAL
184 Reciprocal scaled condition number. This is an estimate of the
185 reciprocal Skeel condition number of the matrix A after equili‐
186 bration (if done). If this is less than the machine precision
187 (in particular, if it is zero), the matrix is singular to work‐
188 ing precision. Note that the error may still be small even if
189 this number is very small and the matrix appears ill- condi‐
190 tioned.
191
192 RPVGRW (output) REAL
193 Reciprocal pivot growth. On exit, this contains the reciprocal
194 pivot growth factor norm(A)/norm(U). The "max absolute element"
195 norm is used. If this is much less than 1, then the stability
196 of the LU factorization of the (equilibrated) matrix A could be
197 poor. This also means that the solution X, estimated condition
198 numbers, and error bounds could be unreliable. If factorization
199 fails with 0<INFO<=N, then this contains the reciprocal pivot
200 growth factor for the leading INFO columns of A.
201
202 BERR (output) REAL array, dimension (NRHS)
203 Componentwise relative backward error. This is the component‐
204 wise relative backward error of each solution vector X(j)
205 (i.e., the smallest relative change in any element of A or B
206 that makes X(j) an exact solution). N_ERR_BNDS (input) INTEGER
207 Number of error bounds to return for each right hand side and
208 each type (normwise or componentwise). See ERR_BNDS_NORM and
209 ERR_BNDS_COMP below.
210
211 ERR_BNDS_NORM (output) REAL array, dimension (NRHS, N_ERR_BNDS)
212 For each right-hand side, this array contains informa‐
213 tion about various error bounds and condition numbers
214 corresponding to the normwise relative error, which is
215 defined as follows: Normwise relative error in the ith
216 solution vector: max_j (abs(XTRUE(j,i) - X(j,i)))
217 ------------------------------ max_j abs(X(j,i)) The
218 array is indexed by the type of error information as
219 described below. There currently are up to three pieces
220 of information returned. The first index in
221 ERR_BNDS_NORM(i,:) corresponds to the ith right-hand
222 side. The second index in ERR_BNDS_NORM(:,err) contains
223 the following three fields: err = 1 "Trust/don't trust"
224 boolean. Trust the answer if the reciprocal condition
225 number is less than the threshold sqrt(n) *
226 slamch('Epsilon'). err = 2 "Guaranteed" error bound:
227 The estimated forward error, almost certainly within a
228 factor of 10 of the true error so long as the next entry
229 is greater than the threshold sqrt(n) *
230 slamch('Epsilon'). This error bound should only be
231 trusted if the previous boolean is true. err = 3
232 Reciprocal condition number: Estimated normwise recipro‐
233 cal condition number. Compared with the threshold
234 sqrt(n) * slamch('Epsilon') to determine if the error
235 estimate is "guaranteed". These reciprocal condition
236 numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf)) for
237 some appropriately scaled matrix Z. Let Z = S*A, where
238 S scales each row by a power of the radix so all abso‐
239 lute row sums of Z are approximately 1. See Lapack
240 Working Note 165 for further details and extra cautions.
241
242 ERR_BNDS_COMP (output) REAL array, dimension (NRHS, N_ERR_BNDS)
243 For each right-hand side, this array contains informa‐
244 tion about various error bounds and condition numbers
245 corresponding to the componentwise relative error, which
246 is defined as follows: Componentwise relative error in
247 the ith solution vector: abs(XTRUE(j,i) - X(j,i)) max_j
248 ---------------------- abs(X(j,i)) The array is indexed
249 by the right-hand side i (on which the componentwise
250 relative error depends), and the type of error informa‐
251 tion as described below. There currently are up to three
252 pieces of information returned for each right-hand side.
253 If componentwise accuracy is not requested (PARAMS(3) =
254 0.0), then ERR_BNDS_COMP is not accessed. If N_ERR_BNDS
255 .LT. 3, then at most the first (:,N_ERR_BNDS) entries
256 are returned. The first index in ERR_BNDS_COMP(i,:)
257 corresponds to the ith right-hand side. The second
258 index in ERR_BNDS_COMP(:,err) contains the following
259 three fields: err = 1 "Trust/don't trust" boolean. Trust
260 the answer if the reciprocal condition number is less
261 than the threshold sqrt(n) * slamch('Epsilon'). err = 2
262 "Guaranteed" error bound: The estimated forward error,
263 almost certainly within a factor of 10 of the true error
264 so long as the next entry is greater than the threshold
265 sqrt(n) * slamch('Epsilon'). This error bound should
266 only be trusted if the previous boolean is true. err =
267 3 Reciprocal condition number: Estimated componentwise
268 reciprocal condition number. Compared with the thresh‐
269 old sqrt(n) * slamch('Epsilon') to determine if the
270 error estimate is "guaranteed". These reciprocal condi‐
271 tion numbers are 1 / (norm(Z^{-1},inf) * norm(Z,inf))
272 for some appropriately scaled matrix Z. Let Z =
273 S*(A*diag(x)), where x is the solution for the current
274 right-hand side and S scales each row of A*diag(x) by a
275 power of the radix so all absolute row sums of Z are
276 approximately 1. See Lapack Working Note 165 for fur‐
277 ther details and extra cautions. NPARAMS (input) INTE‐
278 GER Specifies the number of parameters set in PARAMS.
279 If .LE. 0, the PARAMS array is never referenced and
280 default values are used.
281
282 PARAMS (input / output) REAL array, dimension NPARAMS
283 Specifies algorithm parameters. If an entry is .LT. 0.0, then
284 that entry will be filled with default value used for that
285 parameter. Only positions up to NPARAMS are accessed; defaults
286 are used for higher-numbered parameters.
287 PARAMS(LA_LINRX_ITREF_I = 1) : Whether to perform iterative
288 refinement or not. Default: 1.0
289 = 0.0 : No refinement is performed, and no error bounds are
290 computed. = 1.0 : Use the double-precision refinement algo‐
291 rithm, possibly with doubled-single computations if the compi‐
292 lation environment does not support DOUBLE PRECISION. (other
293 values are reserved for future use) PARAMS(LA_LINRX_ITHRESH_I =
294 2) : Maximum number of residual computations allowed for
295 refinement. Default: 10
296 Aggressive: Set to 100 to permit convergence using approximate
297 factorizations or factorizations other than LU. If the factor‐
298 ization uses a technique other than Gaussian elimination, the
299 guarantees in err_bnds_norm and err_bnds_comp may no longer be
300 trustworthy. PARAMS(LA_LINRX_CWISE_I = 3) : Flag determining
301 if the code will attempt to find a solution with small compo‐
302 nentwise relative error in the double-precision algorithm.
303 Positive is true, 0.0 is false. Default: 1.0 (attempt compo‐
304 nentwise convergence)
305
306 WORK (workspace) REAL array, dimension (4*N)
307
308 IWORK (workspace) INTEGER array, dimension (N)
309
310 INFO (output) INTEGER
311 = 0: Successful exit. The solution to every right-hand side is
312 guaranteed. < 0: If INFO = -i, the i-th argument had an ille‐
313 gal value
314 > 0 and <= N: U(INFO,INFO) is exactly zero. The factorization
315 has been completed, but the factor U is exactly singular, so
316 the solution and error bounds could not be computed. RCOND = 0
317 is returned. = N+J: The solution corresponding to the Jth
318 right-hand side is not guaranteed. The solutions corresponding
319 to other right- hand sides K with K > J may not be guaranteed
320 as well, but only the first such right-hand side is reported.
321 If a small componentwise error is not requested (PARAMS(3) =
322 0.0) then the Jth right-hand side is the first with a normwise
323 error bound that is not guaranteed (the smallest J such that
324 ERR_BNDS_NORM(J,1) = 0.0). By default (PARAMS(3) = 1.0) the Jth
325 right-hand side is the first with either a normwise or compo‐
326 nentwise error bound that is not guaranteed (the smallest J
327 such that either ERR_BNDS_NORM(J,1) = 0.0 or ERR_BNDS_COMP(J,1)
328 = 0.0). See the definition of ERR_BNDS_NORM(:,1) and
329 ERR_BNDS_COMP(:,1). To get information about all of the right-
330 hand sides check ERR_BNDS_NORM or ERR_BNDS_COMP.
331
332
333
334 LAPACK driver routine (versionNo3v.e2m)ber 2008 SSYSVXX(1)