00001 /* ************************************************************* 00002 00003 Copyright 2010 Terry Lyons, Stephen Buckley, Djalil Chafai, 00004 Greg Gyurkó and Arend Janssen. 00005 00006 Distributed under the terms of the GNU General Public License, 00007 Version 3. (See accompanying file License.txt) 00008 00009 ************************************************************* */ 00010 00011 00012 00013 #pragma once 00014 00015 #ifndef __BROWNIANPATH__ 00016 #define __BROWNIANPATH__ 00017 00018 00019 #include "DynamicallyConstructedPath.h" 00020 #include "NormalRandomNumberGenerator.h" 00021 00023 00026 00027 template <typename my_alg_type> 00028 class BrownianPath : 00029 public DynamicallyConstructedPath<my_alg_type> 00030 { 00031 00033 static NormalRandomNumberGenerator vgCommonNormal; 00034 00036 const unsigned int dim; 00037 00039 virtual LIE GaussianIncrement( double t ) const 00040 { 00041 unsigned int d1; 00042 if (dim <= myDIM) 00043 { 00044 d1 = dim; 00045 } 00046 else 00047 { 00048 d1 = myDIM; 00049 } 00050 00051 LIE l; 00052 for(unsigned int i = 1; i <= d1; i++) 00053 { 00054 l += LIE(LET(i),S(vgNormal(t))); 00055 } 00056 return l; 00057 } 00058 00059 protected: 00060 00062 NormalRandomNumberGenerator & vgNormal; 00063 00064 public: 00066 BrownianPath(void) : vgNormal(vgCommonNormal), dim(myDIM) {}; 00067 00069 BrownianPath(NormalRandomNumberGenerator & rand, unsigned int d=my_alg_type::myDIM) : vgNormal( rand ), dim(d) {}; 00070 00072 ~BrownianPath(void){}; 00073 00075 void ComputeChildLieIncrements( Increment<my_alg_type> & nvLeft, Increment<my_alg_type> & nvRight, ConstIterator itLeafAbove ) const 00076 { 00077 const dyadic_interval & diAbove = itLeafAbove->first; 00078 const Increment<my_alg_type> & nvAbove = itLeafAbove->second; 00079 00080 LIE perturbation = GaussianIncrement((diAbove.sup()-diAbove.inf())*.25); 00081 LIE mean = nvAbove.LieValue()*S(.5); 00082 nvLeft.LieValue (mean+perturbation); 00083 nvRight.LieValue(mean-perturbation); 00084 } 00085 00087 LIE MakeRootLieIncrement( const dyadic_interval &increment ) const 00088 { 00089 return GaussianIncrement( increment.sup()-increment.inf()); 00090 } 00091 00093 void MakeNeighborRootLieIncrement( LIE & ans, const Iterator & OldRoot ) const 00094 { 00095 // Cannot assume that OldRoot is still the root 00096 dyadic_interval diIncrement = OldRoot->first; 00097 diIncrement.flip_interval(); 00098 ans = GaussianIncrement( diIncrement.sup() - diIncrement.inf()); 00099 } 00100 }; 00101 00102 template <typename my_alg_type> NormalRandomNumberGenerator BrownianPath<my_alg_type>::vgCommonNormal; 00103 00104 #endif // __BROWNIANPATH__