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

◆ zgetf2()

subroutine zgetf2 ( integer m,
integer n,
complex*16, dimension( lda, * ) a,
integer lda,
integer, dimension( * ) ipiv,
integer info )

ZGETF2 computes the LU factorization of a general m-by-n matrix using partial pivoting with row interchanges (unblocked algorithm).

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

Purpose:
!>
!> ZGETF2 computes an LU factorization of a general m-by-n matrix A
!> using partial pivoting with row interchanges.
!>
!> The factorization has the form
!>    A = P * L * U
!> where P is a permutation matrix, L is lower triangular with unit
!> diagonal elements (lower trapezoidal if m > n), and U is upper
!> triangular (upper trapezoidal if m < n).
!>
!> This is the right-looking Level 2 BLAS version of the algorithm.
!> 
Parameters
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix A.  N >= 0.
!> 
[in,out]A
!>          A is COMPLEX*16 array, dimension (LDA,N)
!>          On entry, the m by n matrix to be factored.
!>          On exit, the factors L and U from the factorization
!>          A = P*L*U; the unit diagonal elements of L are not stored.
!> 
[in]LDA
!>          LDA is INTEGER
!>          The leading dimension of the array A.  LDA >= max(1,M).
!> 
[out]IPIV
!>          IPIV is INTEGER array, dimension (min(M,N))
!>          The pivot indices; for 1 <= i <= min(M,N), row i of the
!>          matrix was interchanged with row IPIV(i).
!> 
[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.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 105 of file zgetf2.f.

106*
107* -- LAPACK computational routine --
108* -- LAPACK is a software package provided by Univ. of Tennessee, --
109* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110*
111* .. Scalar Arguments ..
112 INTEGER INFO, LDA, M, N
113* ..
114* .. Array Arguments ..
115 INTEGER IPIV( * )
116 COMPLEX*16 A( LDA, * )
117* ..
118*
119* =====================================================================
120*
121* .. Parameters ..
122 COMPLEX*16 ONE, ZERO
123 parameter( one = ( 1.0d+0, 0.0d+0 ),
124 $ zero = ( 0.0d+0, 0.0d+0 ) )
125* ..
126* .. Local Scalars ..
127 DOUBLE PRECISION SFMIN
128 INTEGER J, JP
129* ..
130* .. External Functions ..
131 DOUBLE PRECISION DLAMCH
132 INTEGER IZAMAX
133 EXTERNAL dlamch, izamax
134* ..
135* .. External Subroutines ..
136 EXTERNAL xerbla, zgeru, zrscl, zswap
137* ..
138* .. Intrinsic Functions ..
139 INTRINSIC max, min
140* ..
141* .. Executable Statements ..
142*
143* Test the input parameters.
144*
145 info = 0
146 IF( m.LT.0 ) THEN
147 info = -1
148 ELSE IF( n.LT.0 ) THEN
149 info = -2
150 ELSE IF( lda.LT.max( 1, m ) ) THEN
151 info = -4
152 END IF
153 IF( info.NE.0 ) THEN
154 CALL xerbla( 'ZGETF2', -info )
155 RETURN
156 END IF
157*
158* Quick return if possible
159*
160 IF( m.EQ.0 .OR. n.EQ.0 )
161 $ RETURN
162*
163* Compute machine safe minimum
164*
165 sfmin = dlamch('S')
166*
167 DO 10 j = 1, min( m, n )
168*
169* Find pivot and test for singularity.
170*
171 jp = j - 1 + izamax( m-j+1, a( j, j ), 1 )
172 ipiv( j ) = jp
173 IF( a( jp, j ).NE.zero ) THEN
174*
175* Apply the interchange to columns 1:N.
176*
177 IF( jp.NE.j )
178 $ CALL zswap( n, a( j, 1 ), lda, a( jp, 1 ), lda )
179*
180* Compute elements J+1:M of J-th column.
181*
182 IF( j.LT.m )
183 $ CALL zrscl( m-j, a( j, j ), a( j+1, j ), 1 )
184*
185 ELSE IF( info.EQ.0 ) THEN
186*
187 info = j
188 END IF
189*
190 IF( j.LT.min( m, n ) ) THEN
191*
192* Update trailing submatrix.
193*
194 CALL zgeru( m-j, n-j, -one, a( j+1, j ), 1, a( j, j+1 ),
195 $ lda, a( j+1, j+1 ), lda )
196 END IF
197 10 CONTINUE
198 RETURN
199*
200* End of ZGETF2
201*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zgeru(m, n, alpha, x, incx, y, incy, a, lda)
ZGERU
Definition zgeru.f:130
integer function izamax(n, zx, incx)
IZAMAX
Definition izamax.f:71
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP
Definition zswap.f:81
subroutine zrscl(n, a, x, incx)
ZDRSCL multiplies a vector by the reciprocal of a real scalar.
Definition zrscl.f:82
Here is the call graph for this function:
Here is the caller graph for this function: