Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
alias.h
Go to the documentation of this file.
1 
2 /* Copyright(C) (2002) (ID - IMAG) <Florent.Morata@imag.fr> */
3 
4 /*
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  */
19 
20 
29 #ifndef _ALIAS_H_
30 #define _ALIAS_H_
31 
32 #include <vector>
33 #include <string>
34 #include <fstream>
35 #include <cmath>
36 
38 using namespace std;
39 
40 #include "../transitionStructure/sparseMatrix.h"
41 #include "hbf.h"
42 
44 const double EPS = 1e-12;
45 
47 typedef vector<int>::iterator iteri;
49 typedef vector<double>::iterator iterd;
50 
52 typedef double Threshold;
54 typedef int Index;
55 
56 
62 class Alias{
63  private:
67  struct AliasStruct{
69  Threshold t;
71  Index col;
73  Index alias;
74  };
75 
77  typedef struct AliasStruct stock;
79  vector<stock> S;
81  HBF* _matrix;
82  // Constructors
83  public:
88  Alias( sparseMatrix* mat );
89 
93  ~Alias();
94 
95  public:
96 
97  int size() const;
98  double threshold(const int i) const;
99  int col(const int i) const;
100  int alias(const int i) const;
101  void init(const int d);
102  void mk_walker(const int d);
103  void transpose(const int d);
104  int read(const string path);
105  void write_construct(const string file_name,const int d);
106  int walk(const double rand,const int j,const int n,const int d,const int i);
107 };
108 
109 
110 
111 #include "alias.inl"
112 
113 
114 #endif
115 
Header of HBF Class.
double Threshold
Definition: alias.h:52
Utilization of the Standard Template Library.
vector< int >::iterator iteri
Definition: alias.h:47
const double EPS
Definition: alias.h:44
int Index
Definition: alias.h:54
vector< double >::iterator iterd
Definition: alias.h:49
Class sparseMatrix: implementation of a transition structure using the sparse matrix data structure...
Definition: sparseMatrix.h:29
Inline methods of Alias class.
Aliasing data.
Definition: alias.h:62
Storage of matrix in Harwell Boeing Format.
Definition: hbf.h:65