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