    Program f07jdfe

!     F07JDF Example Program Text

!     Mark 24 Release. NAG Copyright 2012.

!     .. Use Statements ..
      Use nag_library, Only: dpttrf, nag_wp
!     .. Implicit None Statement ..
      Implicit None
!     .. Parameters ..
      Integer, Parameter               :: nin = 5, nout = 6
!     .. Local Scalars ..
      Integer                          :: info, n
!     .. Local Arrays ..
      Real (Kind=nag_wp), Allocatable  :: d(:), e(:)
!     .. Executable Statements ..
      Write (nout,*) 'F07JDF Example Program Results'
      Write (nout,*)
!     Skip heading in data file
      Read (nin,*)
      Read (nin,*) n

      Allocate (d(n),e(n-1))

!     Read the lower bidiagonal part of the tridiagonal matrix A from
!     data file

      Read (nin,*) d(1:n)
      Read (nin,*) e(1:n-1)

!     Factorize the tridiagonal matrix A

!     The NAG name equivalent of dpttrf is f07jdf
      Call dpttrf(n,d,e,info)

      If (info>0) Then
        Write (nout,99999) 'The leading minor of order ', info, &
          ' is not positive definite'
      End If

!     Print details of the factorization

      Write (nout,*) 'Details of factorization'
      Write (nout,*)
      Write (nout,*) ' The diagonal elements of D'
      Write (nout,99998) d(1:n)
      Write (nout,*)
      Write (nout,*) ' Sub-diagonal elements of the Cholesky factor L'
      Write (nout,99998) e(1:n-1)

99999 Format (1X,A,I3,A)
99998 Format (1X,8F9.4)
    End Program f07jdfe
