LAPACK  3.10.1
LAPACK: Linear Algebra PACKage

◆ 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 107 of file dgetf2.f.

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