LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine zgetc2 ( integer N, complex*16, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer, dimension( * ) JPIV, integer INFO )

ZGETC2 computes the LU factorization with complete pivoting of the general n-by-n matrix.

Purpose:
``` ZGETC2 computes an LU factorization, using complete pivoting, of the
n-by-n matrix A. The factorization has the form A = P * L * U * Q,
where P and Q are permutation matrices, L is lower triangular with
unit diagonal elements and U is upper triangular.

This is a level 1 BLAS version of the algorithm.```
Parameters
 [in] N ``` N is INTEGER The order of the matrix A. N >= 0.``` [in,out] A ``` A is COMPLEX*16 array, dimension (LDA, N) On entry, the n-by-n matrix to be factored. On exit, the factors L and U from the factorization A = P*L*U*Q; the unit diagonal elements of L are not stored. If U(k, k) appears to be less than SMIN, U(k, k) is given the value of SMIN, giving a nonsingular perturbed system.``` [in] LDA ``` LDA is INTEGER The leading dimension of the array A. LDA >= max(1, N).``` [out] IPIV ``` IPIV is INTEGER array, dimension (N). The pivot indices; for 1 <= i <= N, row i of the matrix has been interchanged with row IPIV(i).``` [out] JPIV ``` JPIV is INTEGER array, dimension (N). The pivot indices; for 1 <= j <= N, column j of the matrix has been interchanged with column JPIV(j).``` [out] INFO ``` INFO is INTEGER = 0: successful exit > 0: if INFO = k, U(k, k) is likely to produce overflow if one tries to solve for x in Ax = b. So U is perturbed to avoid the overflow.```
Date
June 2016
Contributors:
Bo Kagstrom and Peter Poromaa, Department of Computing Science, Umea University, S-901 87 Umea, Sweden.

Definition at line 113 of file zgetc2.f.

113 *
114 * -- LAPACK auxiliary routine (version 3.6.1) --
115 * -- LAPACK is a software package provided by Univ. of Tennessee, --
116 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
117 * June 2016
118 *
119 * .. Scalar Arguments ..
120  INTEGER info, lda, n
121 * ..
122 * .. Array Arguments ..
123  INTEGER ipiv( * ), jpiv( * )
124  COMPLEX*16 a( lda, * )
125 * ..
126 *
127 * =====================================================================
128 *
129 * .. Parameters ..
130  DOUBLE PRECISION zero, one
131  parameter ( zero = 0.0d+0, one = 1.0d+0 )
132 * ..
133 * .. Local Scalars ..
134  INTEGER i, ip, ipv, j, jp, jpv
135  DOUBLE PRECISION bignum, eps, smin, smlnum, xmax
136 * ..
137 * .. External Subroutines ..
138  EXTERNAL zgeru, zswap
139 * ..
140 * .. External Functions ..
141  DOUBLE PRECISION dlamch
142  EXTERNAL dlamch
143 * ..
144 * .. Intrinsic Functions ..
145  INTRINSIC abs, dcmplx, max
146 * ..
147 * .. Executable Statements ..
148 *
149  info = 0
150 *
151 * Quick return if possible
152 *
153  IF( n.EQ.0 )
154  \$ RETURN
155 *
156 * Set constants to control overflow
157 *
158  eps = dlamch( 'P' )
159  smlnum = dlamch( 'S' ) / eps
160  bignum = one / smlnum
161  CALL dlabad( smlnum, bignum )
162 *
163 * Handle the case N=1 by itself
164 *
165  IF( n.EQ.1 ) THEN
166  ipiv( 1 ) = 1
167  jpiv( 1 ) = 1
168  IF( abs( a( 1, 1 ) ).LT.smlnum ) THEN
169  info = 1
170  a( 1, 1 ) = dcmplx( smlnum, zero )
171  END IF
172  RETURN
173  END IF
174 *
175 * Factorize A using complete pivoting.
176 * Set pivots less than SMIN to SMIN
177 *
178  DO 40 i = 1, n - 1
179 *
180 * Find max element in matrix A
181 *
182  xmax = zero
183  DO 20 ip = i, n
184  DO 10 jp = i, n
185  IF( abs( a( ip, jp ) ).GE.xmax ) THEN
186  xmax = abs( a( ip, jp ) )
187  ipv = ip
188  jpv = jp
189  END IF
190  10 CONTINUE
191  20 CONTINUE
192  IF( i.EQ.1 )
193  \$ smin = max( eps*xmax, smlnum )
194 *
195 * Swap rows
196 *
197  IF( ipv.NE.i )
198  \$ CALL zswap( n, a( ipv, 1 ), lda, a( i, 1 ), lda )
199  ipiv( i ) = ipv
200 *
201 * Swap columns
202 *
203  IF( jpv.NE.i )
204  \$ CALL zswap( n, a( 1, jpv ), 1, a( 1, i ), 1 )
205  jpiv( i ) = jpv
206 *
207 * Check for singularity
208 *
209  IF( abs( a( i, i ) ).LT.smin ) THEN
210  info = i
211  a( i, i ) = dcmplx( smin, zero )
212  END IF
213  DO 30 j = i + 1, n
214  a( j, i ) = a( j, i ) / a( i, i )
215  30 CONTINUE
216  CALL zgeru( n-i, n-i, -dcmplx( one ), a( i+1, i ), 1,
217  \$ a( i, i+1 ), lda, a( i+1, i+1 ), lda )
218  40 CONTINUE
219 *
220  IF( abs( a( n, n ) ).LT.smin ) THEN
221  info = n
222  a( n, n ) = dcmplx( smin, zero )
223  END IF
224 *
225 * Set last pivots to N
226 *
227  ipiv( n ) = n
228  jpiv( n ) = n
229 *
230  RETURN
231 *
232 * End of ZGETC2
233 *
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine zswap(N, ZX, INCX, ZY, INCY)
ZSWAP
Definition: zswap.f:52