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

## ◆ cgttrf()

 subroutine cgttrf ( integer N, complex, dimension( * ) DL, complex, dimension( * ) D, complex, dimension( * ) DU, complex, dimension( * ) DU2, integer, dimension( * ) IPIV, integer INFO )

CGTTRF

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

Purpose:
CGTTRF computes an LU factorization of a complex tridiagonal matrix A
using elimination with partial pivoting and row interchanges.

The factorization has the form
A = L * U
where L is a product of permutation and unit lower bidiagonal
matrices and U is upper triangular with nonzeros in only the main
diagonal and first two superdiagonals.
Parameters
 [in] N N is INTEGER The order of the matrix A. [in,out] DL DL is COMPLEX array, dimension (N-1) On entry, DL must contain the (n-1) sub-diagonal elements of A. On exit, DL is overwritten by the (n-1) multipliers that define the matrix L from the LU factorization of A. [in,out] D D is COMPLEX array, dimension (N) On entry, D must contain the diagonal elements of A. On exit, D is overwritten by the n diagonal elements of the upper triangular matrix U from the LU factorization of A. [in,out] DU DU is COMPLEX array, dimension (N-1) On entry, DU must contain the (n-1) super-diagonal elements of A. On exit, DU is overwritten by the (n-1) elements of the first super-diagonal of U. [out] DU2 DU2 is COMPLEX array, dimension (N-2) On exit, DU2 is overwritten by the (n-2) elements of the second super-diagonal of U. [out] IPIV IPIV is INTEGER array, dimension (N) The pivot indices; for 1 <= i <= n, row i of the matrix was interchanged with row IPIV(i). IPIV(i) will always be either i or i+1; IPIV(i) = i indicates a row interchange was not required. [out] INFO INFO is INTEGER = 0: successful exit < 0: if INFO = -k, the k-th argument had an illegal value > 0: if INFO = k, U(k,k) is exactly zero. The factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations.

Definition at line 123 of file cgttrf.f.

124*
125* -- LAPACK computational routine --
126* -- LAPACK is a software package provided by Univ. of Tennessee, --
127* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128*
129* .. Scalar Arguments ..
130 INTEGER INFO, N
131* ..
132* .. Array Arguments ..
133 INTEGER IPIV( * )
134 COMPLEX D( * ), DL( * ), DU( * ), DU2( * )
135* ..
136*
137* =====================================================================
138*
139* .. Parameters ..
140 REAL ZERO
141 parameter( zero = 0.0e+0 )
142* ..
143* .. Local Scalars ..
144 INTEGER I
145 COMPLEX FACT, TEMP, ZDUM
146* ..
147* .. External Subroutines ..
148 EXTERNAL xerbla
149* ..
150* .. Intrinsic Functions ..
151 INTRINSIC abs, aimag, real
152* ..
153* .. Statement Functions ..
154 REAL CABS1
155* ..
156* .. Statement Function definitions ..
157 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
158* ..
159* .. Executable Statements ..
160*
161 info = 0
162 IF( n.LT.0 ) THEN
163 info = -1
164 CALL xerbla( 'CGTTRF', -info )
165 RETURN
166 END IF
167*
168* Quick return if possible
169*
170 IF( n.EQ.0 )
171 \$ RETURN
172*
173* Initialize IPIV(i) = i and DU2(i) = 0
174*
175 DO 10 i = 1, n
176 ipiv( i ) = i
177 10 CONTINUE
178 DO 20 i = 1, n - 2
179 du2( i ) = zero
180 20 CONTINUE
181*
182 DO 30 i = 1, n - 2
183 IF( cabs1( d( i ) ).GE.cabs1( dl( i ) ) ) THEN
184*
185* No row interchange required, eliminate DL(I)
186*
187 IF( cabs1( d( i ) ).NE.zero ) THEN
188 fact = dl( i ) / d( i )
189 dl( i ) = fact
190 d( i+1 ) = d( i+1 ) - fact*du( i )
191 END IF
192 ELSE
193*
194* Interchange rows I and I+1, eliminate DL(I)
195*
196 fact = d( i ) / dl( i )
197 d( i ) = dl( i )
198 dl( i ) = fact
199 temp = du( i )
200 du( i ) = d( i+1 )
201 d( i+1 ) = temp - fact*d( i+1 )
202 du2( i ) = du( i+1 )
203 du( i+1 ) = -fact*du( i+1 )
204 ipiv( i ) = i + 1
205 END IF
206 30 CONTINUE
207 IF( n.GT.1 ) THEN
208 i = n - 1
209 IF( cabs1( d( i ) ).GE.cabs1( dl( i ) ) ) THEN
210 IF( cabs1( d( i ) ).NE.zero ) THEN
211 fact = dl( i ) / d( i )
212 dl( i ) = fact
213 d( i+1 ) = d( i+1 ) - fact*du( i )
214 END IF
215 ELSE
216 fact = d( i ) / dl( i )
217 d( i ) = dl( i )
218 dl( i ) = fact
219 temp = du( i )
220 du( i ) = d( i+1 )
221 d( i+1 ) = temp - fact*d( i+1 )
222 ipiv( i ) = i + 1
223 END IF
224 END IF
225*
226* Check for a zero on the diagonal of U.
227*
228 DO 40 i = 1, n
229 IF( cabs1( d( i ) ).EQ.zero ) THEN
230 info = i
231 GO TO 50
232 END IF
233 40 CONTINUE
234 50 CONTINUE
235*
236 RETURN
237*
238* End of CGTTRF
239*
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
Here is the call graph for this function:
Here is the caller graph for this function: