/[ascend]/trunk/base/generic/solver/densemtx.h
ViewVC logotype

Contents of /trunk/base/generic/solver/densemtx.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1131 - (show annotations) (download) (as text)
Sat Jan 13 12:47:44 2007 UTC (13 years, 6 months ago) by johnpye
File MIME type: text/x-chdr
File size: 2039 byte(s)
Fixing for MMIO absent
1 /* ASCEND modelling environment
2 Copyright (C) 2007 Carnegie Mellon University
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA.
18 *//**
19 Dense matrix module, as used by the LSODE Integrator in ASCEND.
20
21 @example
22 Usage of the DenseMatrix object:
23
24 @code
25 DenseMatrix M;
26 M = densmatrix_create(2,2);
27 DENSEMATRIX_ELEM(M,0,0) = 1;
28 DENSEMATRIX_ELEM(M,0,1) = 2;
29 DENSEMATRIX_ELEM(M,1,0) = 3;
30 DENSEMATRIX_ELEM(M,1,1) = 4;
31 densematrix_write_mmio(M,stdout);
32 densematrix_destroy(M);
33 @endcode
34
35 Represents the matrix
36
37 @code
38 [ 1, 2;
39 3, 4 ]
40 @code
41 @endexample
42 *//*
43 by John Pye, Jan 2007. Pulled out the routines from lsode.c and added
44 a file export function so that these matrices can be viewed using outside
45 tools.
46 */
47 #ifndef ASC_DENSEMTX_H
48 #define ASC_DENSEMTX_H
49
50 #include <stdio.h>
51
52 #include <utilities/config.h>
53
54 typedef struct DenseMatrixStruct{
55 double **data;
56 unsigned nrows;
57 unsigned ncols;
58 } DenseMatrix;
59
60 #define DENSEMATRIX_NROWS(M) ((M).nrows)
61 #define DENSEMATRIX_NCOLS(M) ((M).ncols)
62 #define DENSEMATRIX_ELEM(M,I,J) ((M).data[I][I])
63 #define DENSEMATRIX_DATA(M) ((M).data)
64 #define DENSEMATRIX_EMPTY (DenseMatrix){NULL,0,0}
65
66 DenseMatrix densematrix_create_empty();
67 DenseMatrix densematrix_create(unsigned nrows, unsigned ncols);
68 void densematrix_destroy(DenseMatrix matrix);
69
70 #ifdef ASC_WITH_MMIO
71 void densematrix_write_mmio(DenseMatrix matrix, FILE *fp);
72 #endif
73
74 #endif

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22