1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/glphbm.h Mon Dec 06 13:09:21 2010 +0100
1.3 @@ -0,0 +1,127 @@
1.4 +/* glphbm.h (Harwell-Boeing sparse matrix format) */
1.5 +
1.6 +/***********************************************************************
1.7 +* This code is part of GLPK (GNU Linear Programming Kit).
1.8 +*
1.9 +* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
1.10 +* 2009, 2010 Andrew Makhorin, Department for Applied Informatics,
1.11 +* Moscow Aviation Institute, Moscow, Russia. All rights reserved.
1.12 +* E-mail: <mao@gnu.org>.
1.13 +*
1.14 +* GLPK is free software: you can redistribute it and/or modify it
1.15 +* under the terms of the GNU General Public License as published by
1.16 +* the Free Software Foundation, either version 3 of the License, or
1.17 +* (at your option) any later version.
1.18 +*
1.19 +* GLPK is distributed in the hope that it will be useful, but WITHOUT
1.20 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1.21 +* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
1.22 +* License for more details.
1.23 +*
1.24 +* You should have received a copy of the GNU General Public License
1.25 +* along with GLPK. If not, see <http://www.gnu.org/licenses/>.
1.26 +***********************************************************************/
1.27 +
1.28 +#ifndef GLPHBM_H
1.29 +#define GLPHBM_H
1.30 +
1.31 +typedef struct HBM HBM;
1.32 +
1.33 +struct HBM
1.34 +{ /* sparse matrix in Harwell-Boeing format; for details see the
1.35 + report: I.S.Duff, R.G.Grimes, J.G.Lewis. User's Guide for the
1.36 + Harwell-Boeing Sparse Matrix Collection (Release I), 1992 */
1.37 + char title[72+1];
1.38 + /* matrix title (informative) */
1.39 + char key[8+1];
1.40 + /* matrix key (informative) */
1.41 + char mxtype[3+1];
1.42 + /* matrix type:
1.43 + R.. real matrix
1.44 + C.. complex matrix
1.45 + P.. pattern only (no numerical values supplied)
1.46 + .S. symmetric (lower triangle + main diagonal)
1.47 + .U. unsymmetric
1.48 + .H. hermitian (lower triangle + main diagonal)
1.49 + .Z. skew symmetric (lower triangle only)
1.50 + .R. rectangular
1.51 + ..A assembled
1.52 + ..E elemental (unassembled) */
1.53 + char rhstyp[3+1];
1.54 + /* optional types:
1.55 + F.. right-hand sides in dense format
1.56 + M.. right-hand sides in same format as matrix
1.57 + .G. starting vector(s) (guess) is supplied
1.58 + ..X exact solution vector(s) is supplied */
1.59 + char ptrfmt[16+1];
1.60 + /* format for pointers */
1.61 + char indfmt[16+1];
1.62 + /* format for row (or variable) indices */
1.63 + char valfmt[20+1];
1.64 + /* format for numerical values of coefficient matrix */
1.65 + char rhsfmt[20+1];
1.66 + /* format for numerical values of right-hand sides */
1.67 + int totcrd;
1.68 + /* total number of cards excluding header */
1.69 + int ptrcrd;
1.70 + /* number of cards for ponters */
1.71 + int indcrd;
1.72 + /* number of cards for row (or variable) indices */
1.73 + int valcrd;
1.74 + /* number of cards for numerical values */
1.75 + int rhscrd;
1.76 + /* number of lines for right-hand sides;
1.77 + including starting guesses and solution vectors if present;
1.78 + zero indicates no right-hand side data is present */
1.79 + int nrow;
1.80 + /* number of rows (or variables) */
1.81 + int ncol;
1.82 + /* number of columns (or elements) */
1.83 + int nnzero;
1.84 + /* number of row (or variable) indices;
1.85 + equal to number of entries for assembled matrix */
1.86 + int neltvl;
1.87 + /* number of elemental matrix entries;
1.88 + zero in case of assembled matrix */
1.89 + int nrhs;
1.90 + /* number of right-hand sides */
1.91 + int nrhsix;
1.92 + /* number of row indices;
1.93 + ignored in case of unassembled matrix */
1.94 + int nrhsvl;
1.95 + /* total number of entries in all right-hand sides */
1.96 + int nguess;
1.97 + /* total number of entries in all starting guesses */
1.98 + int nexact;
1.99 + /* total number of entries in all solution vectors */
1.100 + int *colptr; /* alias: eltptr */
1.101 + /* column pointers (in case of assembled matrix);
1.102 + elemental matrix pointers (in case of unassembled matrix) */
1.103 + int *rowind; /* alias: varind */
1.104 + /* row indices (in case of assembled matrix);
1.105 + variable indices (in case of unassembled matrix) */
1.106 + int *rhsptr;
1.107 + /* right-hand side pointers */
1.108 + int *rhsind;
1.109 + /* right-hand side indices */
1.110 + double *values;
1.111 + /* matrix values */
1.112 + double *rhsval;
1.113 + /* right-hand side values */
1.114 + double *sguess;
1.115 + /* starting guess values */
1.116 + double *xexact;
1.117 + /* solution vector values */
1.118 +};
1.119 +
1.120 +#define hbm_read_mat _glp_hbm_read_mat
1.121 +HBM *hbm_read_mat(const char *fname);
1.122 +/* read sparse matrix in Harwell-Boeing format */
1.123 +
1.124 +#define hbm_free_mat _glp_hbm_free_mat
1.125 +void hbm_free_mat(HBM *hbm);
1.126 +/* free sparse matrix in Harwell-Boeing format */
1.127 +
1.128 +#endif
1.129 +
1.130 +/* eof */