Annotation of rpl/lapack/lapack/zgetrf.f, revision 1.18

1.8       bertrand    1: *> \brief \b ZGETRF
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.15      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.8       bertrand    7: *
                      8: *> \htmlonly
1.15      bertrand    9: *> Download ZGETRF + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zgetrf.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zgetrf.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zgetrf.f">
1.8       bertrand   15: *> [TXT]</a>
1.15      bertrand   16: *> \endhtmlonly
1.8       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO )
1.15      bertrand   22: *
1.8       bertrand   23: *       .. Scalar Arguments ..
                     24: *       INTEGER            INFO, LDA, M, N
                     25: *       ..
                     26: *       .. Array Arguments ..
                     27: *       INTEGER            IPIV( * )
                     28: *       COMPLEX*16         A( LDA, * )
                     29: *       ..
1.15      bertrand   30: *
1.8       bertrand   31: *
                     32: *> \par Purpose:
                     33: *  =============
                     34: *>
                     35: *> \verbatim
                     36: *>
                     37: *> ZGETRF computes an LU factorization of a general M-by-N matrix A
                     38: *> using partial pivoting with row interchanges.
                     39: *>
                     40: *> The factorization has the form
                     41: *>    A = P * L * U
                     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).
                     45: *>
                     46: *> This is the right-looking Level 3 BLAS version of the algorithm.
                     47: *> \endverbatim
                     48: *
                     49: *  Arguments:
                     50: *  ==========
                     51: *
                     52: *> \param[in] M
                     53: *> \verbatim
                     54: *>          M is INTEGER
                     55: *>          The number of rows of the matrix A.  M >= 0.
                     56: *> \endverbatim
                     57: *>
                     58: *> \param[in] N
                     59: *> \verbatim
                     60: *>          N is INTEGER
                     61: *>          The number of columns of the matrix A.  N >= 0.
                     62: *> \endverbatim
                     63: *>
                     64: *> \param[in,out] A
                     65: *> \verbatim
                     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.
                     70: *> \endverbatim
                     71: *>
                     72: *> \param[in] LDA
                     73: *> \verbatim
                     74: *>          LDA is INTEGER
                     75: *>          The leading dimension of the array A.  LDA >= max(1,M).
                     76: *> \endverbatim
                     77: *>
                     78: *> \param[out] IPIV
                     79: *> \verbatim
                     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).
                     83: *> \endverbatim
                     84: *>
                     85: *> \param[out] INFO
                     86: *> \verbatim
                     87: *>          INFO is INTEGER
                     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.
                     94: *> \endverbatim
                     95: *
                     96: *  Authors:
                     97: *  ========
                     98: *
1.15      bertrand   99: *> \author Univ. of Tennessee
                    100: *> \author Univ. of California Berkeley
                    101: *> \author Univ. of Colorado Denver
                    102: *> \author NAG Ltd.
1.8       bertrand  103: *
                    104: *> \ingroup complex16GEcomputational
                    105: *
                    106: *  =====================================================================
1.1       bertrand  107:       SUBROUTINE ZGETRF( M, N, A, LDA, IPIV, INFO )
                    108: *
1.18    ! bertrand  109: *  -- LAPACK computational routine --
1.1       bertrand  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*16         A( LDA, * )
                    119: *     ..
                    120: *
                    121: *  =====================================================================
                    122: *
                    123: *     .. Parameters ..
                    124:       COMPLEX*16         ONE
                    125:       PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ) )
                    126: *     ..
                    127: *     .. Local Scalars ..
                    128:       INTEGER            I, IINFO, J, JB, NB
                    129: *     ..
                    130: *     .. External Subroutines ..
1.13      bertrand  131:       EXTERNAL           XERBLA, ZGEMM, ZGETRF2, ZLASWP, ZTRSM
1.1       bertrand  132: *     ..
                    133: *     .. External Functions ..
                    134:       INTEGER            ILAENV
                    135:       EXTERNAL           ILAENV
                    136: *     ..
                    137: *     .. Intrinsic Functions ..
                    138:       INTRINSIC          MAX, MIN
                    139: *     ..
                    140: *     .. Executable Statements ..
                    141: *
                    142: *     Test the input parameters.
                    143: *
                    144:       INFO = 0
                    145:       IF( M.LT.0 ) THEN
                    146:          INFO = -1
                    147:       ELSE IF( N.LT.0 ) THEN
                    148:          INFO = -2
                    149:       ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
                    150:          INFO = -4
                    151:       END IF
                    152:       IF( INFO.NE.0 ) THEN
                    153:          CALL XERBLA( 'ZGETRF', -INFO )
                    154:          RETURN
                    155:       END IF
                    156: *
                    157: *     Quick return if possible
                    158: *
                    159:       IF( M.EQ.0 .OR. N.EQ.0 )
                    160:      $   RETURN
                    161: *
                    162: *     Determine the block size for this environment.
                    163: *
                    164:       NB = ILAENV( 1, 'ZGETRF', ' ', M, N, -1, -1 )
                    165:       IF( NB.LE.1 .OR. NB.GE.MIN( M, N ) ) THEN
                    166: *
                    167: *        Use unblocked code.
                    168: *
1.13      bertrand  169:          CALL ZGETRF2( M, N, A, LDA, IPIV, INFO )
1.1       bertrand  170:       ELSE
                    171: *
                    172: *        Use blocked code.
                    173: *
                    174:          DO 20 J = 1, MIN( M, N ), NB
                    175:             JB = MIN( MIN( M, N )-J+1, NB )
                    176: *
                    177: *           Factor diagonal and subdiagonal blocks and test for exact
                    178: *           singularity.
                    179: *
1.13      bertrand  180:             CALL ZGETRF2( M-J+1, JB, A( J, J ), LDA, IPIV( J ), IINFO )
1.1       bertrand  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', JB,
                    204:      $                     N-J-JB+1, ONE, A( J, J ), LDA, A( J, J+JB ),
                    205:      $                     LDA )
                    206:                IF( J+JB.LE.M ) THEN
                    207: *
                    208: *                 Update trailing submatrix.
                    209: *
                    210:                   CALL ZGEMM( 'No transpose', 'No transpose', M-J-JB+1,
                    211:      $                        N-J-JB+1, JB, -ONE, A( J+JB, J ), LDA,
                    212:      $                        A( J, J+JB ), LDA, ONE, A( J+JB, J+JB ),
                    213:      $                        LDA )
                    214:                END IF
                    215:             END IF
                    216:    20    CONTINUE
                    217:       END IF
                    218:       RETURN
                    219: *
                    220: *     End of ZGETRF
                    221: *
                    222:       END

CVSweb interface <joel.bertrand@systella.fr>