      SUBROUTINE SLLTK( N, A, LDA, INFO )
c  -- Modified LAPACK routine --
c     Northeast Parallel Arctitecture Center, Syracuse Univ.
c     April 5, 1992
c
c     NOTES
c     =====
c     In this version we simply rewrote the subprogram with NO changes
c     to the original algorithm. The original LAPACK header
c     documentation is included below.  The reader should also note that
c     any code which appears in UPPERCASE is original LAPACK code. Only
c     the code in lowercase is new code.
c

*
*  -- LAPACK variant --
*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
*     Courant Institute, Argonne National Lab, and Rice University
*     August 6, 1991
*
*     .. Scalar Arguments ..
      INTEGER            INFO, LDA, N
*     ..
*     .. Array Arguments ..
c     REAL               A( LDA, * )
c     ..
      real               A(LDA,N)
*     ..
*
*  Purpose
*  =======
*
*  SLLTK  computes an L*L**T factorization of a real symmetric
*  positive definite matrix A.
*
*  This is the unblocked right-looking (k-variant) of the algorithm.
*
*  Arguments
*  =========
*
*  N       (input) INTEGER
*          The order of the matrix A.  N >= 0.
*
*  A       (input/output) REAL array, dimension (LDA,N)
*          On entry, the symmetric matrix A.  Only the lower triangular
*          part of A is referenced.
*          On exit, the factor L from the Cholesky factorization.
*
*  LDA     (input) INTEGER
*          The leading dimension of the array A.  LDA >= max(1,N).
*
*  INFO    (output) INTEGER
*          = 0: successful exit
*          < 0: if INFO = -k, the k-th argument had an illegal value
*          > 0: if INFO = k, the leading minor of order k is not
*               positive definite, and the factorization could not be
*               completed.
*
*  =====================================================================
*
*     .. Parameters ..
      REAL               ONE, ZERO
      PARAMETER          ( ONE = 1.0E+0, ZERO = 0.0E+0 )
*     ..
*     .. Local Scalars ..
      INTEGER            K
c     ..
c     .. new local scalar
      real               diag
*     ..
*     .. External Subroutines ..
c     EXTERNAL           SSCAL, SSYR, XERBLA
c     ..
      external           XERBLA
*     ..
*     .. Intrinsic Functions ..
      INTRINSIC          MAX, SQRT
*     ..
*     .. Executable Statements ..
*
      INFO = 0
      IF( N.LT.0 ) THEN
         INFO = -1
      ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
         INFO = -3
      END IF
      IF( INFO.NE.0 ) THEN
         CALL XERBLA( 'SLLTK ', -INFO )
         RETURN
      END IF
*
      DO 10 K = 1, N
         IF( A( K, K ).LE.ZERO )
     $      GO TO 20
         A( K, K ) = SQRT( A( K, K ) )
         IF( K.LT.N ) THEN
c----------------------------------------------------------------------
c
c           CALL SSCAL( N-K, ONE / A( K, K ), A( K+1, K ), 1 )
c
c***********************************************************************
c        SSCAL F90 code
c***********************************************************************
c
         diag = A(K,K)
         A(K+1:N,K) = A(K+1:N,K) / diag
c
c======================================================================

c----------------------------------------------------------------------
c
c           CALL SSYR( 'Lower', N-K, -ONE, A( K+1, K ), 1,
c    $                 A( K+1, K+1 ), LDA )
c
c***********************************************************************
c        SSYR F90 code
c***********************************************************************
c
         A(K+1:N,K+1:N) = A(K+1:N,K+1:N) -  
     $           spread(A(K+1:N,K), dim=1, ncopies=N-K)
     $           * spread(A(K+1:N,K), dim=2, ncopies=N-K)
c
c======================================================================

         END IF
   10 CONTINUE
      RETURN
   20 CONTINUE
      INFO = K
      RETURN
*
*     End of SLLTK
*
      END
