3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZGTTRF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgttrf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgttrf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgttrf.f">
21 * SUBROUTINE ZGTTRF( N, DL, D, DU, DU2, IPIV, INFO )
23 * .. Scalar Arguments ..
26 * .. Array Arguments ..
28 * COMPLEX*16 D( * ), DL( * ), DU( * ), DU2( * )
37 *> ZGTTRF computes an LU factorization of a complex tridiagonal matrix A
38 *> using elimination with partial pivoting and row interchanges.
40 *> The factorization has the form
42 *> where L is a product of permutation and unit lower bidiagonal
43 *> matrices and U is upper triangular with nonzeros in only the main
44 *> diagonal and first two superdiagonals.
53 *> The order of the matrix A.
58 *> DL is COMPLEX*16 array, dimension (N-1)
59 *> On entry, DL must contain the (n-1) sub-diagonal elements of
62 *> On exit, DL is overwritten by the (n-1) multipliers that
63 *> define the matrix L from the LU factorization of A.
68 *> D is COMPLEX*16 array, dimension (N)
69 *> On entry, D must contain the diagonal elements of A.
71 *> On exit, D is overwritten by the n diagonal elements of the
72 *> upper triangular matrix U from the LU factorization of A.
77 *> DU is COMPLEX*16 array, dimension (N-1)
78 *> On entry, DU must contain the (n-1) super-diagonal elements
81 *> On exit, DU is overwritten by the (n-1) elements of the first
82 *> super-diagonal of U.
87 *> DU2 is COMPLEX*16 array, dimension (N-2)
88 *> On exit, DU2 is overwritten by the (n-2) elements of the
89 *> second super-diagonal of U.
94 *> IPIV is INTEGER array, dimension (N)
95 *> The pivot indices; for 1 <= i <= n, row i of the matrix was
96 *> interchanged with row IPIV(i). IPIV(i) will always be either
97 *> i or i+1; IPIV(i) = i indicates a row interchange was not
104 *> = 0: successful exit
105 *> < 0: if INFO = -k, the k-th argument had an illegal value
106 *> > 0: if INFO = k, U(k,k) is exactly zero. The factorization
107 *> has been completed, but the factor U is exactly
108 *> singular, and division by zero will occur if it is used
109 *> to solve a system of equations.
115 *> \author Univ. of Tennessee
116 *> \author Univ. of California Berkeley
117 *> \author Univ. of Colorado Denver
120 *> \date September 2012
122 *> \ingroup complex16GTcomputational
124 * =====================================================================
125 SUBROUTINE ZGTTRF( N, DL, D, DU, DU2, IPIV, INFO )
127 * -- LAPACK computational routine (version 3.4.2) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * .. Scalar Arguments ..
135 * .. Array Arguments ..
137 COMPLEX*16 D( * ), DL( * ), DU( * ), DU2( * )
140 * =====================================================================
143 DOUBLE PRECISION ZERO
144 PARAMETER ( ZERO = 0.0D+0 )
146 * .. Local Scalars ..
148 COMPLEX*16 FACT, TEMP, ZDUM
150 * .. External Subroutines ..
153 * .. Intrinsic Functions ..
154 INTRINSIC ABS, DBLE, DIMAG
156 * .. Statement Functions ..
157 DOUBLE PRECISION CABS1
159 * .. Statement Function definitions ..
160 CABS1( ZDUM ) = ABS( DBLE( ZDUM ) ) + ABS( DIMAG( ZDUM ) )
162 * .. Executable Statements ..
167 CALL XERBLA( 'ZGTTRF', -INFO )
171 * Quick return if possible
176 * Initialize IPIV(i) = i and DU2(i) = 0
186 IF( CABS1( D( I ) ).GE.CABS1( DL( I ) ) ) THEN
188 * No row interchange required, eliminate DL(I)
190 IF( CABS1( D( I ) ).NE.ZERO ) THEN
191 FACT = DL( I ) / D( I )
193 D( I+1 ) = D( I+1 ) - FACT*DU( I )
197 * Interchange rows I and I+1, eliminate DL(I)
199 FACT = D( I ) / DL( I )
204 D( I+1 ) = TEMP - FACT*D( I+1 )
206 DU( I+1 ) = -FACT*DU( I+1 )
212 IF( CABS1( D( I ) ).GE.CABS1( DL( I ) ) ) THEN
213 IF( CABS1( D( I ) ).NE.ZERO ) THEN
214 FACT = DL( I ) / D( I )
216 D( I+1 ) = D( I+1 ) - FACT*DU( I )
219 FACT = D( I ) / DL( I )
224 D( I+1 ) = TEMP - FACT*D( I+1 )
229 * Check for a zero on the diagonal of U.
232 IF( CABS1( D( I ) ).EQ.ZERO ) THEN