LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zgetrf.f
Go to the documentation of this file.
1*> \brief \b ZGETRF
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZGETRF + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgetrf.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgetrf.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgetrf.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO )
20*
21* .. Scalar Arguments ..
22* INTEGER INFO, LDA, M, N
23* ..
24* .. Array Arguments ..
25* INTEGER IPIV( * )
26* COMPLEX*16 A( LDA, * )
27* ..
28*
29*
30*> \par Purpose:
31* =============
32*>
33*> \verbatim
34*>
35*> ZGETRF computes an LU factorization of a general M-by-N matrix A
36*> using partial pivoting with row interchanges.
37*>
38*> The factorization has the form
39*> A = P * L * U
40*> where P is a permutation matrix, L is lower triangular with unit
41*> diagonal elements (lower trapezoidal if m > n), and U is upper
42*> triangular (upper trapezoidal if m < n).
43*>
44*> This is the right-looking Level 3 BLAS version of the algorithm.
45*> \endverbatim
46*
47* Arguments:
48* ==========
49*
50*> \param[in] M
51*> \verbatim
52*> M is INTEGER
53*> The number of rows of the matrix A. M >= 0.
54*> \endverbatim
55*>
56*> \param[in] N
57*> \verbatim
58*> N is INTEGER
59*> The number of columns of the matrix A. N >= 0.
60*> \endverbatim
61*>
62*> \param[in,out] A
63*> \verbatim
64*> A is COMPLEX*16 array, dimension (LDA,N)
65*> On entry, the M-by-N matrix to be factored.
66*> On exit, the factors L and U from the factorization
67*> A = P*L*U; the unit diagonal elements of L are not stored.
68*> \endverbatim
69*>
70*> \param[in] LDA
71*> \verbatim
72*> LDA is INTEGER
73*> The leading dimension of the array A. LDA >= max(1,M).
74*> \endverbatim
75*>
76*> \param[out] IPIV
77*> \verbatim
78*> IPIV is INTEGER array, dimension (min(M,N))
79*> The pivot indices; for 1 <= i <= min(M,N), row i of the
80*> matrix was interchanged with row IPIV(i).
81*> \endverbatim
82*>
83*> \param[out] INFO
84*> \verbatim
85*> INFO is INTEGER
86*> = 0: successful exit
87*> < 0: if INFO = -i, the i-th argument had an illegal value
88*> > 0: if INFO = i, U(i,i) is exactly zero. The factorization
89*> has been completed, but the factor U is exactly
90*> singular, and division by zero will occur if it is used
91*> to solve a system of equations.
92*> \endverbatim
93*
94* Authors:
95* ========
96*
97*> \author Univ. of Tennessee
98*> \author Univ. of California Berkeley
99*> \author Univ. of Colorado Denver
100*> \author NAG Ltd.
101*
102*> \ingroup getrf
103*
104* =====================================================================
105 SUBROUTINE zgetrf( M, N, A, LDA, IPIV, INFO )
106*
107* -- LAPACK computational routine --
108* -- LAPACK is a software package provided by Univ. of Tennessee, --
109* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110*
111* .. Scalar Arguments ..
112 INTEGER INFO, LDA, M, N
113* ..
114* .. Array Arguments ..
115 INTEGER IPIV( * )
116 COMPLEX*16 A( LDA, * )
117* ..
118*
119* =====================================================================
120*
121* .. Parameters ..
122 COMPLEX*16 ONE
123 parameter( one = ( 1.0d+0, 0.0d+0 ) )
124* ..
125* .. Local Scalars ..
126 INTEGER I, IINFO, J, JB, NB
127* ..
128* .. External Subroutines ..
129 EXTERNAL xerbla, zgemm, zgetrf2, zlaswp,
130 $ ztrsm
131* ..
132* .. External Functions ..
133 INTEGER ILAENV
134 EXTERNAL ilaenv
135* ..
136* .. Intrinsic Functions ..
137 INTRINSIC max, min
138* ..
139* .. Executable Statements ..
140*
141* Test the input parameters.
142*
143 info = 0
144 IF( m.LT.0 ) THEN
145 info = -1
146 ELSE IF( n.LT.0 ) THEN
147 info = -2
148 ELSE IF( lda.LT.max( 1, m ) ) THEN
149 info = -4
150 END IF
151 IF( info.NE.0 ) THEN
152 CALL xerbla( 'ZGETRF', -info )
153 RETURN
154 END IF
155*
156* Quick return if possible
157*
158 IF( m.EQ.0 .OR. n.EQ.0 )
159 $ RETURN
160*
161* Determine the block size for this environment.
162*
163 nb = ilaenv( 1, 'ZGETRF', ' ', m, n, -1, -1 )
164 IF( nb.LE.1 .OR. nb.GE.min( m, n ) ) THEN
165*
166* Use unblocked code.
167*
168 CALL zgetrf2( m, n, a, lda, ipiv, info )
169 ELSE
170*
171* Use blocked code.
172*
173 DO 20 j = 1, min( m, n ), nb
174 jb = min( min( m, n )-j+1, nb )
175*
176* Factor diagonal and subdiagonal blocks and test for exact
177* singularity.
178*
179 CALL zgetrf2( m-j+1, jb, a( j, j ), lda, ipiv( j ),
180 $ iinfo )
181*
182* Adjust INFO and the pivot indices.
183*
184 IF( info.EQ.0 .AND. iinfo.GT.0 )
185 $ info = iinfo + j - 1
186 DO 10 i = j, min( m, j+jb-1 )
187 ipiv( i ) = j - 1 + ipiv( i )
188 10 CONTINUE
189*
190* Apply interchanges to columns 1:J-1.
191*
192 CALL zlaswp( j-1, a, lda, j, j+jb-1, ipiv, 1 )
193*
194 IF( j+jb.LE.n ) THEN
195*
196* Apply interchanges to columns J+JB:N.
197*
198 CALL zlaswp( n-j-jb+1, a( 1, j+jb ), lda, j, j+jb-1,
199 $ ipiv, 1 )
200*
201* Compute block row of U.
202*
203 CALL ztrsm( 'Left', 'Lower', 'No transpose', 'Unit',
204 $ jb,
205 $ n-j-jb+1, one, a( j, j ), lda, a( j, j+jb ),
206 $ lda )
207 IF( j+jb.LE.m ) THEN
208*
209* Update trailing submatrix.
210*
211 CALL zgemm( 'No transpose', 'No transpose',
212 $ m-j-jb+1,
213 $ n-j-jb+1, jb, -one, a( j+jb, j ), lda,
214 $ a( j, j+jb ), lda, one, a( j+jb, j+jb ),
215 $ lda )
216 END IF
217 END IF
218 20 CONTINUE
219 END IF
220 RETURN
221*
222* End of ZGETRF
223*
224 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine zgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
ZGEMM
Definition zgemm.f:188
recursive subroutine zgetrf2(m, n, a, lda, ipiv, info)
ZGETRF2
Definition zgetrf2.f:113
subroutine zgetrf(m, n, a, lda, ipiv, info)
ZGETRF
Definition zgetrf.f:106
subroutine zlaswp(n, a, lda, k1, k2, ipiv, incx)
ZLASWP performs a series of row interchanges on a general rectangular matrix.
Definition zlaswp.f:113
subroutine ztrsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
ZTRSM
Definition ztrsm.f:180