![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b ZGETRF 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download ZGETRF + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgetrf.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgetrf.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgetrf.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * INTEGER INFO, LDA, M, N 00025 * .. 00026 * .. Array Arguments .. 00027 * INTEGER IPIV( * ) 00028 * COMPLEX*16 A( LDA, * ) 00029 * .. 00030 * 00031 * 00032 *> \par Purpose: 00033 * ============= 00034 *> 00035 *> \verbatim 00036 *> 00037 *> ZGETRF computes an LU factorization of a general M-by-N matrix A 00038 *> using partial pivoting with row interchanges. 00039 *> 00040 *> The factorization has the form 00041 *> A = P * L * U 00042 *> where P is a permutation matrix, L is lower triangular with unit 00043 *> diagonal elements (lower trapezoidal if m > n), and U is upper 00044 *> triangular (upper trapezoidal if m < n). 00045 *> 00046 *> This is the right-looking Level 3 BLAS version of the algorithm. 00047 *> \endverbatim 00048 * 00049 * Arguments: 00050 * ========== 00051 * 00052 *> \param[in] M 00053 *> \verbatim 00054 *> M is INTEGER 00055 *> The number of rows of the matrix A. M >= 0. 00056 *> \endverbatim 00057 *> 00058 *> \param[in] N 00059 *> \verbatim 00060 *> N is INTEGER 00061 *> The number of columns of the matrix A. N >= 0. 00062 *> \endverbatim 00063 *> 00064 *> \param[in,out] A 00065 *> \verbatim 00066 *> A is COMPLEX*16 array, dimension (LDA,N) 00067 *> On entry, the M-by-N matrix to be factored. 00068 *> On exit, the factors L and U from the factorization 00069 *> A = P*L*U; the unit diagonal elements of L are not stored. 00070 *> \endverbatim 00071 *> 00072 *> \param[in] LDA 00073 *> \verbatim 00074 *> LDA is INTEGER 00075 *> The leading dimension of the array A. LDA >= max(1,M). 00076 *> \endverbatim 00077 *> 00078 *> \param[out] IPIV 00079 *> \verbatim 00080 *> IPIV is INTEGER array, dimension (min(M,N)) 00081 *> The pivot indices; for 1 <= i <= min(M,N), row i of the 00082 *> matrix was interchanged with row IPIV(i). 00083 *> \endverbatim 00084 *> 00085 *> \param[out] INFO 00086 *> \verbatim 00087 *> INFO is INTEGER 00088 *> = 0: successful exit 00089 *> < 0: if INFO = -i, the i-th argument had an illegal value 00090 *> > 0: if INFO = i, U(i,i) is exactly zero. The factorization 00091 *> has been completed, but the factor U is exactly 00092 *> singular, and division by zero will occur if it is used 00093 *> to solve a system of equations. 00094 *> \endverbatim 00095 * 00096 * Authors: 00097 * ======== 00098 * 00099 *> \author Univ. of Tennessee 00100 *> \author Univ. of California Berkeley 00101 *> \author Univ. of Colorado Denver 00102 *> \author NAG Ltd. 00103 * 00104 *> \date November 2011 00105 * 00106 *> \ingroup complex16GEcomputational 00107 * 00108 * ===================================================================== 00109 SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO ) 00110 * 00111 * -- LAPACK computational routine (version 3.4.0) -- 00112 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00113 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00114 * November 2011 00115 * 00116 * .. Scalar Arguments .. 00117 INTEGER INFO, LDA, M, N 00118 * .. 00119 * .. Array Arguments .. 00120 INTEGER IPIV( * ) 00121 COMPLEX*16 A( LDA, * ) 00122 * .. 00123 * 00124 * ===================================================================== 00125 * 00126 * .. Parameters .. 00127 COMPLEX*16 ONE 00128 PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) ) 00129 * .. 00130 * .. Local Scalars .. 00131 INTEGER I, IINFO, J, JB, NB 00132 * .. 00133 * .. External Subroutines .. 00134 EXTERNAL XERBLA, ZGEMM, ZGETF2, ZLASWP, ZTRSM 00135 * .. 00136 * .. External Functions .. 00137 INTEGER ILAENV 00138 EXTERNAL ILAENV 00139 * .. 00140 * .. Intrinsic Functions .. 00141 INTRINSIC MAX, MIN 00142 * .. 00143 * .. Executable Statements .. 00144 * 00145 * Test the input parameters. 00146 * 00147 INFO = 0 00148 IF( M.LT.0 ) THEN 00149 INFO = -1 00150 ELSE IF( N.LT.0 ) THEN 00151 INFO = -2 00152 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN 00153 INFO = -4 00154 END IF 00155 IF( INFO.NE.0 ) THEN 00156 CALL XERBLA( 'ZGETRF', -INFO ) 00157 RETURN 00158 END IF 00159 * 00160 * Quick return if possible 00161 * 00162 IF( M.EQ.0 .OR. N.EQ.0 ) 00163 $ RETURN 00164 * 00165 * Determine the block size for this environment. 00166 * 00167 NB = ILAENV( 1, 'ZGETRF', ' ', M, N, -1, -1 ) 00168 IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN 00169 * 00170 * Use unblocked code. 00171 * 00172 CALL ZGETF2( M, N, A, LDA, IPIV, INFO ) 00173 ELSE 00174 * 00175 * Use blocked code. 00176 * 00177 DO 20 J = 1, MIN( M, N ), NB 00178 JB = MIN( MIN( M, N )-J+1, NB ) 00179 * 00180 * Factor diagonal and subdiagonal blocks and test for exact 00181 * singularity. 00182 * 00183 CALL ZGETF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO ) 00184 * 00185 * Adjust INFO and the pivot indices. 00186 * 00187 IF( INFO.EQ.0 .AND. IINFO.GT.0 ) 00188 $ INFO = IINFO + J - 1 00189 DO 10 I = J, MIN( M, J+JB-1 ) 00190 IPIV( I ) = J - 1 + IPIV( I ) 00191 10 CONTINUE 00192 * 00193 * Apply interchanges to columns 1:J-1. 00194 * 00195 CALL ZLASWP( J-1, A, LDA, J, J+JB-1, IPIV, 1 ) 00196 * 00197 IF( J+JB.LE.N ) THEN 00198 * 00199 * Apply interchanges to columns J+JB:N. 00200 * 00201 CALL ZLASWP( N-J-JB+1, A( 1, J+JB ), LDA, J, J+JB-1, 00202 $ IPIV, 1 ) 00203 * 00204 * Compute block row of U. 00205 * 00206 CALL ZTRSM( 'Left', 'Lower', 'No transpose', 'Unit', JB, 00207 $ N-J-JB+1, ONE, A( J, J ), LDA, A( J, J+JB ), 00208 $ LDA ) 00209 IF( J+JB.LE.M ) THEN 00210 * 00211 * Update trailing submatrix. 00212 * 00213 CALL ZGEMM( 'No transpose', 'No transpose', M-J-JB+1, 00214 $ N-J-JB+1, JB, -ONE, A( J+JB, J ), LDA, 00215 $ A( J, J+JB ), LDA, ONE, A( J+JB, J+JB ), 00216 $ LDA ) 00217 END IF 00218 END IF 00219 20 CONTINUE 00220 END IF 00221 RETURN 00222 * 00223 * End of ZGETRF 00224 * 00225 END