LAPACK  3.5.0
LAPACK: Linear Algebra PACKage
zgetc2.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine zgetc2 (N, A, LDA, IPIV, JPIV, INFO)
 ZGETC2 computes the LU factorization with complete pivoting of the general n-by-n matrix. More...
 

Function/Subroutine Documentation

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.

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

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.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2013
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.5.0) --
115 * -- LAPACK is a software package provided by Univ. of Tennessee, --
116 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
117 * November 2013
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 * Set constants to control overflow
150 *
151  info = 0
152  eps = dlamch( 'P' )
153  smlnum = dlamch( 'S' ) / eps
154  bignum = one / smlnum
155  CALL dlabad( smlnum, bignum )
156 *
157 * Factorize A using complete pivoting.
158 * Set pivots less than SMIN to SMIN
159 *
160  DO 40 i = 1, n - 1
161 *
162 * Find max element in matrix A
163 *
164  xmax = zero
165  DO 20 ip = i, n
166  DO 10 jp = i, n
167  IF( abs( a( ip, jp ) ).GE.xmax ) THEN
168  xmax = abs( a( ip, jp ) )
169  ipv = ip
170  jpv = jp
171  END IF
172  10 CONTINUE
173  20 CONTINUE
174  IF( i.EQ.1 )
175  $ smin = max( eps*xmax, smlnum )
176 *
177 * Swap rows
178 *
179  IF( ipv.NE.i )
180  $ CALL zswap( n, a( ipv, 1 ), lda, a( i, 1 ), lda )
181  ipiv( i ) = ipv
182 *
183 * Swap columns
184 *
185  IF( jpv.NE.i )
186  $ CALL zswap( n, a( 1, jpv ), 1, a( 1, i ), 1 )
187  jpiv( i ) = jpv
188 *
189 * Check for singularity
190 *
191  IF( abs( a( i, i ) ).LT.smin ) THEN
192  info = i
193  a( i, i ) = dcmplx( smin, zero )
194  END IF
195  DO 30 j = i + 1, n
196  a( j, i ) = a( j, i ) / a( i, i )
197  30 CONTINUE
198  CALL zgeru( n-i, n-i, -dcmplx( one ), a( i+1, i ), 1,
199  $ a( i, i+1 ), lda, a( i+1, i+1 ), lda )
200  40 CONTINUE
201 *
202  IF( abs( a( n, n ) ).LT.smin ) THEN
203  info = n
204  a( n, n ) = dcmplx( smin, zero )
205  END IF
206 *
207 * Set last pivots to N
208 *
209  ipiv( n ) = n
210  jpiv( n ) = n
211 *
212  RETURN
213 *
214 * End of ZGETC2
215 *
subroutine zswap(N, ZX, INCX, ZY, INCY)
ZSWAP
Definition: zswap.f:52
subroutine dlabad(SMALL, LARGE)
DLABAD
Definition: dlabad.f:76
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine zgeru(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
ZGERU
Definition: zgeru.f:132

Here is the call graph for this function:

Here is the caller graph for this function: