# cchdc.f

          SUBROUTINE CCHDC (A, LDA, P, WORK, JPVT, JOB, INFO)
    C***BEGIN PROLOGUE  CCHDC
    C***PURPOSE  Compute the Cholesky decomposition of a positive definite
    C            matrix.  A pivoting option allows the user to estimate the
    C            condition number of a positive definite matrix or determine
    C            the rank of a positive semidefinite matrix.
    C***LIBRARY   SLATEC (LINPACK)
    C***CATEGORY  D2D1B
    C***TYPE      COMPLEX (SCHDC-S, DCHDC-D, CCHDC-C)
    C***KEYWORDS  CHOLESKY DECOMPOSITION, LINEAR ALGEBRA, LINPACK, MATRIX,
    C             POSITIVE DEFINITE
    C***AUTHOR  Dongarra, J., (ANL)
    C           Stewart, G. W., (U. of Maryland)
    C***DESCRIPTION
    C
    C     CCHDC computes the Cholesky decomposition of a positive definite
    C     matrix.  A pivoting option allows the user to estimate the
    C     condition of a positive definite matrix or determine the rank
    C     of a positive semidefinite matrix.
    C
    C     On Entry
    C
    C         A      COMPLEX(LDA,P).
    C                A contains the matrix whose decomposition is to
    C                be computed.  Only the upper half of A need be stored.
    C                The lower part of The array A is not referenced.
    C
    C         LDA    INTEGER.
    C                LDA is the leading dimension of the array A.
    C
    C         P      INTEGER.
    C                P is the order of the matrix.
    C
    C         WORK   COMPLEX.
    C                WORK is a work array.
    C
    C         JPVT   INTEGER(P).
    C                JPVT contains integers that control the selection
    C                of the pivot elements, if pivoting has been requested.
    C                Each diagonal element A(K,K)
    C                is placed in one of three classes according to the
    C                value of JPVT(K)).
    C
    C                   If JPVT(K)) .GT. 0, then X(K) is an initial
    C                                      element.
    C
    C                   If JPVT(K)) .EQ. 0, then X(K) is a free element.
    C
    C                   If JPVT(K)) .LT. 0, then X(K) is a final element.
    C
    C                Before the decomposition is computed, initial elements
    C                are moved by symmetric row and column interchanges to
    C                the beginning of the array A and final
    C                elements to the end.  Both initial and final elements
    C                are frozen in place during the computation and only
    C                free elements are moved.  At the K-th stage of the
    C                reduction, if A(K,K) is occupied by a free element
    C                it is interchanged with the largest free element
    C                A(L,L) with L .GE. K.  JPVT is not referenced if
    C                JOB .EQ. 0.
    C
    C        JOB     INTEGER.
    C                JOB is an integer that initiates column pivoting.
    C                IF JOB .EQ. 0, no pivoting is done.
    C                IF JOB .NE. 0, pivoting is done.
    C
    C     On Return
    C
    C         A      A contains in its upper half the Cholesky factor
    C                of the matrix A as it has been permuted by pivoting.
    C
    C         JPVT   JPVT(J) contains the index of the diagonal element
    C                of A that was moved into the J-th position,
    C                provided pivoting was requested.
    C
    C         INFO   contains the index of the last positive diagonal
    C                element of the Cholesky factor.
    C
    C     For positive definite matrices INFO = P is the normal return.
    C     For pivoting with positive semidefinite matrices INFO will
    C     in general be less than P.  However, INFO may be greater than
    C     the rank of A, since rounding error can cause an otherwise zero
    C     element to be positive.  Indefinite systems will always cause
    C     INFO to be less than P.
    C
    C***REFERENCES  J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
    C                 Stewart, LINPACK Users' Guide, SIAM, 1979.
    C***ROUTINES CALLED  CAXPY, CSWAP
    C***REVISION HISTORY  (YYMMDD)
    C   790319  DATE WRITTEN
    C   890831  Modified array declarations.  (WRB)
    C   890831  REVISION DATE from Version 3.2
    C   891214  Prologue converted to Version 4.0 format.  (BAB)
    C   900326  Removed duplicate information from DESCRIPTION section.
    C           (WRB)
    C   920501  Reformatted the REFERENCES section.  (WRB)
    C***END PROLOGUE  CCHDC