      program lapacktest
c
c     Paradeigma xrhshs twn DPPTRF kai DPPTRS
c     Lynoume to systhma A_n(1,4) x = b, me dexi melos b=(1,1,...,1)
c
      implicit double precision (a-h, o-z)
      parameter (LDA = 40)
      double precision ap((LDA*(LDA+1))/2), b(LDA)
c
c     Kataskeuh tou pinaka AP
c
      c = 1.0d0
      d = 4.0d0

      n = 10
c
      k = 1
      ap(k) = d
      k = k + 1

      do j=2, n
         do i=1, j-2
            ap(k) = 0.0d0
            k = k + 1
         enddo

         ap(k) = c
         k = k + 1

         ap(k) = d
         k = k + 1
      enddo
c
c     Klhsh ths DPPTRF gia thn analysh Cholesky
c
      call dpptrf('U', n, ap, info)

      if (info .lt. 0) then
         print*, 'To ', i, 'orisma eixe mh epitrepth timh'
         stop
      else if (info .gt. 0) then
         print*, 'O ypopinakas taxhs ', i, ' den einai 8etika orismenos'
         stop
      endif
c
c     Kataskeuh tou dexiou melous kai lysh tou systhmatos
c
      do i=1, n
         b(i) = 1.0d0
      enddo
c
      LDB  = LDA
      NRHS = 1

      call dpptrs('U', n, NRHS, ap, b, LDB, info)
c
      if (info .lt. 0) then
         print*, 'To ', i, 'orisma eixe mh epitrepth timh'
         stop
      endif
c
      print*, 'Lysh tou systhmatos'
      write(6,10) (b(i), i=1, n)
 10   format(3d16.9)
c
      stop
      end
