Line data Source code
1 : /*******************************************************************************
2 : * *
3 : * Cosmos:(C)oncept et (O)utils (S)tatistique pour les (Mo)deles *
4 : * (S)tochastiques *
5 : * *
6 : * Copyright (C) 2009-2012 LSV & LACL *
7 : * Authors: Paolo Ballarini BenoƮt Barbot & Hilal Djafri *
8 : * Website: http://www.lsv.ens-cachan.fr/Software/cosmos *
9 : * *
10 : * This program is free software; you can redistribute it and/or modify *
11 : * it under the terms of the GNU General Public License as published by *
12 : * the Free Software Foundation; either version 3 of the License, or *
13 : * (at your option) any later version. *
14 : * *
15 : * This program is distributed in the hope that it will be useful, *
16 : * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 : * GNU General Public License for more details. *
19 : * *
20 : * You should have received a copy of the GNU General Public License along *
21 : * with this program; if not, write to the Free Software Foundation, Inc., *
22 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
23 : * file numericalSolver.hpp created by Benoit Barbot on 05/12/11. *
24 : *******************************************************************************
25 : */
26 :
27 : /*
28 : * This class implement some function of a numerical solver.
29 : * It is used to compute Bounded Until importance sampling.
30 : *
31 : */
32 :
33 : #ifndef _NUMERICAL_SOLVER_HPP
34 : #define _NUMERICAL_SOLVER_HPP
35 :
36 :
37 : #include "stateSpace.hpp"
38 : namespace boostmat = boost::numeric::ublas;
39 :
40 : /**
41 : * \brief a class handling numerical computation.
42 : * This class maintain a vector of probability to reach a final
43 : * state of the computation used for the importance sampling algorithm.
44 : */
45 0 : class numericalSolver: public stateSpace
46 : {
47 :
48 : public:
49 : numericalSolver();
50 :
51 : //! Return the minimal number of step required to have a probability different than 0.
52 0 : virtual int getMinT(){return minT;};
53 :
54 : //!initialise for an horizon point T.
55 : virtual void initVect(int T);
56 : //! Horizon.
57 : int T;
58 : //! Reset to the initial state.
59 : virtual void reset();
60 :
61 : //! Switch off rare event acceleration: return vector of 1
62 : virtual void switchOff();
63 :
64 : //! Return a vector of the current distribution
65 : virtual boostmat::vector<double> getVect();
66 : virtual double getMu(int)const override ;
67 : virtual void previousVect();
68 : virtual void stepVect();
69 : virtual int currentRound();
70 : virtual void printState();
71 :
72 :
73 : protected:
74 : vector<boostmat::vector<double> >* circularvect;
75 : int matOffset;
76 : int nbVect;
77 : void sparseProd(boostmat::vector<double> *result,boostmat::vector<double> *vect, boostmat::compressed_matrix<double> *mat);
78 : int minT;
79 :
80 : };
81 :
82 :
83 :
84 :
85 : #endif
|