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