Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
transitionStructure
sparseMatrix.h
1
/* Marmote is free software: you can redistribute it and/or modify
2
it under the terms of the GNU General Public License as published by
3
the Free Software Foundation, either version 3 of the License, or
4
(at your option) any later version.
5
6
Marmote is distributed in the hope that it will be useful,
7
but WITHOUT ANY WARRANTY; without even the implied warranty of
8
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
GNU General Public License for more details.
10
11
You should have received a copy of the GNU General Public License
12
along with Marmote. If not, see <http://www.gnu.org/licenses/>.
13
14
Copyright 2015 Alain Jean-Marie, Jean-Michel Fourneau, Jean-Marc Vincent, Issam Rabhi */
15
16
#ifndef SPARSEMATRIX_H
17
#define SPARSEMATRIX_H
18
19
#include "transitionStructure.h"
20
29
class
sparseMatrix
:
public
transitionStructure
30
{
31
32
private
:
33
// specific variables of the class
34
int
* _nbElts;
35
int
** _elts;
36
double
** _vals;
37
bool
_debug;
39
public
:
40
// constructors
47
sparseMatrix
(
int
size
);
48
49
// destructor
53
~sparseMatrix
();
54
55
public
:
70
bool
setEntry
(
int
row,
int
col,
double
val);
// set A[i,j]
78
double
getEntry
(
int
,
int
);
// get A[i,j]
85
int
getNbElts
(
int
row);
// get the number of entries in row i
92
int
getCol
(
int
row,
int
numCol );
// get the jth column for row i
99
double
getEntryByCol
(
int
row,
int
numCol);
// get the value in the jth column for row i
106
discreteDistribution
*
getTransDistrib
(
int
row);
// transitions from some state
113
double
rowSum
(
int
row);
121
void
evaluateMeasure
(
double
* m,
double
* res);
128
void
evaluateMeasure
(
discreteDistribution
* d,
discreteDistribution
* res);
136
void
evaluateValue
(
double
* v,
double
* res);
137
138
public
:
145
sparseMatrix
*
copy
();
153
sparseMatrix
*
uniformize
();
154
155
public
:
164
void
write
(FILE* out, std::string format);
165
166
// methods specific to this class
175
bool
addToEntry
(
int
row,
int
col,
double
val);
// add to A[i,j]
176
177
private
:
178
// specific technical methods
190
int
consolidate(
int
i,
int
* destinations,
double
* values);
191
};
192
193
#endif // SPARSEMATRIX_H
Generated on Thu May 21 2015 17:06:41 for Marmote Core by
1.8.3.1