1 | /* glphbm.h (Harwell-Boeing sparse matrix format) */ |
---|
2 | |
---|
3 | /*********************************************************************** |
---|
4 | * This code is part of GLPK (GNU Linear Programming Kit). |
---|
5 | * |
---|
6 | * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, |
---|
7 | * 2009, 2010 Andrew Makhorin, Department for Applied Informatics, |
---|
8 | * Moscow Aviation Institute, Moscow, Russia. All rights reserved. |
---|
9 | * E-mail: <mao@gnu.org>. |
---|
10 | * |
---|
11 | * GLPK is free software: you can redistribute it and/or modify it |
---|
12 | * under the terms of the GNU General Public License as published by |
---|
13 | * the Free Software Foundation, either version 3 of the License, or |
---|
14 | * (at your option) any later version. |
---|
15 | * |
---|
16 | * GLPK is distributed in the hope that it will be useful, but WITHOUT |
---|
17 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
---|
18 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
---|
19 | * License for more details. |
---|
20 | * |
---|
21 | * You should have received a copy of the GNU General Public License |
---|
22 | * along with GLPK. If not, see <http://www.gnu.org/licenses/>. |
---|
23 | ***********************************************************************/ |
---|
24 | |
---|
25 | #ifndef GLPHBM_H |
---|
26 | #define GLPHBM_H |
---|
27 | |
---|
28 | typedef struct HBM HBM; |
---|
29 | |
---|
30 | struct HBM |
---|
31 | { /* sparse matrix in Harwell-Boeing format; for details see the |
---|
32 | report: I.S.Duff, R.G.Grimes, J.G.Lewis. User's Guide for the |
---|
33 | Harwell-Boeing Sparse Matrix Collection (Release I), 1992 */ |
---|
34 | char title[72+1]; |
---|
35 | /* matrix title (informative) */ |
---|
36 | char key[8+1]; |
---|
37 | /* matrix key (informative) */ |
---|
38 | char mxtype[3+1]; |
---|
39 | /* matrix type: |
---|
40 | R.. real matrix |
---|
41 | C.. complex matrix |
---|
42 | P.. pattern only (no numerical values supplied) |
---|
43 | .S. symmetric (lower triangle + main diagonal) |
---|
44 | .U. unsymmetric |
---|
45 | .H. hermitian (lower triangle + main diagonal) |
---|
46 | .Z. skew symmetric (lower triangle only) |
---|
47 | .R. rectangular |
---|
48 | ..A assembled |
---|
49 | ..E elemental (unassembled) */ |
---|
50 | char rhstyp[3+1]; |
---|
51 | /* optional types: |
---|
52 | F.. right-hand sides in dense format |
---|
53 | M.. right-hand sides in same format as matrix |
---|
54 | .G. starting vector(s) (guess) is supplied |
---|
55 | ..X exact solution vector(s) is supplied */ |
---|
56 | char ptrfmt[16+1]; |
---|
57 | /* format for pointers */ |
---|
58 | char indfmt[16+1]; |
---|
59 | /* format for row (or variable) indices */ |
---|
60 | char valfmt[20+1]; |
---|
61 | /* format for numerical values of coefficient matrix */ |
---|
62 | char rhsfmt[20+1]; |
---|
63 | /* format for numerical values of right-hand sides */ |
---|
64 | int totcrd; |
---|
65 | /* total number of cards excluding header */ |
---|
66 | int ptrcrd; |
---|
67 | /* number of cards for ponters */ |
---|
68 | int indcrd; |
---|
69 | /* number of cards for row (or variable) indices */ |
---|
70 | int valcrd; |
---|
71 | /* number of cards for numerical values */ |
---|
72 | int rhscrd; |
---|
73 | /* number of lines for right-hand sides; |
---|
74 | including starting guesses and solution vectors if present; |
---|
75 | zero indicates no right-hand side data is present */ |
---|
76 | int nrow; |
---|
77 | /* number of rows (or variables) */ |
---|
78 | int ncol; |
---|
79 | /* number of columns (or elements) */ |
---|
80 | int nnzero; |
---|
81 | /* number of row (or variable) indices; |
---|
82 | equal to number of entries for assembled matrix */ |
---|
83 | int neltvl; |
---|
84 | /* number of elemental matrix entries; |
---|
85 | zero in case of assembled matrix */ |
---|
86 | int nrhs; |
---|
87 | /* number of right-hand sides */ |
---|
88 | int nrhsix; |
---|
89 | /* number of row indices; |
---|
90 | ignored in case of unassembled matrix */ |
---|
91 | int nrhsvl; |
---|
92 | /* total number of entries in all right-hand sides */ |
---|
93 | int nguess; |
---|
94 | /* total number of entries in all starting guesses */ |
---|
95 | int nexact; |
---|
96 | /* total number of entries in all solution vectors */ |
---|
97 | int *colptr; /* alias: eltptr */ |
---|
98 | /* column pointers (in case of assembled matrix); |
---|
99 | elemental matrix pointers (in case of unassembled matrix) */ |
---|
100 | int *rowind; /* alias: varind */ |
---|
101 | /* row indices (in case of assembled matrix); |
---|
102 | variable indices (in case of unassembled matrix) */ |
---|
103 | int *rhsptr; |
---|
104 | /* right-hand side pointers */ |
---|
105 | int *rhsind; |
---|
106 | /* right-hand side indices */ |
---|
107 | double *values; |
---|
108 | /* matrix values */ |
---|
109 | double *rhsval; |
---|
110 | /* right-hand side values */ |
---|
111 | double *sguess; |
---|
112 | /* starting guess values */ |
---|
113 | double *xexact; |
---|
114 | /* solution vector values */ |
---|
115 | }; |
---|
116 | |
---|
117 | #define hbm_read_mat _glp_hbm_read_mat |
---|
118 | HBM *hbm_read_mat(const char *fname); |
---|
119 | /* read sparse matrix in Harwell-Boeing format */ |
---|
120 | |
---|
121 | #define hbm_free_mat _glp_hbm_free_mat |
---|
122 | void hbm_free_mat(HBM *hbm); |
---|
123 | /* free sparse matrix in Harwell-Boeing format */ |
---|
124 | |
---|
125 | #endif |
---|
126 | |
---|
127 | /* eof */ |
---|