CFL
GaussRollback.hpp
Go to the documentation of this file.
1 //Copyright (c) Dmitry Kramkov, 2000-2006. All rights reserved.
2 
3 #ifndef __cflGaussRollback_hpp__
4 #define __cflGaussRollback_hpp__
5 
6 #include "cfl/Function.hpp"
7 
19 namespace cfl
20 {
27  // @{
28 
30 
37  {
38  public:
42  virtual ~IGaussRollback(){}
43 
54  virtual IGaussRollback * newObject(unsigned iSize,
55  double dH,
56  double dVar
57  ) const = 0;
58 
67  virtual void rollback(std::valarray<double> & rValues) const = 0;
68  };
69 
71 
78  {
79  public:
87  explicit GaussRollback(IGaussRollback * pNewP = 0);
88 
96  void assign(unsigned iSize, double dH, double dVar);
97 
101  void rollback(std::valarray<double> & rValues) const;
102  private:
104  };
105 
107 
110  namespace NGaussRollback
111  {
119 
127 
136  GaussRollback implicit(const Function & rVarStep);
137 
142  const double c_dImplicitVarStepCoeff = 10.;
143 
152  GaussRollback implicit(double dVarStepCoeff = c_dImplicitVarStepCoeff);
153 
163  GaussRollback crankNicolson(const Function & rVarStep);
164 
169  const double c_dCrankNicolsonVarStepCoeff = 0.1;
170 
180  GaussRollback crankNicolson(double dVarStepCoeff = c_dCrankNicolsonVarStepCoeff);
181 
188  const int c_iImprovedExplicitSteps = 30;
189 
196  const int c_iImprovedImplicitSteps = 10;
197 
217  const Function & rUniformSteps = Function(c_iImprovedExplicitSteps),
218  const Function & rImplicitSteps = Function(c_iImprovedImplicitSteps));
219 
220  }
221  // @}
222 }
223 
224 #include "cfl/Inline/iGaussRollback.hpp"
225 #endif // of __cflGaussRollback_hpp__
226 
const int c_iImprovedExplicitSteps
Definition: GaussRollback.hpp:188
virtual void rollback(std::valarray< double > &rValues) const =0
Interface class for the operator of conditional expectation with respect to gaussian distribution...
Definition: GaussRollback.hpp:36
virtual ~IGaussRollback()
Definition: GaussRollback.hpp:42
Concrete class for the operator of conditional expectation with respect to gaussian distribution...
Definition: GaussRollback.hpp:77
Concrete class for a one-dimensional function.
Definition: Function.hpp:78
GaussRollback implicit(double dVarStepCoeff=c_dImplicitVarStepCoeff)
const int c_iImprovedImplicitSteps
Definition: GaussRollback.hpp:196
GaussRollback crankNicolson(double dVarStepCoeff=c_dCrankNicolsonVarStepCoeff)
GaussRollback uniform()
const double c_dImplicitVarStepCoeff
Definition: GaussRollback.hpp:142
GaussRollback improved(const GaussRollback &rFast=crankNicolson(), const Function &rUniformSteps=Function(c_iImprovedExplicitSteps), const Function &rImplicitSteps=Function(c_iImprovedImplicitSteps))
Main namespace for cfl library.
Definition: Approx.hpp:22
virtual IGaussRollback * newObject(unsigned iSize, double dH, double dVar) const =0
GaussRollback binomial()
const double c_dCrankNicolsonVarStepCoeff
Definition: GaussRollback.hpp:169
One-dimensional function object in cfl library.