1: *> \brief \b DGETF2 computes the LU factorization of a general m-by-n matrix using partial pivoting with row interchanges (unblocked algorithm).
2: *
3: * =========== DOCUMENTATION ===========
4: *
5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
7: *
8: *> \htmlonly
9: *> Download DGETF2 + dependencies
10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dgetf2.f">
11: *> [TGZ]</a>
12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dgetf2.f">
13: *> [ZIP]</a>
14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dgetf2.f">
15: *> [TXT]</a>
16: *> \endhtmlonly
17: *
18: * Definition:
19: * ===========
20: *
21: * SUBROUTINE DGETF2( M, N, A, LDA, IPIV, INFO )
22: *
23: * .. Scalar Arguments ..
24: * INTEGER INFO, LDA, M, N
25: * ..
26: * .. Array Arguments ..
27: * INTEGER IPIV( * )
28: * DOUBLE PRECISION A( LDA, * )
29: * ..
30: *
31: *
32: *> \par Purpose:
33: * =============
34: *>
35: *> \verbatim
36: *>
37: *> DGETF2 computes an LU factorization of a general m-by-n matrix A
38: *> using partial pivoting with row interchanges.
39: *>
40: *> The factorization has the form
41: *> A = P * L * U
42: *> where P is a permutation matrix, L is lower triangular with unit
43: *> diagonal elements (lower trapezoidal if m > n), and U is upper
44: *> triangular (upper trapezoidal if m < n).
45: *>
46: *> This is the right-looking Level 2 BLAS version of the algorithm.
47: *> \endverbatim
48: *
49: * Arguments:
50: * ==========
51: *
52: *> \param[in] M
53: *> \verbatim
54: *> M is INTEGER
55: *> The number of rows of the matrix A. M >= 0.
56: *> \endverbatim
57: *>
58: *> \param[in] N
59: *> \verbatim
60: *> N is INTEGER
61: *> The number of columns of the matrix A. N >= 0.
62: *> \endverbatim
63: *>
64: *> \param[in,out] A
65: *> \verbatim
66: *> A is DOUBLE PRECISION array, dimension (LDA,N)
67: *> On entry, the m by n matrix to be factored.
68: *> On exit, the factors L and U from the factorization
69: *> A = P*L*U; the unit diagonal elements of L are not stored.
70: *> \endverbatim
71: *>
72: *> \param[in] LDA
73: *> \verbatim
74: *> LDA is INTEGER
75: *> The leading dimension of the array A. LDA >= max(1,M).
76: *> \endverbatim
77: *>
78: *> \param[out] IPIV
79: *> \verbatim
80: *> IPIV is INTEGER array, dimension (min(M,N))
81: *> The pivot indices; for 1 <= i <= min(M,N), row i of the
82: *> matrix was interchanged with row IPIV(i).
83: *> \endverbatim
84: *>
85: *> \param[out] INFO
86: *> \verbatim
87: *> INFO is INTEGER
88: *> = 0: successful exit
89: *> < 0: if INFO = -k, the k-th argument had an illegal value
90: *> > 0: if INFO = k, U(k,k) is exactly zero. The factorization
91: *> has been completed, but the factor U is exactly
92: *> singular, and division by zero will occur if it is used
93: *> to solve a system of equations.
94: *> \endverbatim
95: *
96: * Authors:
97: * ========
98: *
99: *> \author Univ. of Tennessee
100: *> \author Univ. of California Berkeley
101: *> \author Univ. of Colorado Denver
102: *> \author NAG Ltd.
103: *
104: *> \ingroup doubleGEcomputational
105: *
106: * =====================================================================
107: SUBROUTINE DGETF2( M, N, A, LDA, IPIV, INFO )
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: *
210: END
CVSweb interface <joel.bertrand@systella.fr>