 LAPACK  3.10.1 LAPACK: Linear Algebra PACKage

## ◆ cgetf2()

 subroutine cgetf2 ( integer M, integer N, complex, dimension( lda, * ) A, integer LDA, integer, dimension( * ) IPIV, integer INFO )

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

Purpose:
``` CGETF2 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 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.```

Definition at line 107 of file cgetf2.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  COMPLEX A( LDA, * )
119 * ..
120 *
121 * =====================================================================
122 *
123 * .. Parameters ..
124  COMPLEX ONE, ZERO
125  parameter( one = ( 1.0e+0, 0.0e+0 ),
126  \$ zero = ( 0.0e+0, 0.0e+0 ) )
127 * ..
128 * .. Local Scalars ..
129  REAL SFMIN
130  INTEGER I, J, JP
131 * ..
132 * .. External Functions ..
133  REAL SLAMCH
134  INTEGER ICAMAX
135  EXTERNAL slamch, icamax
136 * ..
137 * .. External Subroutines ..
138  EXTERNAL cgeru, cscal, cswap, xerbla
139 * ..
140 * .. Intrinsic Functions ..
141  INTRINSIC max, min
142 * ..
143 * .. Executable Statements ..
144 *
145 * Test the input parameters.
146 *
147  info = 0
148  IF( m.LT.0 ) THEN
149  info = -1
150  ELSE IF( n.LT.0 ) THEN
151  info = -2
152  ELSE IF( lda.LT.max( 1, m ) ) THEN
153  info = -4
154  END IF
155  IF( info.NE.0 ) THEN
156  CALL xerbla( 'CGETF2', -info )
157  RETURN
158  END IF
159 *
160 * Quick return if possible
161 *
162  IF( m.EQ.0 .OR. n.EQ.0 )
163  \$ RETURN
164 *
165 * Compute machine safe minimum
166 *
167  sfmin = slamch('S')
168 *
169  DO 10 j = 1, min( m, n )
170 *
171 * Find pivot and test for singularity.
172 *
173  jp = j - 1 + icamax( m-j+1, a( j, j ), 1 )
174  ipiv( j ) = jp
175  IF( a( jp, j ).NE.zero ) THEN
176 *
177 * Apply the interchange to columns 1:N.
178 *
179  IF( jp.NE.j )
180  \$ CALL cswap( n, a( j, 1 ), lda, a( jp, 1 ), lda )
181 *
182 * Compute elements J+1:M of J-th column.
183 *
184  IF( j.LT.m ) THEN
185  IF( abs(a( j, j )) .GE. sfmin ) THEN
186  CALL cscal( m-j, one / a( j, j ), a( j+1, j ), 1 )
187  ELSE
188  DO 20 i = 1, m-j
189  a( j+i, j ) = a( j+i, j ) / a( j, j )
190  20 CONTINUE
191  END IF
192  END IF
193 *
194  ELSE IF( info.EQ.0 ) THEN
195 *
196  info = j
197  END IF
198 *
199  IF( j.LT.min( m, n ) ) THEN
200 *
201 * Update trailing submatrix.
202 *
203  CALL cgeru( m-j, n-j, -one, a( j+1, j ), 1, a( j, j+1 ),
204  \$ lda, a( j+1, j+1 ), lda )
205  END IF
206  10 CONTINUE
207  RETURN
208 *
209 * End of CGETF2
210 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
integer function icamax(N, CX, INCX)
ICAMAX
Definition: icamax.f:71
subroutine cswap(N, CX, INCX, CY, INCY)
CSWAP
Definition: cswap.f:81
subroutine cscal(N, CA, CX, INCX)
CSCAL
Definition: cscal.f:78
subroutine cgeru(M, N, ALPHA, X, INCX, Y, INCY, A, LDA)
CGERU
Definition: cgeru.f:130
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: