kusano 7d535a
      subroutine hbcode1(nrow, ncol, nnzero, values, rowind, colptr)
kusano 7d535a
kusano 7d535a
C     ================================================================
kusano 7d535a
C     ... SAMPLE CODE FOR READING A SPARSE MATRIX IN STANDARD FORMAT
kusano 7d535a
C     ================================================================
kusano 7d535a
kusano 7d535a
      CHARACTER      TITLE*72 , KEY*8    , MXTYPE*3 ,
kusano 7d535a
     1               PTRFMT*16, INDFMT*16, VALFMT*20, RHSFMT*20
kusano 7d535a
kusano 7d535a
      INTEGER        TOTCRD, PTRCRD, INDCRD, VALCRD, RHSCRD,
kusano 7d535a
     1               NROW  , NCOL  , NNZERO, NELTVL
kusano 7d535a
kusano 7d535a
      INTEGER        COLPTR (*), ROWIND (*)
kusano 7d535a
kusano 7d535a
      REAL*8         VALUES (*)
kusano 7d535a
kusano 7d535a
C    ------------------------
kusano 7d535a
C     ... READ IN HEADER BLOCK
kusano 7d535a
C     ------------------------
kusano 7d535a
kusano 7d535a
      READ ( *, 1000 ) TITLE , KEY   ,
kusano 7d535a
     1                     TOTCRD, PTRCRD, INDCRD, VALCRD, RHSCRD,
kusano 7d535a
     2                     MXTYPE, NROW  , NCOL  , NNZERO, NELTVL,
kusano 7d535a
     3                     PTRFMT, INDFMT, VALFMT, RHSFMT
kusano 7d535a
 1000 FORMAT ( A72, A8 / 5I14 / A3, 11X, 4I14 / 2A16, 2A20 )
kusano 7d535a
kusano 7d535a
C     -------------------------
kusano 7d535a
C     ... READ MATRIX STRUCTURE
kusano 7d535a
C     -------------------------
kusano 7d535a
kusano 7d535a
      READ ( *, PTRFMT ) ( COLPTR (I), I = 1, NCOL+1 )
kusano 7d535a
kusano 7d535a
      READ ( *, INDFMT ) ( ROWIND (I), I = 1, NNZERO )
kusano 7d535a
kusano 7d535a
      IF  ( VALCRD .GT. 0 )  THEN
kusano 7d535a
kusano 7d535a
C         ----------------------
kusano 7d535a
C         ... READ MATRIX VALUES
kusano 7d535a
C         ----------------------
kusano 7d535a
kusano 7d535a
          READ ( *, VALFMT ) ( VALUES (I), I = 1, NNZERO )
kusano 7d535a
kusano 7d535a
      ENDIF
kusano 7d535a
kusano 7d535a
      return
kusano 7d535a
      end