        program test1
c using LAPACK general matrix inverse
        implicit double precision (a-h, o-z)
        parameter (n=1000)
        parameter (phi=0.5d0)
        dimension x(n,n), ipiv(n), work(n)
        real cpuStart, delta
        
        cpuStart = secnds(0.0)
        
        do i = 1, n
            do j = 1, n
                x(i,j) = phi**iabs(i-j)
            enddo
        enddo

        call dgetrf(n,n,x,n,ipiv,info)
        call dgetri(n,x,n,ipiv,work,n,info)

        delta = secnds(cpuStart)
        tr = 0.0d0
        do i = 1, n
                tr = tr + x(i,i)
        enddo
        write(06, 1)tr
 1      format(" trace of inverse = ",1pe20.10)
        write(06, 2)delta
 2      format("  cpu time for matrix inverse = ", f10.3)
        end
