1: *> \brief \b DLAGTS solves the system of equations (T-λI)x = y or (T-λI)Tx = y,where T is a general tridiagonal matrix and λ a scalar, using the LU factorization computed by slagtf.
2: *
3: * =========== DOCUMENTATION ===========
4: *
5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
7: *
8: *> \htmlonly
9: *> Download DLAGTS + dependencies
10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlagts.f">
11: *> [TGZ]</a>
12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlagts.f">
13: *> [ZIP]</a>
14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlagts.f">
15: *> [TXT]</a>
16: *> \endhtmlonly
17: *
18: * Definition:
19: * ===========
20: *
21: * SUBROUTINE DLAGTS( JOB, N, A, B, C, D, IN, Y, TOL, INFO )
22: *
23: * .. Scalar Arguments ..
24: * INTEGER INFO, JOB, N
25: * DOUBLE PRECISION TOL
26: * ..
27: * .. Array Arguments ..
28: * INTEGER IN( * )
29: * DOUBLE PRECISION A( * ), B( * ), C( * ), D( * ), Y( * )
30: * ..
31: *
32: *
33: *> \par Purpose:
34: * =============
35: *>
36: *> \verbatim
37: *>
38: *> DLAGTS may be used to solve one of the systems of equations
39: *>
40: *> (T - lambda*I)*x = y or (T - lambda*I)**T*x = y,
41: *>
42: *> where T is an n by n tridiagonal matrix, for x, following the
43: *> factorization of (T - lambda*I) as
44: *>
45: *> (T - lambda*I) = P*L*U ,
46: *>
47: *> by routine DLAGTF. The choice of equation to be solved is
48: *> controlled by the argument JOB, and in each case there is an option
49: *> to perturb zero or very small diagonal elements of U, this option
50: *> being intended for use in applications such as inverse iteration.
51: *> \endverbatim
52: *
53: * Arguments:
54: * ==========
55: *
56: *> \param[in] JOB
57: *> \verbatim
58: *> JOB is INTEGER
59: *> Specifies the job to be performed by DLAGTS as follows:
60: *> = 1: The equations (T - lambda*I)x = y are to be solved,
61: *> but diagonal elements of U are not to be perturbed.
62: *> = -1: The equations (T - lambda*I)x = y are to be solved
63: *> and, if overflow would otherwise occur, the diagonal
64: *> elements of U are to be perturbed. See argument TOL
65: *> below.
66: *> = 2: The equations (T - lambda*I)**Tx = y are to be solved,
67: *> but diagonal elements of U are not to be perturbed.
68: *> = -2: The equations (T - lambda*I)**Tx = y are to be solved
69: *> and, if overflow would otherwise occur, the diagonal
70: *> elements of U are to be perturbed. See argument TOL
71: *> below.
72: *> \endverbatim
73: *>
74: *> \param[in] N
75: *> \verbatim
76: *> N is INTEGER
77: *> The order of the matrix T.
78: *> \endverbatim
79: *>
80: *> \param[in] A
81: *> \verbatim
82: *> A is DOUBLE PRECISION array, dimension (N)
83: *> On entry, A must contain the diagonal elements of U as
84: *> returned from DLAGTF.
85: *> \endverbatim
86: *>
87: *> \param[in] B
88: *> \verbatim
89: *> B is DOUBLE PRECISION array, dimension (N-1)
90: *> On entry, B must contain the first super-diagonal elements of
91: *> U as returned from DLAGTF.
92: *> \endverbatim
93: *>
94: *> \param[in] C
95: *> \verbatim
96: *> C is DOUBLE PRECISION array, dimension (N-1)
97: *> On entry, C must contain the sub-diagonal elements of L as
98: *> returned from DLAGTF.
99: *> \endverbatim
100: *>
101: *> \param[in] D
102: *> \verbatim
103: *> D is DOUBLE PRECISION array, dimension (N-2)
104: *> On entry, D must contain the second super-diagonal elements
105: *> of U as returned from DLAGTF.
106: *> \endverbatim
107: *>
108: *> \param[in] IN
109: *> \verbatim
110: *> IN is INTEGER array, dimension (N)
111: *> On entry, IN must contain details of the matrix P as returned
112: *> from DLAGTF.
113: *> \endverbatim
114: *>
115: *> \param[in,out] Y
116: *> \verbatim
117: *> Y is DOUBLE PRECISION array, dimension (N)
118: *> On entry, the right hand side vector y.
119: *> On exit, Y is overwritten by the solution vector x.
120: *> \endverbatim
121: *>
122: *> \param[in,out] TOL
123: *> \verbatim
124: *> TOL is DOUBLE PRECISION
125: *> On entry, with JOB < 0, TOL should be the minimum
126: *> perturbation to be made to very small diagonal elements of U.
127: *> TOL should normally be chosen as about eps*norm(U), where eps
128: *> is the relative machine precision, but if TOL is supplied as
129: *> non-positive, then it is reset to eps*max( abs( u(i,j) ) ).
130: *> If JOB > 0 then TOL is not referenced.
131: *>
132: *> On exit, TOL is changed as described above, only if TOL is
133: *> non-positive on entry. Otherwise TOL is unchanged.
134: *> \endverbatim
135: *>
136: *> \param[out] INFO
137: *> \verbatim
138: *> INFO is INTEGER
139: *> = 0: successful exit
140: *> < 0: if INFO = -i, the i-th argument had an illegal value
141: *> > 0: overflow would occur when computing the INFO(th)
142: *> element of the solution vector x. This can only occur
143: *> when JOB is supplied as positive and either means
144: *> that a diagonal element of U is very small, or that
145: *> the elements of the right-hand side vector y are very
146: *> large.
147: *> \endverbatim
148: *
149: * Authors:
150: * ========
151: *
152: *> \author Univ. of Tennessee
153: *> \author Univ. of California Berkeley
154: *> \author Univ. of Colorado Denver
155: *> \author NAG Ltd.
156: *
157: *> \ingroup OTHERauxiliary
158: *
159: * =====================================================================
160: SUBROUTINE DLAGTS( JOB, N, A, B, C, D, IN, Y, TOL, INFO )
161: *
162: * -- LAPACK auxiliary routine --
163: * -- LAPACK is a software package provided by Univ. of Tennessee, --
164: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
165: *
166: * .. Scalar Arguments ..
167: INTEGER INFO, JOB, N
168: DOUBLE PRECISION TOL
169: * ..
170: * .. Array Arguments ..
171: INTEGER IN( * )
172: DOUBLE PRECISION A( * ), B( * ), C( * ), D( * ), Y( * )
173: * ..
174: *
175: * =====================================================================
176: *
177: * .. Parameters ..
178: DOUBLE PRECISION ONE, ZERO
179: PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
180: * ..
181: * .. Local Scalars ..
182: INTEGER K
183: DOUBLE PRECISION ABSAK, AK, BIGNUM, EPS, PERT, SFMIN, TEMP
184: * ..
185: * .. Intrinsic Functions ..
186: INTRINSIC ABS, MAX, SIGN
187: * ..
188: * .. External Functions ..
189: DOUBLE PRECISION DLAMCH
190: EXTERNAL DLAMCH
191: * ..
192: * .. External Subroutines ..
193: EXTERNAL XERBLA
194: * ..
195: * .. Executable Statements ..
196: *
197: INFO = 0
198: IF( ( ABS( JOB ).GT.2 ) .OR. ( JOB.EQ.0 ) ) THEN
199: INFO = -1
200: ELSE IF( N.LT.0 ) THEN
201: INFO = -2
202: END IF
203: IF( INFO.NE.0 ) THEN
204: CALL XERBLA( 'DLAGTS', -INFO )
205: RETURN
206: END IF
207: *
208: IF( N.EQ.0 )
209: $ RETURN
210: *
211: EPS = DLAMCH( 'Epsilon' )
212: SFMIN = DLAMCH( 'Safe minimum' )
213: BIGNUM = ONE / SFMIN
214: *
215: IF( JOB.LT.0 ) THEN
216: IF( TOL.LE.ZERO ) THEN
217: TOL = ABS( A( 1 ) )
218: IF( N.GT.1 )
219: $ TOL = MAX( TOL, ABS( A( 2 ) ), ABS( B( 1 ) ) )
220: DO 10 K = 3, N
221: TOL = MAX( TOL, ABS( A( K ) ), ABS( B( K-1 ) ),
222: $ ABS( D( K-2 ) ) )
223: 10 CONTINUE
224: TOL = TOL*EPS
225: IF( TOL.EQ.ZERO )
226: $ TOL = EPS
227: END IF
228: END IF
229: *
230: IF( ABS( JOB ).EQ.1 ) THEN
231: DO 20 K = 2, N
232: IF( IN( K-1 ).EQ.0 ) THEN
233: Y( K ) = Y( K ) - C( K-1 )*Y( K-1 )
234: ELSE
235: TEMP = Y( K-1 )
236: Y( K-1 ) = Y( K )
237: Y( K ) = TEMP - C( K-1 )*Y( K )
238: END IF
239: 20 CONTINUE
240: IF( JOB.EQ.1 ) THEN
241: DO 30 K = N, 1, -1
242: IF( K.LE.N-2 ) THEN
243: TEMP = Y( K ) - B( K )*Y( K+1 ) - D( K )*Y( K+2 )
244: ELSE IF( K.EQ.N-1 ) THEN
245: TEMP = Y( K ) - B( K )*Y( K+1 )
246: ELSE
247: TEMP = Y( K )
248: END IF
249: AK = A( K )
250: ABSAK = ABS( AK )
251: IF( ABSAK.LT.ONE ) THEN
252: IF( ABSAK.LT.SFMIN ) THEN
253: IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
254: $ THEN
255: INFO = K
256: RETURN
257: ELSE
258: TEMP = TEMP*BIGNUM
259: AK = AK*BIGNUM
260: END IF
261: ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
262: INFO = K
263: RETURN
264: END IF
265: END IF
266: Y( K ) = TEMP / AK
267: 30 CONTINUE
268: ELSE
269: DO 50 K = N, 1, -1
270: IF( K.LE.N-2 ) THEN
271: TEMP = Y( K ) - B( K )*Y( K+1 ) - D( K )*Y( K+2 )
272: ELSE IF( K.EQ.N-1 ) THEN
273: TEMP = Y( K ) - B( K )*Y( K+1 )
274: ELSE
275: TEMP = Y( K )
276: END IF
277: AK = A( K )
278: PERT = SIGN( TOL, AK )
279: 40 CONTINUE
280: ABSAK = ABS( AK )
281: IF( ABSAK.LT.ONE ) THEN
282: IF( ABSAK.LT.SFMIN ) THEN
283: IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
284: $ THEN
285: AK = AK + PERT
286: PERT = 2*PERT
287: GO TO 40
288: ELSE
289: TEMP = TEMP*BIGNUM
290: AK = AK*BIGNUM
291: END IF
292: ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
293: AK = AK + PERT
294: PERT = 2*PERT
295: GO TO 40
296: END IF
297: END IF
298: Y( K ) = TEMP / AK
299: 50 CONTINUE
300: END IF
301: ELSE
302: *
303: * Come to here if JOB = 2 or -2
304: *
305: IF( JOB.EQ.2 ) THEN
306: DO 60 K = 1, N
307: IF( K.GE.3 ) THEN
308: TEMP = Y( K ) - B( K-1 )*Y( K-1 ) - D( K-2 )*Y( K-2 )
309: ELSE IF( K.EQ.2 ) THEN
310: TEMP = Y( K ) - B( K-1 )*Y( K-1 )
311: ELSE
312: TEMP = Y( K )
313: END IF
314: AK = A( K )
315: ABSAK = ABS( AK )
316: IF( ABSAK.LT.ONE ) THEN
317: IF( ABSAK.LT.SFMIN ) THEN
318: IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
319: $ THEN
320: INFO = K
321: RETURN
322: ELSE
323: TEMP = TEMP*BIGNUM
324: AK = AK*BIGNUM
325: END IF
326: ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
327: INFO = K
328: RETURN
329: END IF
330: END IF
331: Y( K ) = TEMP / AK
332: 60 CONTINUE
333: ELSE
334: DO 80 K = 1, N
335: IF( K.GE.3 ) THEN
336: TEMP = Y( K ) - B( K-1 )*Y( K-1 ) - D( K-2 )*Y( K-2 )
337: ELSE IF( K.EQ.2 ) THEN
338: TEMP = Y( K ) - B( K-1 )*Y( K-1 )
339: ELSE
340: TEMP = Y( K )
341: END IF
342: AK = A( K )
343: PERT = SIGN( TOL, AK )
344: 70 CONTINUE
345: ABSAK = ABS( AK )
346: IF( ABSAK.LT.ONE ) THEN
347: IF( ABSAK.LT.SFMIN ) THEN
348: IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
349: $ THEN
350: AK = AK + PERT
351: PERT = 2*PERT
352: GO TO 70
353: ELSE
354: TEMP = TEMP*BIGNUM
355: AK = AK*BIGNUM
356: END IF
357: ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
358: AK = AK + PERT
359: PERT = 2*PERT
360: GO TO 70
361: END IF
362: END IF
363: Y( K ) = TEMP / AK
364: 80 CONTINUE
365: END IF
366: *
367: DO 90 K = N, 2, -1
368: IF( IN( K-1 ).EQ.0 ) THEN
369: Y( K-1 ) = Y( K-1 ) - C( K-1 )*Y( K )
370: ELSE
371: TEMP = Y( K-1 )
372: Y( K-1 ) = Y( K )
373: Y( K ) = TEMP - C( K-1 )*Y( K )
374: END IF
375: 90 CONTINUE
376: END IF
377: *
378: * End of DLAGTS
379: *
380: END
CVSweb interface <joel.bertrand@systella.fr>