/[ascend]/trunk/ascend/linear/densemtx.h
ViewVC logotype

Annotation of /trunk/ascend/linear/densemtx.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2064 - (hide annotations) (download) (as text)
Mon Jul 6 12:03:36 2009 UTC (11 years, 1 month ago) by jpye
File MIME type: text/x-chdr
File size: 2268 byte(s)
Trying to solve some bugs with sensitivity external method.
1 johnpye 1128 /* ASCEND modelling environment
2 johnpye 1129 Copyright (C) 2007 Carnegie Mellon University
3 johnpye 1128
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 johnpye 1221 *//** @file
19 johnpye 1128 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 johnpye 1174
35 johnpye 1128 Represents the matrix
36 johnpye 1174
37 johnpye 1128 @code
38     [ 1, 2;
39     3, 4 ]
40     @code
41 johnpye 1174 @endexample
42 johnpye 1128 *//*
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 johnpye 1174
47     Also using these routines in the external methods 'finitediff' and 'sensitivity'.
48 johnpye 1128 */
49     #ifndef ASC_DENSEMTX_H
50     #define ASC_DENSEMTX_H
51    
52     #include <stdio.h>
53    
54 jpye 2018 #include <ascend/utilities/config.h>
55     #include <ascend/utilities/ascConfig.h>
56 johnpye 1131
57 johnpye 1221 /** @addtogroup linear Linear
58     @{
59     */
60    
61 johnpye 1128 typedef struct DenseMatrixStruct{
62     double **data;
63     unsigned nrows;
64     unsigned ncols;
65     } DenseMatrix;
66    
67 johnpye 1129 #define DENSEMATRIX_NROWS(M) ((M).nrows)
68     #define DENSEMATRIX_NCOLS(M) ((M).ncols)
69 johnpye 1221 #define DENSEMATRIX_ELEM(M,I,J) ((M).data[I][J])
70 johnpye 1129 #define DENSEMATRIX_DATA(M) ((M).data)
71     #define DENSEMATRIX_EMPTY (DenseMatrix){NULL,0,0}
72 johnpye 1128
73 jpye 2064 ASC_DLLSPEC DenseMatrix densematrix_create_empty();
74 johnpye 1174 ASC_DLLSPEC DenseMatrix densematrix_create(unsigned nrows, unsigned ncols);
75     ASC_DLLSPEC void densematrix_destroy(DenseMatrix matrix);
76 johnpye 1131
77     #ifdef ASC_WITH_MMIO
78 jpye 1509 ASC_DLLSPEC void densematrix_write_mmio(DenseMatrix matrix, FILE *fp);
79 johnpye 1131 #endif
80 johnpye 1128
81 johnpye 1221 /* @} */
82    
83 johnpye 1128 #endif

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