LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
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.
Date
September 2012

Definition at line 110 of file dgetf2.f.

110 *
111 * -- LAPACK computational routine (version 3.4.2) --
112 * -- LAPACK is a software package provided by Univ. of Tennessee, --
113 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
114 * September 2012
115 *
116 * .. Scalar Arguments ..
117  INTEGER info, lda, m, n
118 * ..
119 * .. Array Arguments ..
120  INTEGER ipiv( * )
121  DOUBLE PRECISION a( lda, * )
122 * ..
123 *
124 * =====================================================================
125 *
126 * .. Parameters ..
127  DOUBLE PRECISION one, zero
128  parameter ( one = 1.0d+0, zero = 0.0d+0 )
129 * ..
130 * .. Local Scalars ..
131  DOUBLE PRECISION sfmin
132  INTEGER i, j, jp
133 * ..
134 * .. External Functions ..
135  DOUBLE PRECISION dlamch
136  INTEGER idamax
137  EXTERNAL dlamch, idamax
138 * ..
139 * .. External Subroutines ..
140  EXTERNAL dger, dscal, dswap, xerbla
141 * ..
142 * .. Intrinsic Functions ..
143  INTRINSIC max, min
144 * ..
145 * .. Executable Statements ..
146 *
147 * Test the input parameters.
148 *
149  info = 0
150  IF( m.LT.0 ) THEN
151  info = -1
152  ELSE IF( n.LT.0 ) THEN
153  info = -2
154  ELSE IF( lda.LT.max( 1, m ) ) THEN
155  info = -4
156  END IF
157  IF( info.NE.0 ) THEN
158  CALL xerbla( 'DGETF2', -info )
159  RETURN
160  END IF
161 *
162 * Quick return if possible
163 *
164  IF( m.EQ.0 .OR. n.EQ.0 )
165  $ RETURN
166 *
167 * Compute machine safe minimum
168 *
169  sfmin = dlamch('S')
170 *
171  DO 10 j = 1, min( m, n )
172 *
173 * Find pivot and test for singularity.
174 *
175  jp = j - 1 + idamax( m-j+1, a( j, j ), 1 )
176  ipiv( j ) = jp
177  IF( a( jp, j ).NE.zero ) THEN
178 *
179 * Apply the interchange to columns 1:N.
180 *
181  IF( jp.NE.j )
182  $ CALL dswap( n, a( j, 1 ), lda, a( jp, 1 ), lda )
183 *
184 * Compute elements J+1:M of J-th column.
185 *
186  IF( j.LT.m ) THEN
187  IF( abs(a( j, j )) .GE. sfmin ) THEN
188  CALL dscal( m-j, one / a( j, j ), a( j+1, j ), 1 )
189  ELSE
190  DO 20 i = 1, m-j
191  a( j+i, j ) = a( j+i, j ) / a( j, j )
192  20 CONTINUE
193  END IF
194  END IF
195 *
196  ELSE IF( info.EQ.0 ) THEN
197 *
198  info = j
199  END IF
200 *
201  IF( j.LT.min( m, n ) ) THEN
202 *
203 * Update trailing submatrix.
204 *
205  CALL dger( m-j, n-j, -one, a( j+1, j ), 1, a( j, j+1 ), lda,
206  $ a( j+1, j+1 ), lda )
207  END IF
208  10 CONTINUE
209  RETURN
210 *
211 * End of DGETF2
212 *
integer function idamax(N, DX, INCX)
IDAMAX
Definition: idamax.f:53
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine dswap(N, DX, INCX, DY, INCY)
DSWAP
Definition: dswap.f:53
subroutine dger(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
DGER
Definition: dger.f:132
subroutine dscal(N, DA, DX, INCX)
DSCAL
Definition: dscal.f:55

Here is the call graph for this function:

Here is the caller graph for this function: