LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
dptsvx.f
Go to the documentation of this file.
1*> \brief <b> DPTSVX computes the solution to system of linear equations A * X = B for PT matrices</b>
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download DPTSVX + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dptsvx.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dptsvx.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dptsvx.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE DPTSVX( FACT, N, NRHS, D, E, DF, EF, B, LDB, X, LDX,
20* RCOND, FERR, BERR, WORK, INFO )
21*
22* .. Scalar Arguments ..
23* CHARACTER FACT
24* INTEGER INFO, LDB, LDX, N, NRHS
25* DOUBLE PRECISION RCOND
26* ..
27* .. Array Arguments ..
28* DOUBLE PRECISION B( LDB, * ), BERR( * ), D( * ), DF( * ),
29* $ E( * ), EF( * ), FERR( * ), WORK( * ),
30* $ X( LDX, * )
31* ..
32*
33*
34*> \par Purpose:
35* =============
36*>
37*> \verbatim
38*>
39*> DPTSVX uses the factorization A = L*D*L**T to compute the solution
40*> to a real system of linear equations A*X = B, where A is an N-by-N
41*> symmetric positive definite tridiagonal matrix and X and B are
42*> N-by-NRHS matrices.
43*>
44*> Error bounds on the solution and a condition estimate are also
45*> provided.
46*> \endverbatim
47*
48*> \par Description:
49* =================
50*>
51*> \verbatim
52*>
53*> The following steps are performed:
54*>
55*> 1. If FACT = 'N', the matrix A is factored as A = L*D*L**T, where L
56*> is a unit lower bidiagonal matrix and D is diagonal. The
57*> factorization can also be regarded as having the form
58*> A = U**T*D*U.
59*>
60*> 2. If the leading principal minor of order i is not positive,
61*> then the routine returns with INFO = i. Otherwise, the factored
62*> form of A is used to estimate the condition number of the matrix
63*> A. If the reciprocal of the condition number is less than machine
64*> precision, INFO = N+1 is returned as a warning, but the routine
65*> still goes on to solve for X and compute error bounds as
66*> described below.
67*>
68*> 3. The system of equations is solved for X using the factored form
69*> of A.
70*>
71*> 4. Iterative refinement is applied to improve the computed solution
72*> matrix and calculate error bounds and backward error estimates
73*> for it.
74*> \endverbatim
75*
76* Arguments:
77* ==========
78*
79*> \param[in] FACT
80*> \verbatim
81*> FACT is CHARACTER*1
82*> Specifies whether or not the factored form of A has been
83*> supplied on entry.
84*> = 'F': On entry, DF and EF contain the factored form of A.
85*> D, E, DF, and EF will not be modified.
86*> = 'N': The matrix A will be copied to DF and EF and
87*> factored.
88*> \endverbatim
89*>
90*> \param[in] N
91*> \verbatim
92*> N is INTEGER
93*> The order of the matrix A. N >= 0.
94*> \endverbatim
95*>
96*> \param[in] NRHS
97*> \verbatim
98*> NRHS is INTEGER
99*> The number of right hand sides, i.e., the number of columns
100*> of the matrices B and X. NRHS >= 0.
101*> \endverbatim
102*>
103*> \param[in] D
104*> \verbatim
105*> D is DOUBLE PRECISION array, dimension (N)
106*> The n diagonal elements of the tridiagonal matrix A.
107*> \endverbatim
108*>
109*> \param[in] E
110*> \verbatim
111*> E is DOUBLE PRECISION array, dimension (N-1)
112*> The (n-1) subdiagonal elements of the tridiagonal matrix A.
113*> \endverbatim
114*>
115*> \param[in,out] DF
116*> \verbatim
117*> DF is DOUBLE PRECISION array, dimension (N)
118*> If FACT = 'F', then DF is an input argument and on entry
119*> contains the n diagonal elements of the diagonal matrix D
120*> from the L*D*L**T factorization of A.
121*> If FACT = 'N', then DF is an output argument and on exit
122*> contains the n diagonal elements of the diagonal matrix D
123*> from the L*D*L**T factorization of A.
124*> \endverbatim
125*>
126*> \param[in,out] EF
127*> \verbatim
128*> EF is DOUBLE PRECISION array, dimension (N-1)
129*> If FACT = 'F', then EF is an input argument and on entry
130*> contains the (n-1) subdiagonal elements of the unit
131*> bidiagonal factor L from the L*D*L**T factorization of A.
132*> If FACT = 'N', then EF is an output argument and on exit
133*> contains the (n-1) subdiagonal elements of the unit
134*> bidiagonal factor L from the L*D*L**T factorization of A.
135*> \endverbatim
136*>
137*> \param[in] B
138*> \verbatim
139*> B is DOUBLE PRECISION array, dimension (LDB,NRHS)
140*> The N-by-NRHS right hand side matrix B.
141*> \endverbatim
142*>
143*> \param[in] LDB
144*> \verbatim
145*> LDB is INTEGER
146*> The leading dimension of the array B. LDB >= max(1,N).
147*> \endverbatim
148*>
149*> \param[out] X
150*> \verbatim
151*> X is DOUBLE PRECISION array, dimension (LDX,NRHS)
152*> If INFO = 0 of INFO = N+1, the N-by-NRHS solution matrix X.
153*> \endverbatim
154*>
155*> \param[in] LDX
156*> \verbatim
157*> LDX is INTEGER
158*> The leading dimension of the array X. LDX >= max(1,N).
159*> \endverbatim
160*>
161*> \param[out] RCOND
162*> \verbatim
163*> RCOND is DOUBLE PRECISION
164*> The reciprocal condition number of the matrix A. If RCOND
165*> is less than the machine precision (in particular, if
166*> RCOND = 0), the matrix is singular to working precision.
167*> This condition is indicated by a return code of INFO > 0.
168*> \endverbatim
169*>
170*> \param[out] FERR
171*> \verbatim
172*> FERR is DOUBLE PRECISION array, dimension (NRHS)
173*> The forward error bound for each solution vector
174*> X(j) (the j-th column of the solution matrix X).
175*> If XTRUE is the true solution corresponding to X(j), FERR(j)
176*> is an estimated upper bound for the magnitude of the largest
177*> element in (X(j) - XTRUE) divided by the magnitude of the
178*> largest element in X(j).
179*> \endverbatim
180*>
181*> \param[out] BERR
182*> \verbatim
183*> BERR is DOUBLE PRECISION array, dimension (NRHS)
184*> The componentwise relative backward error of each solution
185*> vector X(j) (i.e., the smallest relative change in any
186*> element of A or B that makes X(j) an exact solution).
187*> \endverbatim
188*>
189*> \param[out] WORK
190*> \verbatim
191*> WORK is DOUBLE PRECISION array, dimension (2*N)
192*> \endverbatim
193*>
194*> \param[out] INFO
195*> \verbatim
196*> INFO is INTEGER
197*> = 0: successful exit
198*> < 0: if INFO = -i, the i-th argument had an illegal value
199*> > 0: if INFO = i, and i is
200*> <= N: the leading principal minor of order i of A
201*> is not positive, so the factorization could not
202*> be completed, and the solution has not been
203*> computed. RCOND = 0 is returned.
204*> = N+1: U is nonsingular, but RCOND is less than machine
205*> precision, meaning that the matrix is singular
206*> to working precision. Nevertheless, the
207*> solution and error bounds are computed because
208*> there are a number of situations where the
209*> computed solution can be more accurate than the
210*> value of RCOND would suggest.
211*> \endverbatim
212*
213* Authors:
214* ========
215*
216*> \author Univ. of Tennessee
217*> \author Univ. of California Berkeley
218*> \author Univ. of Colorado Denver
219*> \author NAG Ltd.
220*
221*> \ingroup ptsvx
222*
223* =====================================================================
224 SUBROUTINE dptsvx( FACT, N, NRHS, D, E, DF, EF, B, LDB, X, LDX,
225 $ RCOND, FERR, BERR, WORK, INFO )
226*
227* -- LAPACK driver routine --
228* -- LAPACK is a software package provided by Univ. of Tennessee, --
229* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
230*
231* .. Scalar Arguments ..
232 CHARACTER FACT
233 INTEGER INFO, LDB, LDX, N, NRHS
234 DOUBLE PRECISION RCOND
235* ..
236* .. Array Arguments ..
237 DOUBLE PRECISION B( LDB, * ), BERR( * ), D( * ), DF( * ),
238 $ e( * ), ef( * ), ferr( * ), work( * ),
239 $ x( ldx, * )
240* ..
241*
242* =====================================================================
243*
244* .. Parameters ..
245 DOUBLE PRECISION ZERO
246 parameter( zero = 0.0d+0 )
247* ..
248* .. Local Scalars ..
249 LOGICAL NOFACT
250 DOUBLE PRECISION ANORM
251* ..
252* .. External Functions ..
253 LOGICAL LSAME
254 DOUBLE PRECISION DLAMCH, DLANST
255 EXTERNAL lsame, dlamch, dlanst
256* ..
257* .. External Subroutines ..
258 EXTERNAL dcopy, dlacpy, dptcon, dptrfs, dpttrf,
259 $ dpttrs,
260 $ xerbla
261* ..
262* .. Intrinsic Functions ..
263 INTRINSIC max
264* ..
265* .. Executable Statements ..
266*
267* Test the input parameters.
268*
269 info = 0
270 nofact = lsame( fact, 'N' )
271 IF( .NOT.nofact .AND. .NOT.lsame( fact, 'F' ) ) THEN
272 info = -1
273 ELSE IF( n.LT.0 ) THEN
274 info = -2
275 ELSE IF( nrhs.LT.0 ) THEN
276 info = -3
277 ELSE IF( ldb.LT.max( 1, n ) ) THEN
278 info = -9
279 ELSE IF( ldx.LT.max( 1, n ) ) THEN
280 info = -11
281 END IF
282 IF( info.NE.0 ) THEN
283 CALL xerbla( 'DPTSVX', -info )
284 RETURN
285 END IF
286*
287 IF( nofact ) THEN
288*
289* Compute the L*D*L**T (or U**T*D*U) factorization of A.
290*
291 CALL dcopy( n, d, 1, df, 1 )
292 IF( n.GT.1 )
293 $ CALL dcopy( n-1, e, 1, ef, 1 )
294 CALL dpttrf( n, df, ef, info )
295*
296* Return if INFO is non-zero.
297*
298 IF( info.GT.0 )THEN
299 rcond = zero
300 RETURN
301 END IF
302 END IF
303*
304* Compute the norm of the matrix A.
305*
306 anorm = dlanst( '1', n, d, e )
307*
308* Compute the reciprocal of the condition number of A.
309*
310 CALL dptcon( n, df, ef, anorm, rcond, work, info )
311*
312* Compute the solution vectors X.
313*
314 CALL dlacpy( 'Full', n, nrhs, b, ldb, x, ldx )
315 CALL dpttrs( n, nrhs, df, ef, x, ldx, info )
316*
317* Use iterative refinement to improve the computed solutions and
318* compute error bounds and backward error estimates for them.
319*
320 CALL dptrfs( n, nrhs, d, e, df, ef, b, ldb, x, ldx, ferr, berr,
321 $ work, info )
322*
323* Set INFO = N+1 if the matrix is singular to working precision.
324*
325 IF( rcond.LT.dlamch( 'Epsilon' ) )
326 $ info = n + 1
327*
328 RETURN
329*
330* End of DPTSVX
331*
332 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
Definition dcopy.f:82
subroutine dlacpy(uplo, m, n, a, lda, b, ldb)
DLACPY copies all or part of one two-dimensional array to another.
Definition dlacpy.f:101
subroutine dptcon(n, d, e, anorm, rcond, work, info)
DPTCON
Definition dptcon.f:116
subroutine dptrfs(n, nrhs, d, e, df, ef, b, ldb, x, ldx, ferr, berr, work, info)
DPTRFS
Definition dptrfs.f:161
subroutine dptsvx(fact, n, nrhs, d, e, df, ef, b, ldb, x, ldx, rcond, ferr, berr, work, info)
DPTSVX computes the solution to system of linear equations A * X = B for PT matrices
Definition dptsvx.f:226
subroutine dpttrf(n, d, e, info)
DPTTRF
Definition dpttrf.f:89
subroutine dpttrs(n, nrhs, d, e, b, ldb, info)
DPTTRS
Definition dpttrs.f:107