LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dlagtf.f
Go to the documentation of this file.
00001 *> \brief \b DLAGTF
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download DLAGTF + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlagtf.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlagtf.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlagtf.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE DLAGTF( N, A, LAMBDA, B, C, TOL, D, IN, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       INTEGER            INFO, N
00025 *       DOUBLE PRECISION   LAMBDA, TOL
00026 *       ..
00027 *       .. Array Arguments ..
00028 *       INTEGER            IN( * )
00029 *       DOUBLE PRECISION   A( * ), B( * ), C( * ), D( * )
00030 *       ..
00031 *  
00032 *
00033 *> \par Purpose:
00034 *  =============
00035 *>
00036 *> \verbatim
00037 *>
00038 *> DLAGTF factorizes the matrix (T - lambda*I), where T is an n by n
00039 *> tridiagonal matrix and lambda is a scalar, as
00040 *>
00041 *>    T - lambda*I = PLU,
00042 *>
00043 *> where P is a permutation matrix, L is a unit lower tridiagonal matrix
00044 *> with at most one non-zero sub-diagonal elements per column and U is
00045 *> an upper triangular matrix with at most two non-zero super-diagonal
00046 *> elements per column.
00047 *>
00048 *> The factorization is obtained by Gaussian elimination with partial
00049 *> pivoting and implicit row scaling.
00050 *>
00051 *> The parameter LAMBDA is included in the routine so that DLAGTF may
00052 *> be used, in conjunction with DLAGTS, to obtain eigenvectors of T by
00053 *> inverse iteration.
00054 *> \endverbatim
00055 *
00056 *  Arguments:
00057 *  ==========
00058 *
00059 *> \param[in] N
00060 *> \verbatim
00061 *>          N is INTEGER
00062 *>          The order of the matrix T.
00063 *> \endverbatim
00064 *>
00065 *> \param[in,out] A
00066 *> \verbatim
00067 *>          A is DOUBLE PRECISION array, dimension (N)
00068 *>          On entry, A must contain the diagonal elements of T.
00069 *>
00070 *>          On exit, A is overwritten by the n diagonal elements of the
00071 *>          upper triangular matrix U of the factorization of T.
00072 *> \endverbatim
00073 *>
00074 *> \param[in] LAMBDA
00075 *> \verbatim
00076 *>          LAMBDA is DOUBLE PRECISION
00077 *>          On entry, the scalar lambda.
00078 *> \endverbatim
00079 *>
00080 *> \param[in,out] B
00081 *> \verbatim
00082 *>          B is DOUBLE PRECISION array, dimension (N-1)
00083 *>          On entry, B must contain the (n-1) super-diagonal elements of
00084 *>          T.
00085 *>
00086 *>          On exit, B is overwritten by the (n-1) super-diagonal
00087 *>          elements of the matrix U of the factorization of T.
00088 *> \endverbatim
00089 *>
00090 *> \param[in,out] C
00091 *> \verbatim
00092 *>          C is DOUBLE PRECISION array, dimension (N-1)
00093 *>          On entry, C must contain the (n-1) sub-diagonal elements of
00094 *>          T.
00095 *>
00096 *>          On exit, C is overwritten by the (n-1) sub-diagonal elements
00097 *>          of the matrix L of the factorization of T.
00098 *> \endverbatim
00099 *>
00100 *> \param[in] TOL
00101 *> \verbatim
00102 *>          TOL is DOUBLE PRECISION
00103 *>          On entry, a relative tolerance used to indicate whether or
00104 *>          not the matrix (T - lambda*I) is nearly singular. TOL should
00105 *>          normally be chose as approximately the largest relative error
00106 *>          in the elements of T. For example, if the elements of T are
00107 *>          correct to about 4 significant figures, then TOL should be
00108 *>          set to about 5*10**(-4). If TOL is supplied as less than eps,
00109 *>          where eps is the relative machine precision, then the value
00110 *>          eps is used in place of TOL.
00111 *> \endverbatim
00112 *>
00113 *> \param[out] D
00114 *> \verbatim
00115 *>          D is DOUBLE PRECISION array, dimension (N-2)
00116 *>          On exit, D is overwritten by the (n-2) second super-diagonal
00117 *>          elements of the matrix U of the factorization of T.
00118 *> \endverbatim
00119 *>
00120 *> \param[out] IN
00121 *> \verbatim
00122 *>          IN is INTEGER array, dimension (N)
00123 *>          On exit, IN contains details of the permutation matrix P. If
00124 *>          an interchange occurred at the kth step of the elimination,
00125 *>          then IN(k) = 1, otherwise IN(k) = 0. The element IN(n)
00126 *>          returns the smallest positive integer j such that
00127 *>
00128 *>             abs( u(j,j) ).le. norm( (T - lambda*I)(j) )*TOL,
00129 *>
00130 *>          where norm( A(j) ) denotes the sum of the absolute values of
00131 *>          the jth row of the matrix A. If no such j exists then IN(n)
00132 *>          is returned as zero. If IN(n) is returned as positive, then a
00133 *>          diagonal element of U is small, indicating that
00134 *>          (T - lambda*I) is singular or nearly singular,
00135 *> \endverbatim
00136 *>
00137 *> \param[out] INFO
00138 *> \verbatim
00139 *>          INFO is INTEGER
00140 *>          = 0   : successful exit
00141 *>          .lt. 0: if INFO = -k, the kth argument had an illegal value
00142 *> \endverbatim
00143 *
00144 *  Authors:
00145 *  ========
00146 *
00147 *> \author Univ. of Tennessee 
00148 *> \author Univ. of California Berkeley 
00149 *> \author Univ. of Colorado Denver 
00150 *> \author NAG Ltd. 
00151 *
00152 *> \date November 2011
00153 *
00154 *> \ingroup auxOTHERcomputational
00155 *
00156 *  =====================================================================
00157       SUBROUTINE DLAGTF( N, A, LAMBDA, B, C, TOL, D, IN, INFO )
00158 *
00159 *  -- LAPACK computational routine (version 3.4.0) --
00160 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00161 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00162 *     November 2011
00163 *
00164 *     .. Scalar Arguments ..
00165       INTEGER            INFO, N
00166       DOUBLE PRECISION   LAMBDA, TOL
00167 *     ..
00168 *     .. Array Arguments ..
00169       INTEGER            IN( * )
00170       DOUBLE PRECISION   A( * ), B( * ), C( * ), D( * )
00171 *     ..
00172 *
00173 * =====================================================================
00174 *
00175 *     .. Parameters ..
00176       DOUBLE PRECISION   ZERO
00177       PARAMETER          ( ZERO = 0.0D+0 )
00178 *     ..
00179 *     .. Local Scalars ..
00180       INTEGER            K
00181       DOUBLE PRECISION   EPS, MULT, PIV1, PIV2, SCALE1, SCALE2, TEMP, TL
00182 *     ..
00183 *     .. Intrinsic Functions ..
00184       INTRINSIC          ABS, MAX
00185 *     ..
00186 *     .. External Functions ..
00187       DOUBLE PRECISION   DLAMCH
00188       EXTERNAL           DLAMCH
00189 *     ..
00190 *     .. External Subroutines ..
00191       EXTERNAL           XERBLA
00192 *     ..
00193 *     .. Executable Statements ..
00194 *
00195       INFO = 0
00196       IF( N.LT.0 ) THEN
00197          INFO = -1
00198          CALL XERBLA( 'DLAGTF', -INFO )
00199          RETURN
00200       END IF
00201 *
00202       IF( N.EQ.0 )
00203      $   RETURN
00204 *
00205       A( 1 ) = A( 1 ) - LAMBDA
00206       IN( N ) = 0
00207       IF( N.EQ.1 ) THEN
00208          IF( A( 1 ).EQ.ZERO )
00209      $      IN( 1 ) = 1
00210          RETURN
00211       END IF
00212 *
00213       EPS = DLAMCH( 'Epsilon' )
00214 *
00215       TL = MAX( TOL, EPS )
00216       SCALE1 = ABS( A( 1 ) ) + ABS( B( 1 ) )
00217       DO 10 K = 1, N - 1
00218          A( K+1 ) = A( K+1 ) - LAMBDA
00219          SCALE2 = ABS( C( K ) ) + ABS( A( K+1 ) )
00220          IF( K.LT.( N-1 ) )
00221      $      SCALE2 = SCALE2 + ABS( B( K+1 ) )
00222          IF( A( K ).EQ.ZERO ) THEN
00223             PIV1 = ZERO
00224          ELSE
00225             PIV1 = ABS( A( K ) ) / SCALE1
00226          END IF
00227          IF( C( K ).EQ.ZERO ) THEN
00228             IN( K ) = 0
00229             PIV2 = ZERO
00230             SCALE1 = SCALE2
00231             IF( K.LT.( N-1 ) )
00232      $         D( K ) = ZERO
00233          ELSE
00234             PIV2 = ABS( C( K ) ) / SCALE2
00235             IF( PIV2.LE.PIV1 ) THEN
00236                IN( K ) = 0
00237                SCALE1 = SCALE2
00238                C( K ) = C( K ) / A( K )
00239                A( K+1 ) = A( K+1 ) - C( K )*B( K )
00240                IF( K.LT.( N-1 ) )
00241      $            D( K ) = ZERO
00242             ELSE
00243                IN( K ) = 1
00244                MULT = A( K ) / C( K )
00245                A( K ) = C( K )
00246                TEMP = A( K+1 )
00247                A( K+1 ) = B( K ) - MULT*TEMP
00248                IF( K.LT.( N-1 ) ) THEN
00249                   D( K ) = B( K+1 )
00250                   B( K+1 ) = -MULT*D( K )
00251                END IF
00252                B( K ) = TEMP
00253                C( K ) = MULT
00254             END IF
00255          END IF
00256          IF( ( MAX( PIV1, PIV2 ).LE.TL ) .AND. ( IN( N ).EQ.0 ) )
00257      $      IN( N ) = K
00258    10 CONTINUE
00259       IF( ( ABS( A( N ) ).LE.SCALE1*TL ) .AND. ( IN( N ).EQ.0 ) )
00260      $   IN( N ) = N
00261 *
00262       RETURN
00263 *
00264 *     End of DLAGTF
00265 *
00266       END
 All Files Functions