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

◆ dgetf2()

subroutine dgetf2 ( integer m,
integer n,
double precision, dimension( lda, * ) a,
integer lda,
integer, dimension( * ) ipiv,
integer info )

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

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

Purpose:
!>
!> DGETF2 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 DOUBLE PRECISION 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 dgetf2.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 DOUBLE PRECISION A( LDA, * )
117* ..
118*
119* =====================================================================
120*
121* .. Parameters ..
122 DOUBLE PRECISION ONE, ZERO
123 parameter( one = 1.0d+0, zero = 0.0d+0 )
124* ..
125* .. Local Scalars ..
126 DOUBLE PRECISION SFMIN
127 INTEGER I, J, JP
128* ..
129* .. External Functions ..
130 DOUBLE PRECISION DLAMCH
131 INTEGER IDAMAX
132 EXTERNAL dlamch, idamax
133* ..
134* .. External Subroutines ..
135 EXTERNAL dger, dscal, dswap, xerbla
136* ..
137* .. Intrinsic Functions ..
138 INTRINSIC max, min
139* ..
140* .. Executable Statements ..
141*
142* Test the input parameters.
143*
144 info = 0
145 IF( m.LT.0 ) THEN
146 info = -1
147 ELSE IF( n.LT.0 ) THEN
148 info = -2
149 ELSE IF( lda.LT.max( 1, m ) ) THEN
150 info = -4
151 END IF
152 IF( info.NE.0 ) THEN
153 CALL xerbla( 'DGETF2', -info )
154 RETURN
155 END IF
156*
157* Quick return if possible
158*
159 IF( m.EQ.0 .OR. n.EQ.0 )
160 $ RETURN
161*
162* Compute machine safe minimum
163*
164 sfmin = dlamch('S')
165*
166 DO 10 j = 1, min( m, n )
167*
168* Find pivot and test for singularity.
169*
170 jp = j - 1 + idamax( m-j+1, a( j, j ), 1 )
171 ipiv( j ) = jp
172 IF( a( jp, j ).NE.zero ) THEN
173*
174* Apply the interchange to columns 1:N.
175*
176 IF( jp.NE.j )
177 $ CALL dswap( n, a( j, 1 ), lda, a( jp, 1 ), lda )
178*
179* Compute elements J+1:M of J-th column.
180*
181 IF( j.LT.m ) THEN
182 IF( abs(a( j, j )) .GE. sfmin ) THEN
183 CALL dscal( m-j, one / a( j, j ), a( j+1, j ), 1 )
184 ELSE
185 DO 20 i = 1, m-j
186 a( j+i, j ) = a( j+i, j ) / a( j, j )
187 20 CONTINUE
188 END IF
189 END IF
190*
191 ELSE IF( info.EQ.0 ) THEN
192*
193 info = j
194 END IF
195*
196 IF( j.LT.min( m, n ) ) THEN
197*
198* Update trailing submatrix.
199*
200 CALL dger( m-j, n-j, -one, a( j+1, j ), 1, a( j, j+1 ),
201 $ lda,
202 $ a( j+1, j+1 ), lda )
203 END IF
204 10 CONTINUE
205 RETURN
206*
207* End of DGETF2
208*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dger(m, n, alpha, x, incx, y, incy, a, lda)
DGER
Definition dger.f:130
integer function idamax(n, dx, incx)
IDAMAX
Definition idamax.f:71
double precision function dlamch(cmach)
DLAMCH
Definition dlamch.f:69
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
subroutine dswap(n, dx, incx, dy, incy)
DSWAP
Definition dswap.f:82
Here is the call graph for this function:
Here is the caller graph for this function: