1 SUBROUTINE DLAGTS
( JOB
, N
, A
, B
, C
, D
, IN
, Y
, TOL
, INFO
)
3 * -- LAPACK auxiliary routine
(version
3.1) --
4 * Univ
. of Tennessee
, Univ
. of California Berkeley and NAG Ltd
..
7 * .. Scalar Arguments
..
11 * .. Array Arguments
..
13 DOUBLE PRECISION A
( * ), B
( * ), C
( * ), D
( * ), Y
( * )
19 * DLAGTS may be used
to solve one of the systems of equations
21 * (T
- lambda*I
)*x
= y or
(T
- lambda*I
)'*x = y,
23 * where T is an n by n tridiagonal matrix, for x, following the
24 * factorization of (T - lambda*I) as
26 * (T - lambda*I) = P*L*U ,
28 * by routine DLAGTF. The choice of equation to be solved is
29 * controlled by the argument JOB, and in each case there is an option
30 * to perturb zero or very small diagonal elements of U, this option
31 * being intended for use in applications such as inverse iteration.
37 * Specifies the job to be performed by DLAGTS as follows:
38 * = 1: The equations (T - lambda*I)x = y are to be solved,
39 * but diagonal elements of U are not to be perturbed.
40 * = -1: The equations (T - lambda*I)x = y are to be solved
41 * and, if overflow would otherwise occur, the diagonal
42 * elements of U are to be perturbed. See argument TOL
44 * = 2: The equations (T - lambda*I)'x
= y are
to be solved
,
45 * but diagonal elements of U are not
to be perturbed
.
46 * = -2: The equations
(T
- lambda*I
)'x = y are to be solved
47 * and, if overflow would otherwise occur, the diagonal
48 * elements of U are to be perturbed. See argument TOL
52 * The order of the matrix T.
54 * A (input) DOUBLE PRECISION array, dimension (N)
55 * On entry, A must contain the diagonal elements of U as
56 * returned from DLAGTF.
58 * B (input) DOUBLE PRECISION array, dimension (N-1)
59 * On entry, B must contain the first super-diagonal elements of
60 * U as returned from DLAGTF.
62 * C (input) DOUBLE PRECISION array, dimension (N-1)
63 * On entry, C must contain the sub-diagonal elements of L as
64 * returned from DLAGTF.
66 * D (input) DOUBLE PRECISION array, dimension (N-2)
67 * On entry, D must contain the second super-diagonal elements
68 * of U as returned from DLAGTF.
70 * IN (input) INTEGER array, dimension (N)
71 * On entry, IN must contain details of the matrix P as returned
74 * Y (input/output) DOUBLE PRECISION array, dimension (N)
75 * On entry, the right hand side vector y.
76 * On exit, Y is overwritten by the solution vector x.
78 * TOL (input/output) DOUBLE PRECISION
79 * On entry, with JOB .lt. 0, TOL should be the minimum
80 * perturbation to be made to very small diagonal elements of U.
81 * TOL should normally be chosen as about eps*norm(U), where eps
82 * is the relative machine precision, but if TOL is supplied as
83 * non-positive, then it is reset to eps*max( abs( u(i,j) ) ).
84 * If JOB .gt. 0 then TOL is not referenced.
86 * On exit, TOL is changed as described above, only if TOL is
87 * non-positive on entry. Otherwise TOL is unchanged.
89 * INFO (output) INTEGER
90 * = 0 : successful exit
91 * .lt. 0: if INFO = -i, the i-th argument had an illegal value
92 * .gt. 0: overflow would occur when computing the INFO(th)
93 * element of the solution vector x. This can only occur
94 * when JOB is supplied as positive and either means
95 * that a diagonal element of U is very small, or that
96 * the elements of the right-hand side vector y are very
99 * =====================================================================
102 DOUBLE PRECISION ONE, ZERO
103 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
105 * .. Local Scalars ..
107 DOUBLE PRECISION ABSAK, AK, BIGNUM, EPS, PERT, SFMIN, TEMP
109 * .. Intrinsic Functions ..
110 INTRINSIC ABS, MAX, SIGN
112 * .. External Functions ..
113 DOUBLE PRECISION DLAMCH
116 * .. External Subroutines ..
119 * .. Executable Statements ..
122 IF( ( ABS( JOB ).GT.2 ) .OR. ( JOB.EQ.0 ) ) THEN
124 ELSE IF( N.LT.0 ) THEN
128 CALL XERBLA( 'DLAGTS
', -INFO )
135 EPS = DLAMCH( 'Epsilon
' )
136 SFMIN = DLAMCH( 'Safe minimum
' )
140 IF( TOL.LE.ZERO ) THEN
143 $ TOL = MAX( TOL, ABS( A( 2 ) ), ABS( B( 1 ) ) )
145 TOL = MAX( TOL, ABS( A( K ) ), ABS( B( K-1 ) ),
154 IF( ABS( JOB ).EQ.1 ) THEN
156 IF( IN( K-1 ).EQ.0 ) THEN
157 Y( K ) = Y( K ) - C( K-1 )*Y( K-1 )
161 Y( K ) = TEMP - C( K-1 )*Y( K )
167 TEMP = Y( K ) - B( K )*Y( K+1 ) - D( K )*Y( K+2 )
168 ELSE IF( K.EQ.N-1 ) THEN
169 TEMP = Y( K ) - B( K )*Y( K+1 )
175 IF( ABSAK.LT.ONE ) THEN
176 IF( ABSAK.LT.SFMIN ) THEN
177 IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
185 ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
195 TEMP = Y( K ) - B( K )*Y( K+1 ) - D( K )*Y( K+2 )
196 ELSE IF( K.EQ.N-1 ) THEN
197 TEMP = Y( K ) - B( K )*Y( K+1 )
202 PERT = SIGN( TOL, AK )
205 IF( ABSAK.LT.ONE ) THEN
206 IF( ABSAK.LT.SFMIN ) THEN
207 IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
216 ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
227 * Come to here if JOB = 2 or -2
232 TEMP = Y( K ) - B( K-1 )*Y( K-1 ) - D( K-2 )*Y( K-2 )
233 ELSE IF( K.EQ.2 ) THEN
234 TEMP = Y( K ) - B( K-1 )*Y( K-1 )
240 IF( ABSAK.LT.ONE ) THEN
241 IF( ABSAK.LT.SFMIN ) THEN
242 IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
250 ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
260 TEMP = Y( K ) - B( K-1 )*Y( K-1 ) - D( K-2 )*Y( K-2 )
261 ELSE IF( K.EQ.2 ) THEN
262 TEMP = Y( K ) - B( K-1 )*Y( K-1 )
267 PERT = SIGN( TOL, AK )
270 IF( ABSAK.LT.ONE ) THEN
271 IF( ABSAK.LT.SFMIN ) THEN
272 IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
281 ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
292 IF( IN( K-1 ).EQ.0 ) THEN
293 Y( K-1 ) = Y( K-1 ) - C( K-1 )*Y( K )
297 Y( K ) = TEMP - C( K-1 )*Y( K )