Update of /cvsroot/quantlib/QuantLib/Include/ql/MonteCarlo
In directory usw-pr-cvs1:/tmp/cvs-serv9734/ql/MonteCarlo
Modified Files:
generalmontecarlo.hpp mcoptionsample.hpp multipathpricer.hpp
pathmontecarlo.hpp pathpricer.hpp
Log Message:
Monte Carlo interfaces imporved
Index: generalmontecarlo.hpp
===================================================================
RCS file: /cvsroot/quantlib/QuantLib/Include/ql/MonteCarlo/generalmontecarlo.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** generalmontecarlo.hpp 2001/07/19 16:40:10 1.11
--- generalmontecarlo.hpp 2001/07/20 13:06:57 1.12
***************
*** 30,33 ****
--- 30,36 ----
// $Source$
// $Log$
+ // Revision 1.12 2001/07/20 13:06:57 marmar
+ // Monte Carlo interfaces imporved
+ //
// Revision 1.11 2001/07/19 16:40:10 lballabio
// Improved docs a bit
***************
*** 115,119 ****
GeneralMonteCarlo(const SA &statisticAccumulator,
const SG &sampleGenerator);
! SA sampleAccumulator(long iterations = 0) const;
private:
mutable SA sampleAccumulator_;
--- 118,122 ----
GeneralMonteCarlo(const SA &statisticAccumulator,
const SG &sampleGenerator);
! const SA& sampleAccumulator(long iterations = 0) const;
private:
mutable SA sampleAccumulator_;
***************
*** 131,135 ****
template<class SA, class SG>
! inline SA GeneralMonteCarlo<SA, SG>::sampleAccumulator(long iterations) const{
QL_REQUIRE(isInitialized_ == true,
"GeneralMonteCarlo must be initialized");
--- 134,138 ----
template<class SA, class SG>
! inline const SA& GeneralMonteCarlo<SA, SG>::sampleAccumulator(long iterations) const{
QL_REQUIRE(isInitialized_ == true,
"GeneralMonteCarlo must be initialized");
Index: mcoptionsample.hpp
===================================================================
RCS file: /cvsroot/quantlib/QuantLib/Include/ql/MonteCarlo/mcoptionsample.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** mcoptionsample.hpp 2001/07/19 16:40:10 1.8
--- mcoptionsample.hpp 2001/07/20 13:06:57 1.9
***************
*** 30,33 ****
--- 30,36 ----
// $Source$
// $Log$
+ // Revision 1.9 2001/07/20 13:06:57 marmar
+ // Monte Carlo interfaces imporved
+ //
// Revision 1.8 2001/07/19 16:40:10 lballabio
// Improved docs a bit
***************
*** 67,73 ****
class PP{
! // The value() method will eventually evolve into
! // PP::ValueType value() const;
! double value(PATH_TYPE &) const;
};
\endcode
--- 70,74 ----
class PP{
! ValueType value(PATH_TYPE &) const;
};
\endcode
***************
*** 76,83 ****
class OptionSample {
public:
OptionSample(){}
OptionSample(Handle<PG> samplePath, Handle<PP> pathPricer);
! double next() const; // this will eventually evolve into
! // PP::ValueType next() const;
double weight() const;
private:
--- 77,85 ----
class OptionSample {
public:
+ typedef typename PP::ValueType SampleType;
+
OptionSample(){}
OptionSample(Handle<PG> samplePath, Handle<PP> pathPricer);
! SampleType next() const;
double weight() const;
private:
***************
*** 95,99 ****
template<class PG, class PP>
! inline double OptionSample<PG, PP>::next() const{
double price = pathPricer_ -> value(samplePath_ -> next());
weight_ = samplePath_ -> weight();
--- 97,101 ----
template<class PG, class PP>
! inline OptionSample<PG, PP>::SampleType OptionSample<PG, PP>::next() const{
double price = pathPricer_ -> value(samplePath_ -> next());
weight_ = samplePath_ -> weight();
Index: multipathpricer.hpp
===================================================================
RCS file: /cvsroot/quantlib/QuantLib/Include/ql/MonteCarlo/multipathpricer.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** multipathpricer.hpp 2001/07/19 16:40:10 1.7
--- multipathpricer.hpp 2001/07/20 13:06:57 1.8
***************
*** 31,34 ****
--- 31,37 ----
// $Source$
// $Log$
+ // Revision 1.8 2001/07/20 13:06:57 marmar
+ // Monte Carlo interfaces imporved
+ //
// Revision 1.7 2001/07/19 16:40:10 lballabio
// Improved docs a bit
***************
*** 56,59 ****
--- 59,63 ----
class MultiPathPricer {
public:
+ typedef double ValueType;
MultiPathPricer() : isInitialized_(false) {}
virtual ~MultiPathPricer() {}
Index: pathmontecarlo.hpp
===================================================================
RCS file: /cvsroot/quantlib/QuantLib/Include/ql/MonteCarlo/pathmontecarlo.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** pathmontecarlo.hpp 2001/07/13 15:25:13 1.9
--- pathmontecarlo.hpp 2001/07/20 13:06:57 1.10
***************
*** 30,33 ****
--- 30,36 ----
// $Source$
// $Log$
+ // Revision 1.10 2001/07/20 13:06:57 marmar
+ // Monte Carlo interfaces imporved
+ //
// Revision 1.9 2001/07/13 15:25:13 marmar
// MonteCarlo interface changed
***************
*** 91,95 ****
Handle<PP> pathPricer,
S sampleAccumulator);
! S sampleAccumulator(long samples = 0) const;
private:
S sampleAccumulator_;
--- 94,98 ----
Handle<PP> pathPricer,
S sampleAccumulator);
! const S& sampleAccumulator(long samples = 0) const;
private:
S sampleAccumulator_;
***************
*** 111,115 ****
template<class S, class PG, class PP>
! inline S PathMonteCarlo<S, PG, PP>::
sampleAccumulator(long samples) const{
QL_REQUIRE(isInitialized_ == true,
--- 114,118 ----
template<class S, class PG, class PP>
! inline const S& PathMonteCarlo<S, PG, PP>::
sampleAccumulator(long samples) const{
QL_REQUIRE(isInitialized_ == true,
Index: pathpricer.hpp
===================================================================
RCS file: /cvsroot/quantlib/QuantLib/Include/ql/MonteCarlo/pathpricer.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** pathpricer.hpp 2001/07/19 16:40:10 1.7
--- pathpricer.hpp 2001/07/20 13:06:57 1.8
***************
*** 31,34 ****
--- 31,37 ----
// $Source$
// $Log$
+ // Revision 1.8 2001/07/20 13:06:57 marmar
+ // Monte Carlo interfaces imporved
+ //
// Revision 1.7 2001/07/19 16:40:10 lballabio
// Improved docs a bit
***************
*** 55,58 ****
--- 58,62 ----
class PathPricer {
public:
+ typedef double ValueType;
PathPricer() : isInitialized_(false) {}
virtual ~PathPricer() {}
|