3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download ZGETRF + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgetrf.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgetrf.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgetrf.f">
21 * SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO )
23 * .. Scalar Arguments ..
24 * INTEGER INFO, LDA, M, N
26 * .. Array Arguments ..
28 * COMPLEX*16 A( LDA, * )
37 *> ZGETRF computes an LU factorization of a general M-by-N matrix A
38 *> using partial pivoting with row interchanges.
40 *> The factorization has the form
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).
46 *> This is the right-looking Level 3 BLAS version of the algorithm.
55 *> The number of rows of the matrix A. M >= 0.
61 *> The number of columns of the matrix A. N >= 0.
66 *> A is COMPLEX*16 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.
75 *> The leading dimension of the array A. LDA >= max(1,M).
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).
88 *> = 0: successful exit
89 *> < 0: if INFO = -i, the i-th argument had an illegal value
90 *> > 0: if INFO = i, U(i,i) 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.
99 *> \author Univ. of Tennessee
100 *> \author Univ. of California Berkeley
101 *> \author Univ. of Colorado Denver
104 *> \date November 2015
106 *> \ingroup complex16GEcomputational
108 * =====================================================================
109 SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO )
111 * -- LAPACK computational routine (version 3.6.0) --
112 * -- LAPACK is a software package provided by Univ. of Tennessee, --
113 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
116 * .. Scalar Arguments ..
117 INTEGER INFO, LDA, M, N
119 * .. Array Arguments ..
121 COMPLEX*16 A( LDA, * )
124 * =====================================================================
128 PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )
130 * .. Local Scalars ..
131 INTEGER I, IINFO, J, JB, NB
133 * .. External Subroutines ..
134 EXTERNAL XERBLA, ZGEMM, ZGETRF2, ZLASWP, ZTRSM
136 * .. External Functions ..
140 * .. Intrinsic Functions ..
143 * .. Executable Statements ..
145 * Test the input parameters.
150 ELSE IF( N.LT.0 ) THEN
152 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
156 CALL XERBLA( 'ZGETRF', -INFO )
160 * Quick return if possible
162 IF( M.EQ.0 .OR. N.EQ.0 )
165 * Determine the block size for this environment.
167 NB = ILAENV( 1, 'ZGETRF', ' ', M, N, -1, -1 )
168 IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
170 * Use unblocked code.
172 CALL ZGETRF2( M, N, A, LDA, IPIV, INFO )
177 DO 20 J = 1, MIN( M, N ), NB
178 JB = MIN( MIN( M, N )-J+1, NB )
180 * Factor diagonal and subdiagonal blocks and test for exact
183 CALL ZGETRF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
185 * Adjust INFO and the pivot indices.
187 IF( INFO.EQ.0 .AND. IINFO.GT.0 )
188 $ INFO = IINFO + J - 1
189 DO 10 I = J, MIN( M, J+JB-1 )
190 IPIV( I ) = J - 1 + IPIV( I )
193 * Apply interchanges to columns 1:J-1.
195 CALL ZLASWP( J-1, A, LDA, J, J+JB-1, IPIV, 1 )
199 * Apply interchanges to columns J+JB:N.
201 CALL ZLASWP( N-J-JB+1, A( 1, J+JB ), LDA, J, J+JB-1,
204 * Compute block row of U.
206 CALL ZTRSM( 'Left', 'Lower', 'No transpose', 'Unit', JB,
207 $ N-J-JB+1, ONE, A( J, J ), LDA, A( J, J+JB ),
211 * Update trailing submatrix.
213 CALL ZGEMM( 'No transpose', 'No transpose', M-J-JB+1,
214 $ N-J-JB+1, JB, -ONE, A( J+JB, J ), LDA,
215 $ A( J, J+JB ), LDA, ONE, A( J+JB, J+JB ),