zgetrf.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 184 行
HTML
184 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>zgetrf.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="ZGETRF.1"></a><a href="zgetrf.f.html#ZGETRF.1">ZGETRF</a>( M, N, A, LDA, IPIV, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> INTEGER INFO, LDA, M, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> INTEGER IPIV( * )
COMPLEX*16 A( LDA, * )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="ZGETRF.18"></a><a href="zgetrf.f.html#ZGETRF.1">ZGETRF</a> computes an LU factorization of a general M-by-N matrix A
</span><span class="comment">*</span><span class="comment"> using partial pivoting with row interchanges.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The factorization has the form
</span><span class="comment">*</span><span class="comment"> A = P * L * U
</span><span class="comment">*</span><span class="comment"> where P is a permutation matrix, L is lower triangular with unit
</span><span class="comment">*</span><span class="comment"> diagonal elements (lower trapezoidal if m > n), and U is upper
</span><span class="comment">*</span><span class="comment"> triangular (upper trapezoidal if m < n).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> This is the right-looking Level 3 BLAS version of the algorithm.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> M (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of rows of the matrix A. M >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The number of columns of the matrix A. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A (input/output) COMPLEX*16 array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment"> On entry, the M-by-N matrix to be factored.
</span><span class="comment">*</span><span class="comment"> On exit, the factors L and U from the factorization
</span><span class="comment">*</span><span class="comment"> A = P*L*U; the unit diagonal elements of L are not stored.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDA (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array A. LDA >= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IPIV (output) INTEGER array, dimension (min(M,N))
</span><span class="comment">*</span><span class="comment"> The pivot indices; for 1 <= i <= min(M,N), row i of the
</span><span class="comment">*</span><span class="comment"> matrix was interchanged with row IPIV(i).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INFO (output) INTEGER
</span><span class="comment">*</span><span class="comment"> = 0: successful exit
</span><span class="comment">*</span><span class="comment"> < 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment"> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
</span><span class="comment">*</span><span class="comment"> has been completed, but the factor U is exactly
</span><span class="comment">*</span><span class="comment"> singular, and division by zero will occur if it is used
</span><span class="comment">*</span><span class="comment"> to solve a system of equations.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Parameters ..
</span> COMPLEX*16 ONE
PARAMETER ( ONE = ( 1.0D+0, 0.0D+0 ) )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER I, IINFO, J, JB, NB
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="XERBLA.68"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, ZGEMM, <a name="ZGETF2.68"></a><a href="zgetf2.f.html#ZGETF2.1">ZGETF2</a>, <a name="ZLASWP.68"></a><a href="zlaswp.f.html#ZLASWP.1">ZLASWP</a>, ZTRSM
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> INTEGER <a name="ILAENV.71"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
EXTERNAL <a name="ILAENV.72"></a><a href="hfy-index.html#ILAENV">ILAENV</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC MAX, MIN
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( M.LT.0 ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
INFO = -4
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.90"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZGETRF.90"></a><a href="zgetrf.f.html#ZGETRF.1">ZGETRF</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span> IF( M.EQ.0 .OR. N.EQ.0 )
$ RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine the block size for this environment.
</span><span class="comment">*</span><span class="comment">
</span> NB = <a name="ILAENV.101"></a><a href="hfy-index.html#ILAENV">ILAENV</a>( 1, <span class="string">'<a name="ZGETRF.101"></a><a href="zgetrf.f.html#ZGETRF.1">ZGETRF</a>'</span>, <span class="string">' '</span>, M, N, -1, -1 )
IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Use unblocked code.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="ZGETF2.106"></a><a href="zgetf2.f.html#ZGETF2.1">ZGETF2</a>( M, N, A, LDA, IPIV, INFO )
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Use blocked code.
</span><span class="comment">*</span><span class="comment">
</span> DO 20 J = 1, MIN( M, N ), NB
JB = MIN( MIN( M, N )-J+1, NB )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Factor diagonal and subdiagonal blocks and test for exact
</span><span class="comment">*</span><span class="comment"> singularity.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="ZGETF2.117"></a><a href="zgetf2.f.html#ZGETF2.1">ZGETF2</a>( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Adjust INFO and the pivot indices.
</span><span class="comment">*</span><span class="comment">
</span> IF( INFO.EQ.0 .AND. IINFO.GT.0 )
$ INFO = IINFO + J - 1
DO 10 I = J, MIN( M, J+JB-1 )
IPIV( I ) = J - 1 + IPIV( I )
10 CONTINUE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Apply interchanges to columns 1:J-1.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="ZLASWP.129"></a><a href="zlaswp.f.html#ZLASWP.1">ZLASWP</a>( J-1, A, LDA, J, J+JB-1, IPIV, 1 )
<span class="comment">*</span><span class="comment">
</span> IF( J+JB.LE.N ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Apply interchanges to columns J+JB:N.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="ZLASWP.135"></a><a href="zlaswp.f.html#ZLASWP.1">ZLASWP</a>( N-J-JB+1, A( 1, J+JB ), LDA, J, J+JB-1,
$ IPIV, 1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute block row of U.
</span><span class="comment">*</span><span class="comment">
</span> CALL ZTRSM( <span class="string">'Left'</span>, <span class="string">'Lower'</span>, <span class="string">'No transpose'</span>, <span class="string">'Unit'</span>, JB,
$ N-J-JB+1, ONE, A( J, J ), LDA, A( J, J+JB ),
$ LDA )
IF( J+JB.LE.M ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Update trailing submatrix.
</span><span class="comment">*</span><span class="comment">
</span> CALL ZGEMM( <span class="string">'No transpose'</span>, <span class="string">'No transpose'</span>, M-J-JB+1,
$ N-J-JB+1, JB, -ONE, A( J+JB, J ), LDA,
$ A( J, J+JB ), LDA, ONE, A( J+JB, J+JB ),
$ LDA )
END IF
END IF
20 CONTINUE
END IF
RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="ZGETRF.157"></a><a href="zgetrf.f.html#ZGETRF.1">ZGETRF</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?