1 *> \brief \b SLAGTS 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.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download SLAGTS + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slagts.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slagts.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slagts.f">
21 * SUBROUTINE SLAGTS( JOB, N, A, B, C, D, IN, Y, TOL, INFO )
23 * .. Scalar Arguments ..
24 * INTEGER INFO, JOB, N
27 * .. Array Arguments ..
29 * REAL A( * ), B( * ), C( * ), D( * ), Y( * )
38 *> SLAGTS may be used to solve one of the systems of equations
40 *> (T - lambda*I)*x = y or (T - lambda*I)**T*x = y,
42 *> where T is an n by n tridiagonal matrix, for x, following the
43 *> factorization of (T - lambda*I) as
45 *> (T - lambda*I) = P*L*U ,
47 *> by routine SLAGTF. 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.
59 *> Specifies the job to be performed by SLAGTS 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
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
77 *> The order of the matrix T.
82 *> A is REAL array, dimension (N)
83 *> On entry, A must contain the diagonal elements of U as
84 *> returned from SLAGTF.
89 *> B is REAL array, dimension (N-1)
90 *> On entry, B must contain the first super-diagonal elements of
91 *> U as returned from SLAGTF.
96 *> C is REAL array, dimension (N-1)
97 *> On entry, C must contain the sub-diagonal elements of L as
98 *> returned from SLAGTF.
103 *> D is REAL array, dimension (N-2)
104 *> On entry, D must contain the second super-diagonal elements
105 *> of U as returned from SLAGTF.
110 *> IN is INTEGER array, dimension (N)
111 *> On entry, IN must contain details of the matrix P as returned
117 *> Y is REAL array, dimension (N)
118 *> On entry, the right hand side vector y.
119 *> On exit, Y is overwritten by the solution vector x.
122 *> \param[in,out] TOL
125 *> On entry, with JOB .lt. 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 .gt. 0 then TOL is not referenced.
132 *> On exit, TOL is changed as described above, only if TOL is
133 *> non-positive on entry. Otherwise TOL is unchanged.
139 *> = 0 : successful exit
140 *> .lt. 0: if INFO = -i, the i-th argument had an illegal value
141 *> .gt. 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
152 *> \author Univ. of Tennessee
153 *> \author Univ. of California Berkeley
154 *> \author Univ. of Colorado Denver
157 *> \date September 2012
159 *> \ingroup auxOTHERauxiliary
161 * =====================================================================
162 SUBROUTINE SLAGTS( JOB, N, A, B, C, D, IN, Y, TOL, INFO )
164 * -- LAPACK auxiliary routine (version 3.4.2) --
165 * -- LAPACK is a software package provided by Univ. of Tennessee, --
166 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
169 * .. Scalar Arguments ..
173 * .. Array Arguments ..
175 REAL A( * ), B( * ), C( * ), D( * ), Y( * )
178 * =====================================================================
182 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
184 * .. Local Scalars ..
186 REAL ABSAK, AK, BIGNUM, EPS, PERT, SFMIN, TEMP
188 * .. Intrinsic Functions ..
189 INTRINSIC ABS, MAX, SIGN
191 * .. External Functions ..
195 * .. External Subroutines ..
198 * .. Executable Statements ..
201 IF( ( ABS( JOB ).GT.2 ) .OR. ( JOB.EQ.0 ) ) THEN
203 ELSE IF( N.LT.0 ) THEN
207 CALL XERBLA( 'SLAGTS', -INFO )
214 EPS = SLAMCH( 'Epsilon' )
215 SFMIN = SLAMCH( 'Safe minimum' )
219 IF( TOL.LE.ZERO ) THEN
222 $ TOL = MAX( TOL, ABS( A( 2 ) ), ABS( B( 1 ) ) )
224 TOL = MAX( TOL, ABS( A( K ) ), ABS( B( K-1 ) ),
233 IF( ABS( JOB ).EQ.1 ) THEN
235 IF( IN( K-1 ).EQ.0 ) THEN
236 Y( K ) = Y( K ) - C( K-1 )*Y( K-1 )
240 Y( K ) = TEMP - C( K-1 )*Y( K )
246 TEMP = Y( K ) - B( K )*Y( K+1 ) - D( K )*Y( K+2 )
247 ELSE IF( K.EQ.N-1 ) THEN
248 TEMP = Y( K ) - B( K )*Y( K+1 )
254 IF( ABSAK.LT.ONE ) THEN
255 IF( ABSAK.LT.SFMIN ) THEN
256 IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
264 ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
274 TEMP = Y( K ) - B( K )*Y( K+1 ) - D( K )*Y( K+2 )
275 ELSE IF( K.EQ.N-1 ) THEN
276 TEMP = Y( K ) - B( K )*Y( K+1 )
281 PERT = SIGN( TOL, AK )
284 IF( ABSAK.LT.ONE ) THEN
285 IF( ABSAK.LT.SFMIN ) THEN
286 IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
295 ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
306 * Come to here if JOB = 2 or -2
311 TEMP = Y( K ) - B( K-1 )*Y( K-1 ) - D( K-2 )*Y( K-2 )
312 ELSE IF( K.EQ.2 ) THEN
313 TEMP = Y( K ) - B( K-1 )*Y( K-1 )
319 IF( ABSAK.LT.ONE ) THEN
320 IF( ABSAK.LT.SFMIN ) THEN
321 IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
329 ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
339 TEMP = Y( K ) - B( K-1 )*Y( K-1 ) - D( K-2 )*Y( K-2 )
340 ELSE IF( K.EQ.2 ) THEN
341 TEMP = Y( K ) - B( K-1 )*Y( K-1 )
346 PERT = SIGN( TOL, AK )
349 IF( ABSAK.LT.ONE ) THEN
350 IF( ABSAK.LT.SFMIN ) THEN
351 IF( ABSAK.EQ.ZERO .OR. ABS( TEMP )*SFMIN.GT.ABSAK )
360 ELSE IF( ABS( TEMP ).GT.ABSAK*BIGNUM ) THEN
371 IF( IN( K-1 ).EQ.0 ) THEN
372 Y( K-1 ) = Y( K-1 ) - C( K-1 )*Y( K )
376 Y( K ) = TEMP - C( K-1 )*Y( K )