1 *> \brief <b> ZPTSVX computes the solution to system of linear equations A * X = B for PT matrices</b>
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZPTSVX + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zptsvx.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zptsvx.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zptsvx.f">
21 * SUBROUTINE ZPTSVX( FACT, N, NRHS, D, E, DF, EF, B, LDB, X, LDX,
22 * RCOND, FERR, BERR, WORK, RWORK, INFO )
24 * .. Scalar Arguments ..
26 * INTEGER INFO, LDB, LDX, N, NRHS
27 * DOUBLE PRECISION RCOND
29 * .. Array Arguments ..
30 * DOUBLE PRECISION BERR( * ), D( * ), DF( * ), FERR( * ),
32 * COMPLEX*16 B( LDB, * ), E( * ), EF( * ), WORK( * ),
42 *> ZPTSVX uses the factorization A = L*D*L**H to compute the solution
43 *> to a complex system of linear equations A*X = B, where A is an
44 *> N-by-N Hermitian positive definite tridiagonal matrix and X and B
45 *> are N-by-NRHS matrices.
47 *> Error bounds on the solution and a condition estimate are also
56 *> The following steps are performed:
58 *> 1. If FACT = 'N', the matrix A is factored as A = L*D*L**H, where L
59 *> is a unit lower bidiagonal matrix and D is diagonal. The
60 *> factorization can also be regarded as having the form
63 *> 2. If the leading i-by-i principal minor is not positive definite,
64 *> then the routine returns with INFO = i. Otherwise, the factored
65 *> form of A is used to estimate the condition number of the matrix
66 *> A. If the reciprocal of the condition number is less than machine
67 *> precision, INFO = N+1 is returned as a warning, but the routine
68 *> still goes on to solve for X and compute error bounds as
71 *> 3. The system of equations is solved for X using the factored form
74 *> 4. Iterative refinement is applied to improve the computed solution
75 *> matrix and calculate error bounds and backward error estimates
84 *> FACT is CHARACTER*1
85 *> Specifies whether or not the factored form of the matrix
86 *> A is supplied on entry.
87 *> = 'F': On entry, DF and EF contain the factored form of A.
88 *> D, E, DF, and EF will not be modified.
89 *> = 'N': The matrix A will be copied to DF and EF and
96 *> The order of the matrix A. N >= 0.
102 *> The number of right hand sides, i.e., the number of columns
103 *> of the matrices B and X. NRHS >= 0.
108 *> D is DOUBLE PRECISION array, dimension (N)
109 *> The n diagonal elements of the tridiagonal matrix A.
114 *> E is COMPLEX*16 array, dimension (N-1)
115 *> The (n-1) subdiagonal elements of the tridiagonal matrix A.
120 *> DF is DOUBLE PRECISION array, dimension (N)
121 *> If FACT = 'F', then DF is an input argument and on entry
122 *> contains the n diagonal elements of the diagonal matrix D
123 *> from the L*D*L**H factorization of A.
124 *> If FACT = 'N', then DF is an output argument and on exit
125 *> contains the n diagonal elements of the diagonal matrix D
126 *> from the L*D*L**H factorization of A.
131 *> EF is COMPLEX*16 array, dimension (N-1)
132 *> If FACT = 'F', then EF is an input argument and on entry
133 *> contains the (n-1) subdiagonal elements of the unit
134 *> bidiagonal factor L from the L*D*L**H factorization of A.
135 *> If FACT = 'N', then EF is an output argument and on exit
136 *> contains the (n-1) subdiagonal elements of the unit
137 *> bidiagonal factor L from the L*D*L**H factorization of A.
142 *> B is COMPLEX*16 array, dimension (LDB,NRHS)
143 *> The N-by-NRHS right hand side matrix B.
149 *> The leading dimension of the array B. LDB >= max(1,N).
154 *> X is COMPLEX*16 array, dimension (LDX,NRHS)
155 *> If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X.
161 *> The leading dimension of the array X. LDX >= max(1,N).
166 *> RCOND is DOUBLE PRECISION
167 *> The reciprocal condition number of the matrix A. If RCOND
168 *> is less than the machine precision (in particular, if
169 *> RCOND = 0), the matrix is singular to working precision.
170 *> This condition is indicated by a return code of INFO > 0.
175 *> FERR is DOUBLE PRECISION array, dimension (NRHS)
176 *> The forward error bound for each solution vector
177 *> X(j) (the j-th column of the solution matrix X).
178 *> If XTRUE is the true solution corresponding to X(j), FERR(j)
179 *> is an estimated upper bound for the magnitude of the largest
180 *> element in (X(j) - XTRUE) divided by the magnitude of the
181 *> largest element in X(j).
186 *> BERR is DOUBLE PRECISION array, dimension (NRHS)
187 *> The componentwise relative backward error of each solution
188 *> vector X(j) (i.e., the smallest relative change in any
189 *> element of A or B that makes X(j) an exact solution).
194 *> WORK is COMPLEX*16 array, dimension (N)
199 *> RWORK is DOUBLE PRECISION array, dimension (N)
205 *> = 0: successful exit
206 *> < 0: if INFO = -i, the i-th argument had an illegal value
207 *> > 0: if INFO = i, and i is
208 *> <= N: the leading minor of order i of A is
209 *> not positive definite, so the factorization
210 *> could not be completed, and the solution has not
211 *> been computed. RCOND = 0 is returned.
212 *> = N+1: U is nonsingular, but RCOND is less than machine
213 *> precision, meaning that the matrix is singular
214 *> to working precision. Nevertheless, the
215 *> solution and error bounds are computed because
216 *> there are a number of situations where the
217 *> computed solution can be more accurate than the
218 *> value of RCOND would suggest.
224 *> \author Univ. of Tennessee
225 *> \author Univ. of California Berkeley
226 *> \author Univ. of Colorado Denver
229 *> \date September 2012
231 *> \ingroup complex16PTsolve
233 * =====================================================================
234 SUBROUTINE ZPTSVX( FACT, N, NRHS, D, E, DF, EF, B, LDB, X, LDX,
235 $ RCOND, FERR, BERR, WORK, RWORK, INFO )
237 * -- LAPACK driver routine (version 3.4.2) --
238 * -- LAPACK is a software package provided by Univ. of Tennessee, --
239 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
242 * .. Scalar Arguments ..
244 INTEGER INFO, LDB, LDX, N, NRHS
245 DOUBLE PRECISION RCOND
247 * .. Array Arguments ..
248 DOUBLE PRECISION BERR( * ), D( * ), DF( * ), FERR( * ),
250 COMPLEX*16 B( LDB, * ), E( * ), EF( * ), WORK( * ),
254 * =====================================================================
257 DOUBLE PRECISION ZERO
258 PARAMETER ( ZERO = 0.0D+0 )
260 * .. Local Scalars ..
262 DOUBLE PRECISION ANORM
264 * .. External Functions ..
266 DOUBLE PRECISION DLAMCH, ZLANHT
267 EXTERNAL LSAME, DLAMCH, ZLANHT
269 * .. External Subroutines ..
270 EXTERNAL DCOPY, XERBLA, ZCOPY, ZLACPY, ZPTCON, ZPTRFS,
273 * .. Intrinsic Functions ..
276 * .. Executable Statements ..
278 * Test the input parameters.
281 NOFACT = LSAME( FACT, 'N' )
282 IF( .NOT.NOFACT .AND. .NOT.LSAME( FACT, 'F' ) ) THEN
284 ELSE IF( N.LT.0 ) THEN
286 ELSE IF( NRHS.LT.0 ) THEN
288 ELSE IF( LDB.LT.MAX( 1, N ) ) THEN
290 ELSE IF( LDX.LT.MAX( 1, N ) ) THEN
294 CALL XERBLA( 'ZPTSVX', -INFO )
300 * Compute the L*D*L**H (or U**H*D*U) factorization of A.
302 CALL DCOPY( N, D, 1, DF, 1 )
304 $ CALL ZCOPY( N-1, E, 1, EF, 1 )
305 CALL ZPTTRF( N, DF, EF, INFO )
307 * Return if INFO is non-zero.
315 * Compute the norm of the matrix A.
317 ANORM = ZLANHT( '1', N, D, E )
319 * Compute the reciprocal of the condition number of A.
321 CALL ZPTCON( N, DF, EF, ANORM, RCOND, RWORK, INFO )
323 * Compute the solution vectors X.
325 CALL ZLACPY( 'Full', N, NRHS, B, LDB, X, LDX )
326 CALL ZPTTRS( 'Lower', N, NRHS, DF, EF, X, LDX, INFO )
328 * Use iterative refinement to improve the computed solutions and
329 * compute error bounds and backward error estimates for them.
331 CALL ZPTRFS( 'Lower', N, NRHS, D, E, DF, EF, B, LDB, X, LDX, FERR,
332 $ BERR, WORK, RWORK, INFO )
334 * Set INFO = N+1 if the matrix is singular to working precision.
336 IF( RCOND.LT.DLAMCH( 'Epsilon' ) )