readhb_size.f
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
c=======================================================================
c== readhb_size ========================================================
c=======================================================================
c-----------------------------------------------------------------------
c UMFPACK Version 4.4, Copyright (c) 2005 by Timothy A. Davis. CISE
c Dept, Univ. of Florida. All Rights Reserved. See ../Doc/License for
c License. web: http://www.cise.ufl.edu/research/sparse/umfpack
c-----------------------------------------------------------------------
c readhb_size:
c read a sparse matrix in the Harwell/Boeing format and output the
c size of the matrix (# rows, # columns, and # of entries)
c
c usage (for example):
c
c readhb_size < HB/arc130.rua > tmp/Asize
integer nz, totcrd, ptrcrd,
$ indcrd, valcrd, rhscrd, ncol, nrow, nrhs
character title*72, key*30, type*3, ptrfmt*16,
$ indfmt*16, valfmt*20, rhsfmt*20
character rhstyp*3
integer nzrhs, nel
c-----------------------------------------------------------------------
c read header information from Harwell/Boeing matrix
read (5, 10, err = 998)
$ title, key,
$ totcrd, ptrcrd, indcrd, valcrd, rhscrd,
$ type, nrow, ncol, nz, nel,
$ ptrfmt, indfmt, valfmt, rhsfmt
if (rhscrd .gt. 0) then
c new Harwell/Boeing format:
read (5, 20, err = 998) rhstyp,nrhs,nzrhs
endif
10 format (a72, a8 / 5i14 / a3, 11x, 4i14 / 2a16, 2a20)
20 format (a3, 11x, 2i14)
write (6, *) nrow, ncol, nz
stop
998 write (0, *) 'Read error'
stop
end