LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
spttrf.f
Go to the documentation of this file.
00001 *> \brief \b SPTTRF
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *> \htmlonly
00009 *> Download SPTTRF + dependencies 
00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/spttrf.f"> 
00011 *> [TGZ]</a> 
00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/spttrf.f"> 
00013 *> [ZIP]</a> 
00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/spttrf.f"> 
00015 *> [TXT]</a>
00016 *> \endhtmlonly 
00017 *
00018 *  Definition:
00019 *  ===========
00020 *
00021 *       SUBROUTINE SPTTRF( N, D, E, INFO )
00022 * 
00023 *       .. Scalar Arguments ..
00024 *       INTEGER            INFO, N
00025 *       ..
00026 *       .. Array Arguments ..
00027 *       REAL               D( * ), E( * )
00028 *       ..
00029 *  
00030 *
00031 *> \par Purpose:
00032 *  =============
00033 *>
00034 *> \verbatim
00035 *>
00036 *> SPTTRF computes the L*D*L**T factorization of a real symmetric
00037 *> positive definite tridiagonal matrix A.  The factorization may also
00038 *> be regarded as having the form A = U**T*D*U.
00039 *> \endverbatim
00040 *
00041 *  Arguments:
00042 *  ==========
00043 *
00044 *> \param[in] N
00045 *> \verbatim
00046 *>          N is INTEGER
00047 *>          The order of the matrix A.  N >= 0.
00048 *> \endverbatim
00049 *>
00050 *> \param[in,out] D
00051 *> \verbatim
00052 *>          D is REAL array, dimension (N)
00053 *>          On entry, the n diagonal elements of the tridiagonal matrix
00054 *>          A.  On exit, the n diagonal elements of the diagonal matrix
00055 *>          D from the L*D*L**T factorization of A.
00056 *> \endverbatim
00057 *>
00058 *> \param[in,out] E
00059 *> \verbatim
00060 *>          E is REAL array, dimension (N-1)
00061 *>          On entry, the (n-1) subdiagonal elements of the tridiagonal
00062 *>          matrix A.  On exit, the (n-1) subdiagonal elements of the
00063 *>          unit bidiagonal factor L from the L*D*L**T factorization of A.
00064 *>          E can also be regarded as the superdiagonal of the unit
00065 *>          bidiagonal factor U from the U**T*D*U factorization of A.
00066 *> \endverbatim
00067 *>
00068 *> \param[out] INFO
00069 *> \verbatim
00070 *>          INFO is INTEGER
00071 *>          = 0: successful exit
00072 *>          < 0: if INFO = -k, the k-th argument had an illegal value
00073 *>          > 0: if INFO = k, the leading minor of order k is not
00074 *>               positive definite; if k < N, the factorization could not
00075 *>               be completed, while if k = N, the factorization was
00076 *>               completed, but D(N) <= 0.
00077 *> \endverbatim
00078 *
00079 *  Authors:
00080 *  ========
00081 *
00082 *> \author Univ. of Tennessee 
00083 *> \author Univ. of California Berkeley 
00084 *> \author Univ. of Colorado Denver 
00085 *> \author NAG Ltd. 
00086 *
00087 *> \date November 2011
00088 *
00089 *> \ingroup auxOTHERcomputational
00090 *
00091 *  =====================================================================
00092       SUBROUTINE SPTTRF( N, D, E, INFO )
00093 *
00094 *  -- LAPACK computational routine (version 3.4.0) --
00095 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00096 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00097 *     November 2011
00098 *
00099 *     .. Scalar Arguments ..
00100       INTEGER            INFO, N
00101 *     ..
00102 *     .. Array Arguments ..
00103       REAL               D( * ), E( * )
00104 *     ..
00105 *
00106 *  =====================================================================
00107 *
00108 *     .. Parameters ..
00109       REAL               ZERO
00110       PARAMETER          ( ZERO = 0.0E+0 )
00111 *     ..
00112 *     .. Local Scalars ..
00113       INTEGER            I, I4
00114       REAL               EI
00115 *     ..
00116 *     .. External Subroutines ..
00117       EXTERNAL           XERBLA
00118 *     ..
00119 *     .. Intrinsic Functions ..
00120       INTRINSIC          MOD
00121 *     ..
00122 *     .. Executable Statements ..
00123 *
00124 *     Test the input parameters.
00125 *
00126       INFO = 0
00127       IF( N.LT.0 ) THEN
00128          INFO = -1
00129          CALL XERBLA( 'SPTTRF', -INFO )
00130          RETURN
00131       END IF
00132 *
00133 *     Quick return if possible
00134 *
00135       IF( N.EQ.0 )
00136      $   RETURN
00137 *
00138 *     Compute the L*D*L**T (or U**T*D*U) factorization of A.
00139 *
00140       I4 = MOD( N-1, 4 )
00141       DO 10 I = 1, I4
00142          IF( D( I ).LE.ZERO ) THEN
00143             INFO = I
00144             GO TO 30
00145          END IF
00146          EI = E( I )
00147          E( I ) = EI / D( I )
00148          D( I+1 ) = D( I+1 ) - E( I )*EI
00149    10 CONTINUE
00150 *
00151       DO 20 I = I4 + 1, N - 4, 4
00152 *
00153 *        Drop out of the loop if d(i) <= 0: the matrix is not positive
00154 *        definite.
00155 *
00156          IF( D( I ).LE.ZERO ) THEN
00157             INFO = I
00158             GO TO 30
00159          END IF
00160 *
00161 *        Solve for e(i) and d(i+1).
00162 *
00163          EI = E( I )
00164          E( I ) = EI / D( I )
00165          D( I+1 ) = D( I+1 ) - E( I )*EI
00166 *
00167          IF( D( I+1 ).LE.ZERO ) THEN
00168             INFO = I + 1
00169             GO TO 30
00170          END IF
00171 *
00172 *        Solve for e(i+1) and d(i+2).
00173 *
00174          EI = E( I+1 )
00175          E( I+1 ) = EI / D( I+1 )
00176          D( I+2 ) = D( I+2 ) - E( I+1 )*EI
00177 *
00178          IF( D( I+2 ).LE.ZERO ) THEN
00179             INFO = I + 2
00180             GO TO 30
00181          END IF
00182 *
00183 *        Solve for e(i+2) and d(i+3).
00184 *
00185          EI = E( I+2 )
00186          E( I+2 ) = EI / D( I+2 )
00187          D( I+3 ) = D( I+3 ) - E( I+2 )*EI
00188 *
00189          IF( D( I+3 ).LE.ZERO ) THEN
00190             INFO = I + 3
00191             GO TO 30
00192          END IF
00193 *
00194 *        Solve for e(i+3) and d(i+4).
00195 *
00196          EI = E( I+3 )
00197          E( I+3 ) = EI / D( I+3 )
00198          D( I+4 ) = D( I+4 ) - E( I+3 )*EI
00199    20 CONTINUE
00200 *
00201 *     Check d(n) for positive definiteness.
00202 *
00203       IF( D( N ).LE.ZERO )
00204      $   INFO = N
00205 *
00206    30 CONTINUE
00207       RETURN
00208 *
00209 *     End of SPTTRF
00210 *
00211       END
 All Files Functions