alpar@1: /* glphbm.h (Harwell-Boeing sparse matrix format) */ alpar@1: alpar@1: /*********************************************************************** alpar@1: * This code is part of GLPK (GNU Linear Programming Kit). alpar@1: * alpar@1: * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, alpar@1: * 2009, 2010 Andrew Makhorin, Department for Applied Informatics, alpar@1: * Moscow Aviation Institute, Moscow, Russia. All rights reserved. alpar@1: * E-mail: . alpar@1: * alpar@1: * GLPK is free software: you can redistribute it and/or modify it alpar@1: * under the terms of the GNU General Public License as published by alpar@1: * the Free Software Foundation, either version 3 of the License, or alpar@1: * (at your option) any later version. alpar@1: * alpar@1: * GLPK is distributed in the hope that it will be useful, but WITHOUT alpar@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY alpar@1: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public alpar@1: * License for more details. alpar@1: * alpar@1: * You should have received a copy of the GNU General Public License alpar@1: * along with GLPK. If not, see . alpar@1: ***********************************************************************/ alpar@1: alpar@1: #ifndef GLPHBM_H alpar@1: #define GLPHBM_H alpar@1: alpar@1: typedef struct HBM HBM; alpar@1: alpar@1: struct HBM alpar@1: { /* sparse matrix in Harwell-Boeing format; for details see the alpar@1: report: I.S.Duff, R.G.Grimes, J.G.Lewis. User's Guide for the alpar@1: Harwell-Boeing Sparse Matrix Collection (Release I), 1992 */ alpar@1: char title[72+1]; alpar@1: /* matrix title (informative) */ alpar@1: char key[8+1]; alpar@1: /* matrix key (informative) */ alpar@1: char mxtype[3+1]; alpar@1: /* matrix type: alpar@1: R.. real matrix alpar@1: C.. complex matrix alpar@1: P.. pattern only (no numerical values supplied) alpar@1: .S. symmetric (lower triangle + main diagonal) alpar@1: .U. unsymmetric alpar@1: .H. hermitian (lower triangle + main diagonal) alpar@1: .Z. skew symmetric (lower triangle only) alpar@1: .R. rectangular alpar@1: ..A assembled alpar@1: ..E elemental (unassembled) */ alpar@1: char rhstyp[3+1]; alpar@1: /* optional types: alpar@1: F.. right-hand sides in dense format alpar@1: M.. right-hand sides in same format as matrix alpar@1: .G. starting vector(s) (guess) is supplied alpar@1: ..X exact solution vector(s) is supplied */ alpar@1: char ptrfmt[16+1]; alpar@1: /* format for pointers */ alpar@1: char indfmt[16+1]; alpar@1: /* format for row (or variable) indices */ alpar@1: char valfmt[20+1]; alpar@1: /* format for numerical values of coefficient matrix */ alpar@1: char rhsfmt[20+1]; alpar@1: /* format for numerical values of right-hand sides */ alpar@1: int totcrd; alpar@1: /* total number of cards excluding header */ alpar@1: int ptrcrd; alpar@1: /* number of cards for ponters */ alpar@1: int indcrd; alpar@1: /* number of cards for row (or variable) indices */ alpar@1: int valcrd; alpar@1: /* number of cards for numerical values */ alpar@1: int rhscrd; alpar@1: /* number of lines for right-hand sides; alpar@1: including starting guesses and solution vectors if present; alpar@1: zero indicates no right-hand side data is present */ alpar@1: int nrow; alpar@1: /* number of rows (or variables) */ alpar@1: int ncol; alpar@1: /* number of columns (or elements) */ alpar@1: int nnzero; alpar@1: /* number of row (or variable) indices; alpar@1: equal to number of entries for assembled matrix */ alpar@1: int neltvl; alpar@1: /* number of elemental matrix entries; alpar@1: zero in case of assembled matrix */ alpar@1: int nrhs; alpar@1: /* number of right-hand sides */ alpar@1: int nrhsix; alpar@1: /* number of row indices; alpar@1: ignored in case of unassembled matrix */ alpar@1: int nrhsvl; alpar@1: /* total number of entries in all right-hand sides */ alpar@1: int nguess; alpar@1: /* total number of entries in all starting guesses */ alpar@1: int nexact; alpar@1: /* total number of entries in all solution vectors */ alpar@1: int *colptr; /* alias: eltptr */ alpar@1: /* column pointers (in case of assembled matrix); alpar@1: elemental matrix pointers (in case of unassembled matrix) */ alpar@1: int *rowind; /* alias: varind */ alpar@1: /* row indices (in case of assembled matrix); alpar@1: variable indices (in case of unassembled matrix) */ alpar@1: int *rhsptr; alpar@1: /* right-hand side pointers */ alpar@1: int *rhsind; alpar@1: /* right-hand side indices */ alpar@1: double *values; alpar@1: /* matrix values */ alpar@1: double *rhsval; alpar@1: /* right-hand side values */ alpar@1: double *sguess; alpar@1: /* starting guess values */ alpar@1: double *xexact; alpar@1: /* solution vector values */ alpar@1: }; alpar@1: alpar@1: #define hbm_read_mat _glp_hbm_read_mat alpar@1: HBM *hbm_read_mat(const char *fname); alpar@1: /* read sparse matrix in Harwell-Boeing format */ alpar@1: alpar@1: #define hbm_free_mat _glp_hbm_free_mat alpar@1: void hbm_free_mat(HBM *hbm); alpar@1: /* free sparse matrix in Harwell-Boeing format */ alpar@1: alpar@1: #endif alpar@1: alpar@1: /* eof */