LAPACK 3.12.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ spttrf()

subroutine spttrf ( integer  n,
real, dimension( * )  d,
real, dimension( * )  e,
integer  info 
)

SPTTRF

Download SPTTRF + dependencies [TGZ] [ZIP] [TXT]

Purpose:
 SPTTRF computes the L*D*L**T factorization of a real symmetric
 positive definite tridiagonal matrix A.  The factorization may also
 be regarded as having the form A = U**T*D*U.
Parameters
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]D
          D is REAL array, dimension (N)
          On entry, the n diagonal elements of the tridiagonal matrix
          A.  On exit, the n diagonal elements of the diagonal matrix
          D from the L*D*L**T factorization of A.
[in,out]E
          E is REAL array, dimension (N-1)
          On entry, the (n-1) subdiagonal elements of the tridiagonal
          matrix A.  On exit, the (n-1) subdiagonal elements of the
          unit bidiagonal factor L from the L*D*L**T factorization of A.
          E can also be regarded as the superdiagonal of the unit
          bidiagonal factor U from the U**T*D*U factorization of A.
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -k, the k-th argument had an illegal value
          > 0: if INFO = k, the leading principal minor of order k
               is not positive; if k < N, the factorization could not
               be completed, while if k = N, the factorization was
               completed, but D(N) <= 0.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 90 of file spttrf.f.

91*
92* -- LAPACK computational routine --
93* -- LAPACK is a software package provided by Univ. of Tennessee, --
94* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
95*
96* .. Scalar Arguments ..
97 INTEGER INFO, N
98* ..
99* .. Array Arguments ..
100 REAL D( * ), E( * )
101* ..
102*
103* =====================================================================
104*
105* .. Parameters ..
106 REAL ZERO
107 parameter( zero = 0.0e+0 )
108* ..
109* .. Local Scalars ..
110 INTEGER I, I4
111 REAL EI
112* ..
113* .. External Subroutines ..
114 EXTERNAL xerbla
115* ..
116* .. Intrinsic Functions ..
117 INTRINSIC mod
118* ..
119* .. Executable Statements ..
120*
121* Test the input parameters.
122*
123 info = 0
124 IF( n.LT.0 ) THEN
125 info = -1
126 CALL xerbla( 'SPTTRF', -info )
127 RETURN
128 END IF
129*
130* Quick return if possible
131*
132 IF( n.EQ.0 )
133 $ RETURN
134*
135* Compute the L*D*L**T (or U**T*D*U) factorization of A.
136*
137 i4 = mod( n-1, 4 )
138 DO 10 i = 1, i4
139 IF( d( i ).LE.zero ) THEN
140 info = i
141 GO TO 30
142 END IF
143 ei = e( i )
144 e( i ) = ei / d( i )
145 d( i+1 ) = d( i+1 ) - e( i )*ei
146 10 CONTINUE
147*
148 DO 20 i = i4 + 1, n - 4, 4
149*
150* Drop out of the loop if d(i) <= 0: the matrix is not positive
151* definite.
152*
153 IF( d( i ).LE.zero ) THEN
154 info = i
155 GO TO 30
156 END IF
157*
158* Solve for e(i) and d(i+1).
159*
160 ei = e( i )
161 e( i ) = ei / d( i )
162 d( i+1 ) = d( i+1 ) - e( i )*ei
163*
164 IF( d( i+1 ).LE.zero ) THEN
165 info = i + 1
166 GO TO 30
167 END IF
168*
169* Solve for e(i+1) and d(i+2).
170*
171 ei = e( i+1 )
172 e( i+1 ) = ei / d( i+1 )
173 d( i+2 ) = d( i+2 ) - e( i+1 )*ei
174*
175 IF( d( i+2 ).LE.zero ) THEN
176 info = i + 2
177 GO TO 30
178 END IF
179*
180* Solve for e(i+2) and d(i+3).
181*
182 ei = e( i+2 )
183 e( i+2 ) = ei / d( i+2 )
184 d( i+3 ) = d( i+3 ) - e( i+2 )*ei
185*
186 IF( d( i+3 ).LE.zero ) THEN
187 info = i + 3
188 GO TO 30
189 END IF
190*
191* Solve for e(i+3) and d(i+4).
192*
193 ei = e( i+3 )
194 e( i+3 ) = ei / d( i+3 )
195 d( i+4 ) = d( i+4 ) - e( i+3 )*ei
196 20 CONTINUE
197*
198* Check d(n) for positive definiteness.
199*
200 IF( d( n ).LE.zero )
201 $ info = n
202*
203 30 CONTINUE
204 RETURN
205*
206* End of SPTTRF
207*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
Here is the call graph for this function:
Here is the caller graph for this function: