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