Annotation of rpl/lapack/lapack/dpptrf.f, revision 1.16

1.9       bertrand    1: *> \brief \b DPPTRF
                      2: *
                      3: *  =========== DOCUMENTATION ===========
                      4: *
1.15      bertrand    5: * Online html documentation available at
                      6: *            http://www.netlib.org/lapack/explore-html/
1.9       bertrand    7: *
                      8: *> \htmlonly
1.15      bertrand    9: *> Download DPPTRF + dependencies
                     10: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dpptrf.f">
                     11: *> [TGZ]</a>
                     12: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dpptrf.f">
                     13: *> [ZIP]</a>
                     14: *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dpptrf.f">
1.9       bertrand   15: *> [TXT]</a>
1.15      bertrand   16: *> \endhtmlonly
1.9       bertrand   17: *
                     18: *  Definition:
                     19: *  ===========
                     20: *
                     21: *       SUBROUTINE DPPTRF( UPLO, N, AP, INFO )
1.15      bertrand   22: *
1.9       bertrand   23: *       .. Scalar Arguments ..
                     24: *       CHARACTER          UPLO
                     25: *       INTEGER            INFO, N
                     26: *       ..
                     27: *       .. Array Arguments ..
                     28: *       DOUBLE PRECISION   AP( * )
                     29: *       ..
1.15      bertrand   30: *
1.9       bertrand   31: *
                     32: *> \par Purpose:
                     33: *  =============
                     34: *>
                     35: *> \verbatim
                     36: *>
                     37: *> DPPTRF computes the Cholesky factorization of a real symmetric
                     38: *> positive definite matrix A stored in packed format.
                     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: *> \endverbatim
                     45: *
                     46: *  Arguments:
                     47: *  ==========
                     48: *
                     49: *> \param[in] UPLO
                     50: *> \verbatim
                     51: *>          UPLO is CHARACTER*1
                     52: *>          = 'U':  Upper triangle of A is stored;
                     53: *>          = 'L':  Lower triangle of A is stored.
                     54: *> \endverbatim
                     55: *>
                     56: *> \param[in] N
                     57: *> \verbatim
                     58: *>          N is INTEGER
                     59: *>          The order of the matrix A.  N >= 0.
                     60: *> \endverbatim
                     61: *>
                     62: *> \param[in,out] AP
                     63: *> \verbatim
                     64: *>          AP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
                     65: *>          On entry, the upper or lower triangle of the symmetric matrix
                     66: *>          A, packed columnwise in a linear array.  The j-th column of A
                     67: *>          is stored in the array AP as follows:
                     68: *>          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
                     69: *>          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
                     70: *>          See below for further details.
                     71: *>
                     72: *>          On exit, if INFO = 0, the triangular factor U or L from the
                     73: *>          Cholesky factorization A = U**T*U or A = L*L**T, in the same
                     74: *>          storage format as A.
                     75: *> \endverbatim
                     76: *>
                     77: *> \param[out] INFO
                     78: *> \verbatim
                     79: *>          INFO is INTEGER
                     80: *>          = 0:  successful exit
                     81: *>          < 0:  if INFO = -i, the i-th argument had an illegal value
                     82: *>          > 0:  if INFO = i, the leading minor of order i is not
                     83: *>                positive definite, and the factorization could not be
                     84: *>                completed.
                     85: *> \endverbatim
                     86: *
                     87: *  Authors:
                     88: *  ========
                     89: *
1.15      bertrand   90: *> \author Univ. of Tennessee
                     91: *> \author Univ. of California Berkeley
                     92: *> \author Univ. of Colorado Denver
                     93: *> \author NAG Ltd.
1.9       bertrand   94: *
1.15      bertrand   95: *> \date December 2016
1.9       bertrand   96: *
                     97: *> \ingroup doubleOTHERcomputational
                     98: *
                     99: *> \par Further Details:
                    100: *  =====================
                    101: *>
                    102: *> \verbatim
                    103: *>
                    104: *>  The packed storage scheme is illustrated by the following example
                    105: *>  when N = 4, UPLO = 'U':
                    106: *>
                    107: *>  Two-dimensional storage of the symmetric matrix A:
                    108: *>
                    109: *>     a11 a12 a13 a14
                    110: *>         a22 a23 a24
                    111: *>             a33 a34     (aij = aji)
                    112: *>                 a44
                    113: *>
                    114: *>  Packed storage of the upper triangle of A:
                    115: *>
                    116: *>  AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
                    117: *> \endverbatim
                    118: *>
                    119: *  =====================================================================
1.1       bertrand  120:       SUBROUTINE DPPTRF( UPLO, N, AP, INFO )
                    121: *
1.15      bertrand  122: *  -- LAPACK computational routine (version 3.7.0) --
1.1       bertrand  123: *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
                    124: *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
1.15      bertrand  125: *     December 2016
1.1       bertrand  126: *
                    127: *     .. Scalar Arguments ..
                    128:       CHARACTER          UPLO
                    129:       INTEGER            INFO, N
                    130: *     ..
                    131: *     .. Array Arguments ..
                    132:       DOUBLE PRECISION   AP( * )
                    133: *     ..
                    134: *
                    135: *  =====================================================================
                    136: *
                    137: *     .. Parameters ..
                    138:       DOUBLE PRECISION   ONE, ZERO
                    139:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
                    140: *     ..
                    141: *     .. Local Scalars ..
                    142:       LOGICAL            UPPER
                    143:       INTEGER            J, JC, JJ
                    144:       DOUBLE PRECISION   AJJ
                    145: *     ..
                    146: *     .. External Functions ..
                    147:       LOGICAL            LSAME
                    148:       DOUBLE PRECISION   DDOT
                    149:       EXTERNAL           LSAME, DDOT
                    150: *     ..
                    151: *     .. External Subroutines ..
                    152:       EXTERNAL           DSCAL, DSPR, DTPSV, XERBLA
                    153: *     ..
                    154: *     .. Intrinsic Functions ..
                    155:       INTRINSIC          SQRT
                    156: *     ..
                    157: *     .. Executable Statements ..
                    158: *
                    159: *     Test the input parameters.
                    160: *
                    161:       INFO = 0
                    162:       UPPER = LSAME( UPLO, 'U' )
                    163:       IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    164:          INFO = -1
                    165:       ELSE IF( N.LT.0 ) THEN
                    166:          INFO = -2
                    167:       END IF
                    168:       IF( INFO.NE.0 ) THEN
                    169:          CALL XERBLA( 'DPPTRF', -INFO )
                    170:          RETURN
                    171:       END IF
                    172: *
                    173: *     Quick return if possible
                    174: *
                    175:       IF( N.EQ.0 )
                    176:      $   RETURN
                    177: *
                    178:       IF( UPPER ) THEN
                    179: *
1.8       bertrand  180: *        Compute the Cholesky factorization A = U**T*U.
1.1       bertrand  181: *
                    182:          JJ = 0
                    183:          DO 10 J = 1, N
                    184:             JC = JJ + 1
                    185:             JJ = JJ + J
                    186: *
                    187: *           Compute elements 1:J-1 of column J.
                    188: *
                    189:             IF( J.GT.1 )
                    190:      $         CALL DTPSV( 'Upper', 'Transpose', 'Non-unit', J-1, AP,
                    191:      $                     AP( JC ), 1 )
                    192: *
                    193: *           Compute U(J,J) and test for non-positive-definiteness.
                    194: *
                    195:             AJJ = AP( JJ ) - DDOT( J-1, AP( JC ), 1, AP( JC ), 1 )
                    196:             IF( AJJ.LE.ZERO ) THEN
                    197:                AP( JJ ) = AJJ
                    198:                GO TO 30
                    199:             END IF
                    200:             AP( JJ ) = SQRT( AJJ )
                    201:    10    CONTINUE
                    202:       ELSE
                    203: *
1.8       bertrand  204: *        Compute the Cholesky factorization A = L*L**T.
1.1       bertrand  205: *
                    206:          JJ = 1
                    207:          DO 20 J = 1, N
                    208: *
                    209: *           Compute L(J,J) and test for non-positive-definiteness.
                    210: *
                    211:             AJJ = AP( JJ )
                    212:             IF( AJJ.LE.ZERO ) THEN
                    213:                AP( JJ ) = AJJ
                    214:                GO TO 30
                    215:             END IF
                    216:             AJJ = SQRT( AJJ )
                    217:             AP( JJ ) = AJJ
                    218: *
                    219: *           Compute elements J+1:N of column J and update the trailing
                    220: *           submatrix.
                    221: *
                    222:             IF( J.LT.N ) THEN
                    223:                CALL DSCAL( N-J, ONE / AJJ, AP( JJ+1 ), 1 )
                    224:                CALL DSPR( 'Lower', N-J, -ONE, AP( JJ+1 ), 1,
                    225:      $                    AP( JJ+N-J+1 ) )
                    226:                JJ = JJ + N - J + 1
                    227:             END IF
                    228:    20    CONTINUE
                    229:       END IF
                    230:       GO TO 40
                    231: *
                    232:    30 CONTINUE
                    233:       INFO = J
                    234: *
                    235:    40 CONTINUE
                    236:       RETURN
                    237: *
                    238: *     End of DPPTRF
                    239: *
                    240:       END

CVSweb interface <joel.bertrand@systella.fr>