Annotation of rpl/lapack/lapack/dpotrf.f, revision 1.19

1.9       bertrand    1: *> \brief \b DPOTRF
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.16      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.9       bertrand    7: *
                      8: *> \htmlonly
1.16      bertrand    9: *> Download DPOTRF + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dpotrf.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dpotrf.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dpotrf.f">
1.9       bertrand   15: *> [TXT]</a>
1.16      bertrand   16: *> \endhtmlonly
1.9       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE DPOTRF( UPLO, N, A, LDA, INFO )
1.16      bertrand   22: *
1.9       bertrand   23: *       .. Scalar Arguments ..
                     24: *       CHARACTER          UPLO
                     25: *       INTEGER            INFO, LDA, N
                     26: *       ..
                     27: *       .. Array Arguments ..
                     28: *       DOUBLE PRECISION   A( LDA, * )
                     29: *       ..
1.16      bertrand   30: *
1.9       bertrand   31: *
                     32: *> \par Purpose:
                     33: *  =============
                     34: *>
                     35: *> \verbatim
                     36: *>
                     37: *> DPOTRF computes the Cholesky factorization of a real symmetric
                     38: *> positive definite matrix A.
                     39: *>
                     40: *> The factorization has the form
                     41: *>    A = U**T * U,  if UPLO = 'U', or
                     42: *>    A = L  * L**T,  if UPLO = 'L',
                     43: *> where U is an upper triangular matrix and L is lower triangular.
                     44: *>
                     45: *> This is the block version of the algorithm, calling Level 3 BLAS.
                     46: *> \endverbatim
                     47: *
                     48: *  Arguments:
                     49: *  ==========
                     50: *
                     51: *> \param[in] UPLO
                     52: *> \verbatim
                     53: *>          UPLO is CHARACTER*1
                     54: *>          = 'U':  Upper triangle of A is stored;
                     55: *>          = 'L':  Lower triangle of A is stored.
                     56: *> \endverbatim
                     57: *>
                     58: *> \param[in] N
                     59: *> \verbatim
                     60: *>          N is INTEGER
                     61: *>          The order of the matrix A.  N >= 0.
                     62: *> \endverbatim
                     63: *>
                     64: *> \param[in,out] A
                     65: *> \verbatim
                     66: *>          A is DOUBLE PRECISION array, dimension (LDA,N)
                     67: *>          On entry, the symmetric matrix A.  If UPLO = 'U', the leading
                     68: *>          N-by-N upper triangular part of A contains the upper
                     69: *>          triangular part of the matrix A, and the strictly lower
                     70: *>          triangular part of A is not referenced.  If UPLO = 'L', the
                     71: *>          leading N-by-N lower triangular part of A contains the lower
                     72: *>          triangular part of the matrix A, and the strictly upper
                     73: *>          triangular part of A is not referenced.
                     74: *>
                     75: *>          On exit, if INFO = 0, the factor U or L from the Cholesky
                     76: *>          factorization A = U**T*U or A = L*L**T.
                     77: *> \endverbatim
                     78: *>
                     79: *> \param[in] LDA
                     80: *> \verbatim
                     81: *>          LDA is INTEGER
                     82: *>          The leading dimension of the array A.  LDA >= max(1,N).
                     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, the leading minor of order i is not
                     91: *>                positive definite, and the factorization could not be
                     92: *>                completed.
                     93: *> \endverbatim
                     94: *
                     95: *  Authors:
                     96: *  ========
                     97: *
1.16      bertrand   98: *> \author Univ. of Tennessee
                     99: *> \author Univ. of California Berkeley
                    100: *> \author Univ. of Colorado Denver
                    101: *> \author NAG Ltd.
1.9       bertrand  102: *
                    103: *> \ingroup doublePOcomputational
                    104: *
                    105: *  =====================================================================
1.1       bertrand  106:       SUBROUTINE DPOTRF( UPLO, N, A, LDA, INFO )
                    107: *
1.19    ! bertrand  108: *  -- LAPACK computational routine --
1.1       bertrand  109: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    110: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
                    111: *
                    112: *     .. Scalar Arguments ..
                    113:       CHARACTER          UPLO
                    114:       INTEGER            INFO, LDA, N
                    115: *     ..
                    116: *     .. Array Arguments ..
                    117:       DOUBLE PRECISION   A( LDA, * )
                    118: *     ..
                    119: *
                    120: *  =====================================================================
                    121: *
                    122: *     .. Parameters ..
                    123:       DOUBLE PRECISION   ONE
                    124:       PARAMETER          ( ONE = 1.0D+0 )
                    125: *     ..
                    126: *     .. Local Scalars ..
                    127:       LOGICAL            UPPER
                    128:       INTEGER            J, JB, NB
                    129: *     ..
                    130: *     .. External Functions ..
                    131:       LOGICAL            LSAME
                    132:       INTEGER            ILAENV
                    133:       EXTERNAL           LSAME, ILAENV
                    134: *     ..
                    135: *     .. External Subroutines ..
1.14      bertrand  136:       EXTERNAL           DGEMM, DPOTRF2, DSYRK, DTRSM, XERBLA
1.1       bertrand  137: *     ..
                    138: *     .. Intrinsic Functions ..
                    139:       INTRINSIC          MAX, MIN
                    140: *     ..
                    141: *     .. Executable Statements ..
                    142: *
                    143: *     Test the input parameters.
                    144: *
                    145:       INFO = 0
                    146:       UPPER = LSAME( UPLO, 'U' )
                    147:       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    148:          INFO = -1
                    149:       ELSE IF( N.LT.0 ) THEN
                    150:          INFO = -2
                    151:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    152:          INFO = -4
                    153:       END IF
                    154:       IF( INFO.NE.0 ) THEN
                    155:          CALL XERBLA( 'DPOTRF', -INFO )
                    156:          RETURN
                    157:       END IF
                    158: *
                    159: *     Quick return if possible
                    160: *
                    161:       IF( N.EQ.0 )
                    162:      $   RETURN
                    163: *
                    164: *     Determine the block size for this environment.
                    165: *
                    166:       NB = ILAENV( 1, 'DPOTRF', UPLO, N, -1, -1, -1 )
                    167:       IF( NB.LE.1 .OR. NB.GE.N ) THEN
                    168: *
                    169: *        Use unblocked code.
                    170: *
1.14      bertrand  171:          CALL DPOTRF2( UPLO, N, A, LDA, INFO )
1.1       bertrand  172:       ELSE
                    173: *
                    174: *        Use blocked code.
                    175: *
                    176:          IF( UPPER ) THEN
                    177: *
1.8       bertrand  178: *           Compute the Cholesky factorization A = U**T*U.
1.1       bertrand  179: *
                    180:             DO 10 J = 1, N, NB
                    181: *
                    182: *              Update and factorize the current diagonal block and test
                    183: *              for non-positive-definiteness.
                    184: *
                    185:                JB = MIN( NB, N-J+1 )
                    186:                CALL DSYRK( 'Upper', 'Transpose', JB, J-1, -ONE,
                    187:      $                     A( 1, J ), LDA, ONE, A( J, J ), LDA )
1.14      bertrand  188:                CALL DPOTRF2( 'Upper', JB, A( J, J ), LDA, INFO )
1.1       bertrand  189:                IF( INFO.NE.0 )
                    190:      $            GO TO 30
                    191:                IF( J+JB.LE.N ) THEN
                    192: *
                    193: *                 Compute the current block row.
                    194: *
                    195:                   CALL DGEMM( 'Transpose', 'No transpose', JB, N-J-JB+1,
                    196:      $                        J-1, -ONE, A( 1, J ), LDA, A( 1, J+JB ),
                    197:      $                        LDA, ONE, A( J, J+JB ), LDA )
                    198:                   CALL DTRSM( 'Left', 'Upper', 'Transpose', 'Non-unit',
                    199:      $                        JB, N-J-JB+1, ONE, A( J, J ), LDA,
                    200:      $                        A( J, J+JB ), LDA )
                    201:                END IF
                    202:    10       CONTINUE
                    203: *
                    204:          ELSE
                    205: *
1.8       bertrand  206: *           Compute the Cholesky factorization A = L*L**T.
1.1       bertrand  207: *
                    208:             DO 20 J = 1, N, NB
                    209: *
                    210: *              Update and factorize the current diagonal block and test
                    211: *              for non-positive-definiteness.
                    212: *
                    213:                JB = MIN( NB, N-J+1 )
                    214:                CALL DSYRK( 'Lower', 'No transpose', JB, J-1, -ONE,
                    215:      $                     A( J, 1 ), LDA, ONE, A( J, J ), LDA )
1.14      bertrand  216:                CALL DPOTRF2( 'Lower', JB, A( J, J ), LDA, INFO )
1.1       bertrand  217:                IF( INFO.NE.0 )
                    218:      $            GO TO 30
                    219:                IF( J+JB.LE.N ) THEN
                    220: *
                    221: *                 Compute the current block column.
                    222: *
                    223:                   CALL DGEMM( 'No transpose', 'Transpose', N-J-JB+1, JB,
                    224:      $                        J-1, -ONE, A( J+JB, 1 ), LDA, A( J, 1 ),
                    225:      $                        LDA, ONE, A( J+JB, J ), LDA )
                    226:                   CALL DTRSM( 'Right', 'Lower', 'Transpose', 'Non-unit',
                    227:      $                        N-J-JB+1, JB, ONE, A( J, J ), LDA,
                    228:      $                        A( J+JB, J ), LDA )
                    229:                END IF
                    230:    20       CONTINUE
                    231:          END IF
                    232:       END IF
                    233:       GO TO 40
                    234: *
                    235:    30 CONTINUE
                    236:       INFO = INFO + J - 1
                    237: *
                    238:    40 CONTINUE
                    239:       RETURN
                    240: *
                    241: *     End of DPOTRF
                    242: *
                    243:       END

CVSweb interface <joel.bertrand@systella.fr>