kusano 7d535a
      program f77_main
kusano 7d535a
      integer maxn, maxnz
kusano 7d535a
      parameter ( maxn = 10000, maxnz = 100000 )
kusano 7d535a
      integer rowind(maxnz), colptr(maxn)
kusano 7d535a
      real*8  values(maxnz), b(maxn)
kusano 7d535a
      integer n, nnz, nrhs, ldb, info, iopt
kusano 7d535a
      integer*8 factors
kusano 7d535a
*
kusano 7d535a
      call hbcode1(n, n, nnz, values, rowind, colptr)
kusano 7d535a
*
kusano 7d535a
      nrhs = 1
kusano 7d535a
      ldb = n
kusano 7d535a
      do i = 1, n
kusano 7d535a
         b(i) = 1
kusano 7d535a
      enddo
kusano 7d535a
*
kusano 7d535a
* First, factorize the matrix. The factors are stored in *factors* handle.
kusano 7d535a
      iopt = 1
kusano 7d535a
      call c_fortran_dgssv( iopt, n, nnz, nrhs, values, rowind, colptr, 
kusano 7d535a
     $                      b, ldb, factors, info )
kusano 7d535a
*
kusano 7d535a
      if (info .eq. 0) then
kusano 7d535a
         write (*,*) 'Factorization succeeded'
kusano 7d535a
      else
kusano 7d535a
         write(*,*) 'INFO from factorization = ', info
kusano 7d535a
      endif
kusano 7d535a
*
kusano 7d535a
* Second, solve the system using the existing factors.
kusano 7d535a
      iopt = 2
kusano 7d535a
      call c_fortran_dgssv( iopt, n, nnz, nrhs, values, rowind, colptr, 
kusano 7d535a
     $                      b, ldb, factors, info )
kusano 7d535a
*
kusano 7d535a
      if (info .eq. 0) then
kusano 7d535a
         write (*,*) 'Solve succeeded'
kusano 7d535a
         write (*,*) (b(i), i=1, 10)
kusano 7d535a
      else
kusano 7d535a
         write(*,*) 'INFO from triangular solve = ', info
kusano 7d535a
      endif
kusano 7d535a
kusano 7d535a
* Last, free the storage allocated inside SuperLU
kusano 7d535a
      iopt = 3
kusano 7d535a
      call c_fortran_dgssv( iopt, n, nnz, nrhs, values, rowind, colptr, 
kusano 7d535a
     $                      b, ldb, factors, info )
kusano 7d535a
*
kusano 7d535a
      stop
kusano 7d535a
      end
kusano 7d535a
kusano 7d535a