Sie sind auf Seite 1von 80

/* Debugger Carlos Cesar ARANDA GNU GPL

* C++ Design Pattern and Derivative Pricing, Second Edition.


* Copyright (c) 2002
* Mark Joshi
*
* Permission to use, copy, modify, distribute and sell this
* software for any purpose is hereby
* granted without fee, provided that the above copyright notice
* appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation.
* Mark Joshi makes no representations about the
* suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*/
//
//
// StatsMain2.cpp
//
//
/*
uses source files

ConvergenceTable.cpp
MCStatistics.cpp
Parameters.cpp,
PayOff3.cpp,
PayOffBridge.cpp,
Random1.cpp,
SimpleMC7.cpp
Vanilla3.cpp
*/
#include "SimpleMC7.h"
#include<iostream>
using namespace std;
#include "Vanilla3.h"
#include "MCStatistics.h"
#include "ConvergenceTable.h"

int main()
{

double Expiry;
double Strike;
double Spot;
double Vol;
double r;
unsigned long NumberOfPaths;

cout << "\nEnter expiry\n";


cin >> Expiry;

cout << "\nStrike\n";


cin >> Strike;

cout << "\nEnter spot\n";


cin >> Spot;

cout << "\nEnter vol\n";


cin >> Vol;

cout << "\nr\n";


cin >> r;

cout << "\nNumber of paths\n";


cin >> NumberOfPaths;
PayOffCall thePayOff(Strike);

VanillaOption theOption(thePayOff, Expiry);

ParametersConstant VolParam(Vol);
ParametersConstant rParam(r);

StatisticsMean gatherer;
ConvergenceTable gathererTwo(gatherer);

SimpleMonteCarlo5(theOption,
Spot,
VolParam,
rParam,
NumberOfPaths,
gathererTwo);

vector<vector<double> > results =gathererTwo.GetResultsSoFar();


cout <<"\nFor the call price the results are \n";

for (unsigned long i=0; i < results.size(); i++)


{
for (unsigned long j=0; j < results[i].size(); j++)
cout << results[i][j] << " ";

cout << "\n";


}

double tmp;
cin >> tmp;

return 0;

}
//
//
//
// ConvergenceTable.cpp
//
//

#include "ConvergenceTable.h"

ConvergenceTable::ConvergenceTable(const Wrapper<StatisticsMC>&
Inner_)
: Inner(Inner_)
{
StoppingPoint=2;
PathsDone=0;
}

StatisticsMC* ConvergenceTable::clone() const


{
return new ConvergenceTable(*this);
}

void ConvergenceTable::DumpOneResult(double result)


{
Inner->DumpOneResult(result);
++PathsDone;

if (PathsDone == StoppingPoint)
{
StoppingPoint*=2;
std::vector<std::vector<double> > thisResult(Inner-
>GetResultsSoFar());

for (unsigned long i=0; i < thisResult.size(); i++)


{
thisResult[i].push_back(PathsDone);
ResultsSoFar.push_back(thisResult[i]);
}
}

return;

std::vector<std::vector<double> > ConvergenceTable::GetResultsSoFar()


const
{
std::vector<std::vector<double> > tmp(ResultsSoFar);

if (PathsDone*2 != StoppingPoint)
{
std::vector<std::vector<double> > thisResult(Inner-
>GetResultsSoFar());

for (unsigned long i=0; i < thisResult.size(); i++)


{
thisResult[i].push_back(PathsDone);
tmp.push_back(thisResult[i]);
}
}
return tmp;
}
//
//
// ConvergenceTable.h
//
//
//

#ifndef CONVERGENCE_TABLE_H
#define CONVERGENCE_TABLE_H
#include "MCStatistics.h"
#include "wrapper.h"

class ConvergenceTable : public StatisticsMC


{
public:

ConvergenceTable(const Wrapper<StatisticsMC>& Inner_);

virtual StatisticsMC* clone() const;


virtual void DumpOneResult(double result);
virtual std::vector<std::vector<double> > GetResultsSoFar() const;

private:

Wrapper<StatisticsMC> Inner;
std::vector<std::vector<double> > ResultsSoFar;
unsigned long StoppingPoint;
unsigned long PathsDone;
};

#endif
//
//
//
// MCStatistics.cpp
//
//

#include "MCStatistics.h"
using namespace std;

StatisticsMean::StatisticsMean()
:
RunningSum(0.0), PathsDone(0UL)
{
}

void StatisticsMean::DumpOneResult(double result)


{
PathsDone++;
RunningSum += result;
}

vector<vector<double> > StatisticsMean::GetResultsSoFar() const


{
vector<vector<double> > Results(1);

Results[0].resize(1);
Results[0][0] = RunningSum / PathsDone;

return Results;
}

StatisticsMC* StatisticsMean::clone() const


{
return new StatisticsMean(*this);
}
//
//
//
// MCStatistics.h
//
//

#ifndef STATISTICS_H
#define STATISTICS_H

#include <vector>

class StatisticsMC
{
public:

StatisticsMC(){}

virtual void DumpOneResult(double result)=0;


virtual std::vector<std::vector<double> > GetResultsSoFar()
const=0;
virtual StatisticsMC* clone() const=0;
virtual ~StatisticsMC(){}

private:

};

class StatisticsMean : public StatisticsMC


{

public:

StatisticsMean();
virtual void DumpOneResult(double result);
virtual std::vector<std::vector<double> > GetResultsSoFar() const;
virtual StatisticsMC* clone() const;

private:

double RunningSum;
unsigned long PathsDone;

};

#endif
//
//
//
// MinMax.h
//
//
// these should be <algorithm> but sometimes aren't.

#ifndef MINMAX_H
#define MINMAX_H

template<class T> const T& max(const T& a, const T& b)


{
return (a<b) ? b : a;
}

template<class T> const T& min(const T& a, const T& b)


{
return (a>b) ? b : a;
}
#endif
//
//
//
// Parameters.cpp
//
//

#include "Parameters.h"

Parameters::Parameters(const ParametersInner& innerObject)


{
InnerObjectPtr = innerObject.clone();
}

Parameters::Parameters(const Parameters& original)


{
InnerObjectPtr = original.InnerObjectPtr->clone();
}

Parameters& Parameters::operator=(const Parameters& original)


{
if (this != &original)
{
delete InnerObjectPtr;
InnerObjectPtr = original.InnerObjectPtr->clone();
}
return *this;
}

Parameters::~Parameters()
{
delete InnerObjectPtr;
}
//
//
//
// Parameters.h
//
//

#ifndef PARAMETERS_H
#define PARAMETERS_H

class ParametersInner
{

public:
ParametersInner(){}

virtual ParametersInner* clone() const=0;


virtual double Integral(double time1, double time2) const=0;
virtual double IntegralSquare(double time1, double time2) const=0;
virtual ~ParametersInner(){}
private:

};

class Parameters
{

public:

Parameters(const ParametersInner& innerObject);


Parameters(const Parameters& original);
Parameters& operator=(const Parameters& original);
virtual ~Parameters();

inline double Integral(double time1, double time2) const;


inline double IntegralSquare(double time1, double time2) const;

double Mean(double time1, double time2) const;


double RootMeanSquare(double time1, double time2) const;

private:

ParametersInner* InnerObjectPtr;

};

inline double Parameters::Integral(double time1, double time2) const


{
return InnerObjectPtr->Integral(time1,time2);
}
inline double Parameters::IntegralSquare(double time1, double time2)
const
{
return InnerObjectPtr->IntegralSquare(time1,time2);
}

class ParametersConstant : public ParametersInner


{
public:

ParametersConstant(double constant);

virtual ParametersInner* clone() const;


virtual double Integral(double time1, double time2) const;
virtual double IntegralSquare(double time1, double time2) const;

private:

double Constant;
double ConstantSquare;

};

#endif
//
//
// PayOff3.cpp
//
//

#include "PayOff3.h"
#include "MinMax.h"

PayOffCall::PayOffCall(double Strike_) : Strike(Strike_)


{
}

double PayOffCall::operator () (double Spot) const


{
return max(Spot-Strike,0.0);
}

PayOff* PayOffCall::clone() const


{
return new PayOffCall(*this);
}

double PayOffPut::operator () (double Spot) const


{
return max(Strike-Spot,0.0);
}

PayOffPut::PayOffPut(double Strike_) : Strike(Strike_)


{
}

PayOff* PayOffPut::clone() const


{
return new PayOffPut(*this);
}
//
//
// PayOff3.h
//
//

#ifndef PAYOFF3_H
#define PAYOFF3_H

class PayOff
{
public:

PayOff(){};

virtual double operator()(double Spot) const=0;


virtual ~PayOff(){}
virtual PayOff* clone() const=0;

private:

};

class PayOffCall : public PayOff


{
public:

PayOffCall(double Strike_);

virtual double operator()(double Spot) const;


virtual ~PayOffCall(){}
virtual PayOff* clone() const;

private:

double Strike;

};

class PayOffPut : public PayOff


{
public:

PayOffPut(double Strike_);

virtual double operator()(double Spot) const;


virtual ~PayOffPut(){}
virtual PayOff* clone() const;

private:
double Strike;

};

#endif
//
//
// PayOffBridge.cpp
//
//

#include "PayOffBridge.h"

PayOffBridge::PayOffBridge(const PayOffBridge& original)


{
ThePayOffPtr = original.ThePayOffPtr->clone();
}

PayOffBridge::PayOffBridge(const PayOff& innerPayOff)


{
ThePayOffPtr = innerPayOff.clone();
}

PayOffBridge::~PayOffBridge()
{
delete ThePayOffPtr;
}

PayOffBridge& PayOffBridge::operator=(const PayOffBridge& original)


{
if (this != &original)
{
delete ThePayOffPtr;
ThePayOffPtr = original.ThePayOffPtr->clone();
}

return *this;
}
//
//
// PayOffBridge.h
//
//

#ifndef PAYOFFBRIDGE_H
#define PAYOFFBRIDGE_H

#include "PayOff3.h"

class PayOffBridge
{
public:

PayOffBridge(const PayOffBridge& original);


PayOffBridge(const PayOff& innerPayOff);

inline double operator()(double Spot) const;


~PayOffBridge();
PayOffBridge& operator=(const PayOffBridge& original);

private:

PayOff* ThePayOffPtr;

};

inline double PayOffBridge::operator()(double Spot) const


{
return ThePayOffPtr->operator ()(Spot);
}

#endif
//
// Random1.cpp
//
//

#include "Random1.h"
#include <cstdlib>
#include <cmath>

// the basic math functions should be in namespace std but aren't in


VCPP6
#if !defined(_MSC_VER)
using namespace std;
#endif

double GetOneGaussianBySummation()
{
double result=0;

for (unsigned long j=0; j < 12; j++)


result += rand()/static_cast<double>(RAND_MAX);

result -= 6.0;

return result;

double GetOneGaussianByBoxMuller()
{
double result;

double x;
double y;

double sizeSquared;
do
{
x = 2.0*rand()/static_cast<double>(RAND_MAX)-1;
y = 2.0*rand()/static_cast<double>(RAND_MAX)-1;
sizeSquared = x*x + y*y;
}
while
( sizeSquared >= 1.0);

result = x*sqrt(-2*log(sizeSquared)/sizeSquared);

return result;

}
//
//
// Random1.h
//
//

#ifndef RANDOM1_H
#define RANDOM1_H

double GetOneGaussianBySummation();
double GetOneGaussianByBoxMuller();

#endif
//
//
//
// SimpleMC7.cpp
//
//

#include "SimpleMC7.h"
#include "Random1.h"
#include <cmath>

// the basic math functions should be in namespace std but aren't in


VCPP6
#if !defined(_MSC_VER)
using namespace std;
#endif

void SimpleMonteCarlo5(const VanillaOption& TheOption,


double Spot,
const Parameters& Vol,
const Parameters& r,
unsigned long NumberOfPaths,
StatisticsMC& gatherer)
{
double Expiry = TheOption.GetExpiry();
double variance = Vol.IntegralSquare(0,Expiry);
double rootVariance = sqrt(variance);
double itoCorrection = -0.5*variance;
double movedSpot = Spot*exp(r.Integral(0,Expiry) +itoCorrection);
double thisSpot;
double discounting = exp(-r.Integral(0,Expiry));

for (unsigned long i=0; i < NumberOfPaths; i++)


{
double thisGaussian = GetOneGaussianByBoxMuller();
thisSpot = movedSpot*exp( rootVariance*thisGaussian);
double thisPayOff = TheOption.OptionPayOff(thisSpot);
gatherer.DumpOneResult(thisPayOff*discounting);
}

return;
}
//
//
//
// SimpleMC7.h
//
//

#ifndef SIMPLEMC7_H
#define SIMPLEMC7_H

#include "Vanilla3.h"
#include "Parameters.h"
#include "MCStatistics.h"

void SimpleMonteCarlo5(const VanillaOption& TheOption,


double Spot,
const Parameters& Vol,
const Parameters& r,
unsigned long NumberOfPaths,
StatisticsMC& gatherer);

#endif
//
//
// Vanilla3.cpp
//
//
#include "Vanilla3.h"

VanillaOption::VanillaOption(const PayOffBridge& ThePayOff_, double


Expiry_)
: ThePayOff(ThePayOff_), Expiry(Expiry_)
{
}

double VanillaOption::GetExpiry() const


{
return Expiry;
}

double VanillaOption::OptionPayOff(double Spot) const


{
return ThePayOff(Spot);
}
//
//
// Vanilla3.h
//
//
#ifndef VANILLA_3_H
#define VANILLA_3_H

#include "PayOffBridge.h"

class VanillaOption
{
public:

VanillaOption(const PayOffBridge& ThePayOff_, double Expiry);

double OptionPayOff(double Spot) const;


double GetExpiry() const;

private:
PayOffBridge ThePayOff;
double Expiry;

};

#endif
//
//
// wrapper.h
//
//

#ifndef WRAPPER_H
#define WRAPPER_H

template< class T>


class Wrapper
{
public:

Wrapper()
{ DataPtr =0;}

Wrapper(const T& inner)


{
DataPtr = inner.clone();
}

~Wrapper()
{
if (DataPtr !=0)
delete DataPtr;
}

Wrapper(const Wrapper<T>& original)


{
if (original.DataPtr !=0)
DataPtr = original.DataPtr->clone();
else
DataPtr=0;
}

Wrapper& operator=(const Wrapper<T>& original)


{
if (this != &original)
{
if (DataPtr!=0)
delete DataPtr;

DataPtr = (original.DataPtr !=0) ? original.DataPtr->clone() :


0;
}

return *this;
}

T& operator*()
{
return *DataPtr;
}

const T& operator*() const


{
return *DataPtr;
}

const T* const operator->() const


{
return DataPtr;
}

T* operator->()
{
return DataPtr;
}

private:
T* DataPtr;

};
#endif
My Project

Generated by Doxygen 1.8.6

Sat Feb 28 2015 15:33:44


Contents

1 Hierarchical Index 1

1.1 Class Hierarchy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Class Index 3

2.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

3 File Index 5

3.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

4 Class Documentation 7

4.1 ConvergenceTable Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

4.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.2.1 ConvergenceTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.3.1 clone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.3.2 DumpOneResult . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.1.3.3 GetResultsSoFar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

4.2 Parameters Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

4.2.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.2.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.2.2.1 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.2.2.2 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.2.2.3 ∼Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4.2.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.2.3.1 Integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.2.3.2 IntegralSquare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

4.2.3.3 Mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.2.3.4 operator= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.2.3.5 RootMeanSquare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

4.3 ParametersConstant Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

4.3.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13


iv CONTENTS

4.3.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 14


4.3.2.1 ParametersConstant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3.3.1 clone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3.3.2 Integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.3.3.3 IntegralSquare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.4 ParametersInner Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4.2.1 ParametersInner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4.2.2 ∼ParametersInner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4.3.1 clone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
4.4.3.2 Integral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.4.3.3 IntegralSquare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.5 PayOff Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4.5.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.5.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.5.2.1 PayOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.5.2.2 ∼PayOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.5.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.5.3.1 clone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.5.3.2 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.6 PayOffBridge Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.6.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.6.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.6.2.1 PayOffBridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.6.2.2 PayOffBridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6.2.3 ∼PayOffBridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6.3.1 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.6.3.2 operator= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4.7 PayOffCall Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.7.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4.7.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.7.2.1 PayOffCall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.7.2.2 ∼PayOffCall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.7.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.7.3.1 clone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.7.3.2 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


CONTENTS v

4.8 PayOffPut Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22


4.8.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.8.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.8.2.1 PayOffPut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.8.2.2 ∼PayOffPut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.8.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.8.3.1 clone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.8.3.2 operator() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.9 StatisticsMC Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.9.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.9.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.9.2.1 StatisticsMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.9.2.2 ∼StatisticsMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.9.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.9.3.1 clone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.9.3.2 DumpOneResult . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.9.3.3 GetResultsSoFar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.10 StatisticsMean Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.10.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.10.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.10.2.1 StatisticsMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.10.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.10.3.1 clone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.10.3.2 DumpOneResult . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.10.3.3 GetResultsSoFar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.11 VanillaOption Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.11.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.11.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.11.2.1 VanillaOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.11.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.11.3.1 GetExpiry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.11.3.2 OptionPayOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.12 Wrapper< T > Class Template Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.12.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.2 Constructor & Destructor Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.2.1 Wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.2.2 Wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.2.3 ∼Wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.2.4 Wrapper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.3 Member Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


vi CONTENTS

4.12.3.1 operator∗ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.3.2 operator∗ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.3.3 operator-> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.12.3.4 operator-> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.12.3.5 operator= . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

5 File Documentation 31
5.1 ConvergenceTable.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.2 ConvergenceTable.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.3 MCStatistics.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
5.4 MCStatistics.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.5 MinMax.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.5.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.5.1.1 max . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.5.1.2 min . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.6 Parameters.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.7 Parameters.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.8 PayOff3.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
5.9 PayOff3.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.10 PayOffBridge.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.11 PayOffBridge.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.12 Random1.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.12.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.12.1.1 GetOneGaussianByBoxMuller . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.12.1.2 GetOneGaussianBySummation . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.13 Random1.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.13.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.13.1.1 GetOneGaussianByBoxMuller . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
5.13.1.2 GetOneGaussianBySummation . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.14 SimpleMC7.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5.14.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.14.1.1 SimpleMonteCarlo5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.15 SimpleMC7.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.15.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.15.1.1 SimpleMonteCarlo5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.16 StatsMain2.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
5.16.1 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.16.1.1 main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.17 Vanilla3.cpp File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.18 Vanilla3.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


CONTENTS vii

5.19 wrapper.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


Chapter 1

Hierarchical Index

1.1 Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically:


Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
ParametersInner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
ParametersConstant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
PayOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
PayOffCall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
PayOffPut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
PayOffBridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
StatisticsMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
ConvergenceTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
StatisticsMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
VanillaOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Wrapper< T > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Wrapper< StatisticsMC > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
2 Hierarchical Index

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


Chapter 2

Class Index

2.1 Class List

Here are the classes, structs, unions and interfaces with brief descriptions:
ConvergenceTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
ParametersConstant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
ParametersInner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
PayOff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
PayOffBridge . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
PayOffCall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
PayOffPut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
StatisticsMC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
StatisticsMean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
VanillaOption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Wrapper< T > . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4 Class Index

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


Chapter 3

File Index

3.1 File List

Here is a list of all files with brief descriptions:


ConvergenceTable.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
ConvergenceTable.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
MCStatistics.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
MCStatistics.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
MinMax.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Parameters.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Parameters.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
PayOff3.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
PayOff3.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
PayOffBridge.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
PayOffBridge.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Random1.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Random1.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
SimpleMC7.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
SimpleMC7.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
StatsMain2.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Vanilla3.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Vanilla3.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
wrapper.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
6 File Index

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


Chapter 4

Class Documentation

4.1 ConvergenceTable Class Reference

#include <ConvergenceTable.h>
Inheritance diagram for ConvergenceTable:

StatisticsMC

ConvergenceTable

Collaboration diagram for ConvergenceTable:

StatisticsMC

ConvergenceTable

Public Member Functions

• ConvergenceTable (const Wrapper< StatisticsMC > &Inner_)


8 Class Documentation

• virtual StatisticsMC ∗ clone () const


• virtual void DumpOneResult (double result)
• virtual std::vector
< std::vector< double > > GetResultsSoFar () const

4.1.1 Detailed Description

Definition at line 13 of file ConvergenceTable.h.

4.1.2 Constructor & Destructor Documentation

4.1.2.1 ConvergenceTable::ConvergenceTable ( const Wrapper< StatisticsMC > & Inner_ )

Definition at line 10 of file ConvergenceTable.cpp.


Here is the caller graph for this function:

ConvergenceTable::Convergence
ConvergenceTable::clone
Table

4.1.3 Member Function Documentation

4.1.3.1 StatisticsMC ∗ ConvergenceTable::clone ( ) const [virtual]

Implements StatisticsMC.
Definition at line 17 of file ConvergenceTable.cpp.
Here is the call graph for this function:

ConvergenceTable::Convergence
ConvergenceTable::clone
Table

4.1.3.2 void ConvergenceTable::DumpOneResult ( double result ) [virtual]

Implements StatisticsMC.
Definition at line 22 of file ConvergenceTable.cpp.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.2 Parameters Class Reference 9

Here is the call graph for this function:

StatisticsMC::DumpOneResult
ConvergenceTable::DumpOne
Result
StatisticsMC::GetResults
SoFar

4.1.3.3 std::vector< std::vector< double > > ConvergenceTable::GetResultsSoFar ( ) const [virtual]

Implements StatisticsMC.
Definition at line 43 of file ConvergenceTable.cpp.
Here is the call graph for this function:

ConvergenceTable::GetResults StatisticsMC::GetResults
SoFar SoFar

Here is the caller graph for this function:

ConvergenceTable::GetResults
main
SoFar

The documentation for this class was generated from the following files:

• ConvergenceTable.h
• ConvergenceTable.cpp

4.2 Parameters Class Reference

#include <Parameters.h>

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


10 Class Documentation

Public Member Functions

• Parameters (const ParametersInner &innerObject)


• Parameters (const Parameters &original)
• Parameters & operator= (const Parameters &original)
• virtual ∼Parameters ()
• double Integral (double time1, double time2) const
• double IntegralSquare (double time1, double time2) const
• double Mean (double time1, double time2) const
• double RootMeanSquare (double time1, double time2) const

4.2.1 Detailed Description

Definition at line 27 of file Parameters.h.

4.2.2 Constructor & Destructor Documentation

4.2.2.1 Parameters::Parameters ( const ParametersInner & innerObject )

Definition at line 10 of file Parameters.cpp.


Here is the call graph for this function:

Parameters::Parameters ParametersInner::clone

4.2.2.2 Parameters::Parameters ( const Parameters & original )

Definition at line 15 of file Parameters.cpp.


Here is the call graph for this function:

Parameters::Parameters ParametersInner::clone

4.2.2.3 Parameters::∼Parameters ( ) [virtual]

Definition at line 30 of file Parameters.cpp.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.2 Parameters Class Reference 11

4.2.3 Member Function Documentation

4.2.3.1 double Parameters::Integral ( double time1, double time2 ) const [inline]

Definition at line 49 of file Parameters.h.


Here is the call graph for this function:

Parameters::Integral ParametersInner::Integral

Here is the caller graph for this function:

Parameters::Mean
Parameters::Integral
SimpleMonteCarlo5 main

4.2.3.2 double Parameters::IntegralSquare ( double time1, double time2 ) const [inline]

Definition at line 55 of file Parameters.h.


Here is the call graph for this function:

ParametersInner::Integral
Parameters::IntegralSquare
Square

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


12 Class Documentation

Here is the caller graph for this function:

Parameters::RootMeanSquare
Parameters::IntegralSquare
SimpleMonteCarlo5 main

4.2.3.3 double Parameters::Mean ( double time1, double time2 ) const

Definition at line 52 of file Parameters.cpp.


Here is the call graph for this function:

Parameters::Mean Parameters::Integral ParametersInner::Integral

4.2.3.4 Parameters & Parameters::operator= ( const Parameters & original )

Definition at line 20 of file Parameters.cpp.


Here is the call graph for this function:

Parameters::operator= ParametersInner::clone

4.2.3.5 double Parameters::RootMeanSquare ( double time1, double time2 ) const

Definition at line 58 of file Parameters.cpp.


Here is the call graph for this function:

ParametersInner::Integral
Parameters::RootMeanSquare Parameters::IntegralSquare
Square

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.3 ParametersConstant Class Reference 13

The documentation for this class was generated from the following files:

• Parameters.h
• Parameters.cpp

4.3 ParametersConstant Class Reference

#include <Parameters.h>
Inheritance diagram for ParametersConstant:

ParametersInner

ParametersConstant

Collaboration diagram for ParametersConstant:

ParametersInner

ParametersConstant

Public Member Functions

• ParametersConstant (double constant)


• virtual ParametersInner ∗ clone () const
• virtual double Integral (double time1, double time2) const
• virtual double IntegralSquare (double time1, double time2) const

4.3.1 Detailed Description

Definition at line 61 of file Parameters.h.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


14 Class Documentation

4.3.2 Constructor & Destructor Documentation

4.3.2.1 ParametersConstant::ParametersConstant ( double constant )

Definition at line 64 of file Parameters.cpp.


Here is the caller graph for this function:

ParametersConstant ParametersConstant
::ParametersConstant ::clone

4.3.3 Member Function Documentation

4.3.3.1 ParametersInner ∗ ParametersConstant::clone ( ) const [virtual]

Implements ParametersInner.
Definition at line 70 of file Parameters.cpp.
Here is the call graph for this function:

ParametersConstant ParametersConstant
::clone ::ParametersConstant

4.3.3.2 double ParametersConstant::Integral ( double time1, double time2 ) const [virtual]

Implements ParametersInner.
Definition at line 76 of file Parameters.cpp.

4.3.3.3 double ParametersConstant::IntegralSquare ( double time1, double time2 ) const [virtual]

Implements ParametersInner.
Definition at line 81 of file Parameters.cpp.
The documentation for this class was generated from the following files:

• Parameters.h
• Parameters.cpp

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.4 ParametersInner Class Reference 15

4.4 ParametersInner Class Reference

#include <Parameters.h>
Inheritance diagram for ParametersInner:

ParametersInner

ParametersConstant

Public Member Functions

• ParametersInner ()
• virtual ParametersInner ∗ clone () const =0
• virtual double Integral (double time1, double time2) const =0
• virtual double IntegralSquare (double time1, double time2) const =0
• virtual ∼ParametersInner ()

4.4.1 Detailed Description

Definition at line 12 of file Parameters.h.

4.4.2 Constructor & Destructor Documentation

4.4.2.1 ParametersInner::ParametersInner ( ) [inline]

Definition at line 16 of file Parameters.h.

4.4.2.2 virtual ParametersInner::∼ParametersInner ( ) [inline], [virtual]

Definition at line 21 of file Parameters.h.

4.4.3 Member Function Documentation

4.4.3.1 virtual ParametersInner∗ ParametersInner::clone ( ) const [pure virtual]

Implemented in ParametersConstant.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


16 Class Documentation

Here is the caller graph for this function:

Parameters::Parameters
ParametersInner::clone
Parameters::operator=

4.4.3.2 virtual double ParametersInner::Integral ( double time1, double time2 ) const [pure virtual]

Implemented in ParametersConstant.
Here is the caller graph for this function:

Parameters::Mean
ParametersInner::Integral Parameters::Integral
SimpleMonteCarlo5 main

4.4.3.3 virtual double ParametersInner::IntegralSquare ( double time1, double time2 ) const [pure virtual]

Implemented in ParametersConstant.
Here is the caller graph for this function:

Parameters::RootMeanSquare
ParametersInner::Integral
Parameters::IntegralSquare
Square
SimpleMonteCarlo5 main

The documentation for this class was generated from the following file:

• Parameters.h

4.5 PayOff Class Reference

#include <PayOff3.h>

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.5 PayOff Class Reference 17

Inheritance diagram for PayOff:

PayOff

PayOffCall PayOffPut

Public Member Functions

• PayOff ()

• virtual double operator() (double Spot) const =0

• virtual ∼PayOff ()

• virtual PayOff ∗ clone () const =0

4.5.1 Detailed Description

Definition at line 10 of file PayOff3.h.

4.5.2 Constructor & Destructor Documentation

4.5.2.1 PayOff::PayOff ( ) [inline]

Definition at line 14 of file PayOff3.h.

4.5.2.2 virtual PayOff::∼PayOff ( ) [inline], [virtual]

Definition at line 17 of file PayOff3.h.

4.5.3 Member Function Documentation

4.5.3.1 virtual PayOff∗ PayOff::clone ( ) const [pure virtual]

Implemented in PayOffPut, and PayOffCall.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


18 Class Documentation

Here is the caller graph for this function:

PayOffBridge::PayOffBridge
PayOff::clone
PayOffBridge::operator=

4.5.3.2 virtual double PayOff::operator() ( double Spot ) const [pure virtual]

Implemented in PayOffPut, and PayOffCall.


The documentation for this class was generated from the following file:

• PayOff3.h

4.6 PayOffBridge Class Reference

#include <PayOffBridge.h>

Public Member Functions

• PayOffBridge (const PayOffBridge &original)


• PayOffBridge (const PayOff &innerPayOff)
• double operator() (double Spot) const
• ∼PayOffBridge ()
• PayOffBridge & operator= (const PayOffBridge &original)

4.6.1 Detailed Description

Definition at line 12 of file PayOffBridge.h.

4.6.2 Constructor & Destructor Documentation

4.6.2.1 PayOffBridge::PayOffBridge ( const PayOffBridge & original )

Definition at line 9 of file PayOffBridge.cpp.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.6 PayOffBridge Class Reference 19

Here is the call graph for this function:

PayOffBridge::PayOffBridge PayOff::clone

4.6.2.2 PayOffBridge::PayOffBridge ( const PayOff & innerPayOff )

Definition at line 14 of file PayOffBridge.cpp.


Here is the call graph for this function:

PayOffBridge::PayOffBridge PayOff::clone

4.6.2.3 PayOffBridge::∼PayOffBridge ( )

Definition at line 20 of file PayOffBridge.cpp.

4.6.3 Member Function Documentation

4.6.3.1 double PayOffBridge::operator() ( double Spot ) const [inline]

Definition at line 29 of file PayOffBridge.h.

4.6.3.2 PayOffBridge & PayOffBridge::operator= ( const PayOffBridge & original )

Definition at line 25 of file PayOffBridge.cpp.


Here is the call graph for this function:

PayOffBridge::operator= PayOff::clone

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


20 Class Documentation

The documentation for this class was generated from the following files:

• PayOffBridge.h
• PayOffBridge.cpp

4.7 PayOffCall Class Reference

#include <PayOff3.h>
Inheritance diagram for PayOffCall:

PayOff

PayOffCall

Collaboration diagram for PayOffCall:

PayOff

PayOffCall

Public Member Functions

• PayOffCall (double Strike_)


• virtual double operator() (double Spot) const
• virtual ∼PayOffCall ()
• virtual PayOff ∗ clone () const

4.7.1 Detailed Description

Definition at line 24 of file PayOff3.h.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.7 PayOffCall Class Reference 21

4.7.2 Constructor & Destructor Documentation

4.7.2.1 PayOffCall::PayOffCall ( double Strike_ )

Definition at line 10 of file PayOff3.cpp.


Here is the caller graph for this function:

PayOffCall::PayOffCall PayOffCall::clone

4.7.2.2 virtual PayOffCall::∼PayOffCall ( ) [inline], [virtual]

Definition at line 31 of file PayOff3.h.

4.7.3 Member Function Documentation

4.7.3.1 PayOff ∗ PayOffCall::clone ( ) const [virtual]

Implements PayOff.
Definition at line 19 of file PayOff3.cpp.
Here is the call graph for this function:

PayOffCall::clone PayOffCall::PayOffCall

4.7.3.2 double PayOffCall::operator() ( double Spot ) const [virtual]

Implements PayOff.
Definition at line 14 of file PayOff3.cpp.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


22 Class Documentation

Here is the call graph for this function:

PayOffCall::operator() max

The documentation for this class was generated from the following files:

• PayOff3.h
• PayOff3.cpp

4.8 PayOffPut Class Reference

#include <PayOff3.h>
Inheritance diagram for PayOffPut:

PayOff

PayOffPut

Collaboration diagram for PayOffPut:

PayOff

PayOffPut

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.8 PayOffPut Class Reference 23

Public Member Functions

• PayOffPut (double Strike_)


• virtual double operator() (double Spot) const
• virtual ∼PayOffPut ()
• virtual PayOff ∗ clone () const

4.8.1 Detailed Description

Definition at line 41 of file PayOff3.h.

4.8.2 Constructor & Destructor Documentation

4.8.2.1 PayOffPut::PayOffPut ( double Strike_ )

Definition at line 30 of file PayOff3.cpp.


Here is the caller graph for this function:

PayOffPut::PayOffPut PayOffPut::clone

4.8.2.2 virtual PayOffPut::∼PayOffPut ( ) [inline], [virtual]

Definition at line 48 of file PayOff3.h.

4.8.3 Member Function Documentation

4.8.3.1 PayOff ∗ PayOffPut::clone ( ) const [virtual]

Implements PayOff.
Definition at line 34 of file PayOff3.cpp.
Here is the call graph for this function:

PayOffPut::clone PayOffPut::PayOffPut

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


24 Class Documentation

4.8.3.2 double PayOffPut::operator() ( double Spot ) const [virtual]

Implements PayOff.
Definition at line 25 of file PayOff3.cpp.
Here is the call graph for this function:

PayOffPut::operator() max

The documentation for this class was generated from the following files:

• PayOff3.h
• PayOff3.cpp

4.9 StatisticsMC Class Reference

#include <MCStatistics.h>
Inheritance diagram for StatisticsMC:

StatisticsMC

ConvergenceTable StatisticsMean

Public Member Functions

• StatisticsMC ()
• virtual void DumpOneResult (double result)=0
• virtual std::vector
< std::vector< double > > GetResultsSoFar () const =0
• virtual StatisticsMC ∗ clone () const =0
• virtual ∼StatisticsMC ()

4.9.1 Detailed Description

Definition at line 13 of file MCStatistics.h.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.9 StatisticsMC Class Reference 25

4.9.2 Constructor & Destructor Documentation

4.9.2.1 StatisticsMC::StatisticsMC ( ) [inline]

Definition at line 17 of file MCStatistics.h.

4.9.2.2 virtual StatisticsMC::∼StatisticsMC ( ) [inline], [virtual]

Definition at line 22 of file MCStatistics.h.

4.9.3 Member Function Documentation

4.9.3.1 virtual StatisticsMC∗ StatisticsMC::clone ( ) const [pure virtual]

Implemented in StatisticsMean, and ConvergenceTable.

4.9.3.2 virtual void StatisticsMC::DumpOneResult ( double result ) [pure virtual]

Implemented in StatisticsMean, and ConvergenceTable.


Here is the caller graph for this function:

ConvergenceTable::DumpOne
Result
StatisticsMC::DumpOneResult

SimpleMonteCarlo5 main

4.9.3.3 virtual std::vector<std::vector<double> > StatisticsMC::GetResultsSoFar ( ) const [pure virtual]

Implemented in StatisticsMean, and ConvergenceTable.


Here is the caller graph for this function:

ConvergenceTable::DumpOne
Result
StatisticsMC::GetResults
SoFar
ConvergenceTable::GetResults
main
SoFar

The documentation for this class was generated from the following file:

• MCStatistics.h

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


26 Class Documentation

4.10 StatisticsMean Class Reference

#include <MCStatistics.h>
Inheritance diagram for StatisticsMean:

StatisticsMC

StatisticsMean

Collaboration diagram for StatisticsMean:

StatisticsMC

StatisticsMean

Public Member Functions

• StatisticsMean ()
• virtual void DumpOneResult (double result)
• virtual std::vector
< std::vector< double > > GetResultsSoFar () const
• virtual StatisticsMC ∗ clone () const

4.10.1 Detailed Description

Definition at line 29 of file MCStatistics.h.

4.10.2 Constructor & Destructor Documentation

4.10.2.1 StatisticsMean::StatisticsMean ( )

Definition at line 11 of file MCStatistics.cpp.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.11 VanillaOption Class Reference 27

Here is the caller graph for this function:

StatisticsMean::StatisticsMean StatisticsMean::clone

4.10.3 Member Function Documentation

4.10.3.1 StatisticsMC ∗ StatisticsMean::clone ( ) const [virtual]

Implements StatisticsMC.
Definition at line 33 of file MCStatistics.cpp.
Here is the call graph for this function:

StatisticsMean::clone StatisticsMean::StatisticsMean

4.10.3.2 void StatisticsMean::DumpOneResult ( double result ) [virtual]

Implements StatisticsMC.
Definition at line 17 of file MCStatistics.cpp.

4.10.3.3 vector< vector< double > > StatisticsMean::GetResultsSoFar ( ) const [virtual]

Implements StatisticsMC.
Definition at line 23 of file MCStatistics.cpp.
The documentation for this class was generated from the following files:

• MCStatistics.h
• MCStatistics.cpp

4.11 VanillaOption Class Reference

#include <Vanilla3.h>

Public Member Functions

• VanillaOption (const PayOffBridge &ThePayOff_, double Expiry)

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


28 Class Documentation

• double OptionPayOff (double Spot) const


• double GetExpiry () const

4.11.1 Detailed Description

Definition at line 11 of file Vanilla3.h.

4.11.2 Constructor & Destructor Documentation

4.11.2.1 VanillaOption::VanillaOption ( const PayOffBridge & ThePayOff_, double Expiry )

Definition at line 8 of file Vanilla3.cpp.

4.11.3 Member Function Documentation

4.11.3.1 double VanillaOption::GetExpiry ( ) const

Definition at line 13 of file Vanilla3.cpp.


Here is the caller graph for this function:

VanillaOption::GetExpiry SimpleMonteCarlo5 main

4.11.3.2 double VanillaOption::OptionPayOff ( double Spot ) const

Definition at line 18 of file Vanilla3.cpp.


Here is the caller graph for this function:

VanillaOption::OptionPayOff SimpleMonteCarlo5 main

The documentation for this class was generated from the following files:

• Vanilla3.h
• Vanilla3.cpp

4.12 Wrapper< T > Class Template Reference

#include <wrapper.h>

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


4.12 Wrapper< T > Class Template Reference 29

Public Member Functions

• Wrapper ()
• Wrapper (const T &inner)
• ∼Wrapper ()
• Wrapper (const Wrapper< T > &original)
• Wrapper & operator= (const Wrapper< T > &original)
• T & operator∗ ()
• const T & operator∗ () const
• const T ∗const operator-> () const
• T ∗ operator-> ()

4.12.1 Detailed Description

template<class T>class Wrapper< T >

Definition at line 11 of file wrapper.h.

4.12.2 Constructor & Destructor Documentation

4.12.2.1 template<class T> Wrapper< T >::Wrapper ( ) [inline]

Definition at line 15 of file wrapper.h.

4.12.2.2 template<class T> Wrapper< T >::Wrapper ( const T & inner ) [inline]

Definition at line 18 of file wrapper.h.

4.12.2.3 template<class T> Wrapper< T >::∼Wrapper ( ) [inline]

Definition at line 23 of file wrapper.h.

4.12.2.4 template<class T> Wrapper< T >::Wrapper ( const Wrapper< T > & original ) [inline]

Definition at line 29 of file wrapper.h.

4.12.3 Member Function Documentation

4.12.3.1 template<class T> T& Wrapper< T >::operator∗ ( ) [inline]

Definition at line 51 of file wrapper.h.

4.12.3.2 template<class T> const T& Wrapper< T >::operator∗ ( ) const [inline]

Definition at line 56 of file wrapper.h.

4.12.3.3 template<class T> const T∗ const Wrapper< T >::operator-> ( ) const [inline]

Definition at line 61 of file wrapper.h.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


30 Class Documentation

4.12.3.4 template<class T> T∗ Wrapper< T >::operator-> ( ) [inline]

Definition at line 66 of file wrapper.h.

4.12.3.5 template<class T> Wrapper& Wrapper< T >::operator= ( const Wrapper< T > & original ) [inline]

Definition at line 37 of file wrapper.h.


The documentation for this class was generated from the following file:

• wrapper.h

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


Chapter 5

File Documentation

5.1 ConvergenceTable.cpp File Reference

#include "ConvergenceTable.h"
Include dependency graph for ConvergenceTable.cpp:

ConvergenceTable.cpp

ConvergenceTable.h

MCStatistics.h wrapper.h

vector

5.2 ConvergenceTable.h File Reference

#include "MCStatistics.h"
#include "wrapper.h"
32 File Documentation

Include dependency graph for ConvergenceTable.h:

ConvergenceTable.h

MCStatistics.h wrapper.h

vector

This graph shows which files directly or indirectly include this file:

ConvergenceTable.h

ConvergenceTable.cpp StatsMain2.cpp

Classes

• class ConvergenceTable

5.3 MCStatistics.cpp File Reference

#include "MCStatistics.h"

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


5.4 MCStatistics.h File Reference 33

Include dependency graph for MCStatistics.cpp:

MCStatistics.cpp

MCStatistics.h

vector

5.4 MCStatistics.h File Reference

#include <vector>
Include dependency graph for MCStatistics.h:

MCStatistics.h

vector

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


34 File Documentation

This graph shows which files directly or indirectly include this file:

MCStatistics.h

ConvergenceTable.h MCStatistics.cpp SimpleMC7.h

ConvergenceTable.cpp StatsMain2.cpp SimpleMC7.cpp

Classes

• class StatisticsMC
• class StatisticsMean

5.5 MinMax.h File Reference

This graph shows which files directly or indirectly include this file:

MinMax.h

PayOff3.cpp

Functions

• template<class T >
const T & max (const T &a, const T &b)
• template<class T >
const T & min (const T &a, const T &b)

5.5.1 Function Documentation

5.5.1.1 template<class T > const T& max ( const T & a, const T & b )

Definition at line 12 of file MinMax.h.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


5.6 Parameters.cpp File Reference 35

Here is the caller graph for this function:

PayOffCall::operator()
max
PayOffPut::operator()

5.5.1.2 template<class T > const T& min ( const T & a, const T & b )

Definition at line 18 of file MinMax.h.

5.6 Parameters.cpp File Reference

#include "Parameters.h"
Include dependency graph for Parameters.cpp:

Parameters.cpp

Parameters.h

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


36 File Documentation

5.7 Parameters.h File Reference

This graph shows which files directly or indirectly include this file:

Parameters.h

Parameters.cpp SimpleMC7.h

SimpleMC7.cpp StatsMain2.cpp

Classes

• class ParametersInner
• class Parameters
• class ParametersConstant

5.8 PayOff3.cpp File Reference

#include "PayOff3.h"
#include "MinMax.h"
Include dependency graph for PayOff3.cpp:

PayOff3.cpp

PayOff3.h MinMax.h

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


5.9 PayOff3.h File Reference 37

5.9 PayOff3.h File Reference

This graph shows which files directly or indirectly include this file:

PayOff3.h

PayOff3.cpp PayOffBridge.h

PayOffBridge.cpp Vanilla3.h

SimpleMC7.h Vanilla3.cpp

SimpleMC7.cpp StatsMain2.cpp

Classes

• class PayOff

• class PayOffCall

• class PayOffPut

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


38 File Documentation

5.10 PayOffBridge.cpp File Reference

#include "PayOffBridge.h"
Include dependency graph for PayOffBridge.cpp:

PayOffBridge.cpp

PayOffBridge.h

PayOff3.h

5.11 PayOffBridge.h File Reference

#include "PayOff3.h"
Include dependency graph for PayOffBridge.h:

PayOffBridge.h

PayOff3.h

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


5.12 Random1.cpp File Reference 39

This graph shows which files directly or indirectly include this file:

PayOffBridge.h

PayOffBridge.cpp Vanilla3.h

SimpleMC7.h Vanilla3.cpp

SimpleMC7.cpp StatsMain2.cpp

Classes

• class PayOffBridge

5.12 Random1.cpp File Reference

#include "Random1.h"
#include <cstdlib>
#include <cmath>
Include dependency graph for Random1.cpp:

Random1.cpp

Random1.h cstdlib cmath

Functions

• double GetOneGaussianBySummation ()

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


40 File Documentation

• double GetOneGaussianByBoxMuller ()

5.12.1 Function Documentation

5.12.1.1 double GetOneGaussianByBoxMuller ( )

Definition at line 31 of file Random1.cpp.


Here is the caller graph for this function:

GetOneGaussianByBoxMuller SimpleMonteCarlo5 main

5.12.1.2 double GetOneGaussianBySummation ( )

Definition at line 17 of file Random1.cpp.

5.13 Random1.h File Reference

This graph shows which files directly or indirectly include this file:

Random1.h

Random1.cpp SimpleMC7.cpp

Functions

• double GetOneGaussianBySummation ()
• double GetOneGaussianByBoxMuller ()

5.13.1 Function Documentation

5.13.1.1 double GetOneGaussianByBoxMuller ( )

Definition at line 31 of file Random1.cpp.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


5.14 SimpleMC7.cpp File Reference 41

Here is the caller graph for this function:

GetOneGaussianByBoxMuller SimpleMonteCarlo5 main

5.13.1.2 double GetOneGaussianBySummation ( )

Definition at line 17 of file Random1.cpp.

5.14 SimpleMC7.cpp File Reference

#include "SimpleMC7.h"
#include "Random1.h"
#include <cmath>
Include dependency graph for SimpleMC7.cpp:

SimpleMC7.cpp

SimpleMC7.h Random1.h cmath

Vanilla3.h Parameters.h MCStatistics.h

PayOffBridge.h vector

PayOff3.h

Functions

• void SimpleMonteCarlo5 (const VanillaOption &TheOption, double Spot, const Parameters &Vol, const Pa-
rameters &r, unsigned long NumberOfPaths, StatisticsMC &gatherer)

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


42 File Documentation

5.14.1 Function Documentation

5.14.1.1 void SimpleMonteCarlo5 ( const VanillaOption & TheOption, double Spot, const Parameters & Vol, const
Parameters & r, unsigned long NumberOfPaths, StatisticsMC & gatherer )

Definition at line 17 of file SimpleMC7.cpp.


Here is the call graph for this function:

VanillaOption::GetExpiry

ParametersInner::Integral
Parameters::IntegralSquare Square

Parameters::Integral ParametersInner::Integral
SimpleMonteCarlo5
GetOneGaussianByBoxMuller

VanillaOption::OptionPayOff

StatisticsMC::DumpOneResult

Here is the caller graph for this function:

SimpleMonteCarlo5 main

5.15 SimpleMC7.h File Reference

#include "Vanilla3.h"
#include "Parameters.h"
#include "MCStatistics.h"

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


5.15 SimpleMC7.h File Reference 43

Include dependency graph for SimpleMC7.h:

SimpleMC7.h

Vanilla3.h Parameters.h MCStatistics.h

PayOffBridge.h vector

PayOff3.h

This graph shows which files directly or indirectly include this file:

SimpleMC7.h

SimpleMC7.cpp StatsMain2.cpp

Functions

• void SimpleMonteCarlo5 (const VanillaOption &TheOption, double Spot, const Parameters &Vol, const Pa-
rameters &r, unsigned long NumberOfPaths, StatisticsMC &gatherer)

5.15.1 Function Documentation

5.15.1.1 void SimpleMonteCarlo5 ( const VanillaOption & TheOption, double Spot, const Parameters & Vol, const
Parameters & r, unsigned long NumberOfPaths, StatisticsMC & gatherer )

Definition at line 17 of file SimpleMC7.cpp.

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


44 File Documentation

Here is the call graph for this function:

VanillaOption::GetExpiry

ParametersInner::Integral
Parameters::IntegralSquare Square

Parameters::Integral ParametersInner::Integral
SimpleMonteCarlo5
GetOneGaussianByBoxMuller

VanillaOption::OptionPayOff

StatisticsMC::DumpOneResult

Here is the caller graph for this function:

SimpleMonteCarlo5 main

5.16 StatsMain2.cpp File Reference

#include "SimpleMC7.h"
#include <iostream>
#include "Vanilla3.h"
#include "MCStatistics.h"
#include "ConvergenceTable.h"

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


5.17 Vanilla3.cpp File Reference 45

Include dependency graph for StatsMain2.cpp:

StatsMain2.cpp

SimpleMC7.h iostream ConvergenceTable.h

Vanilla3.h Parameters.h MCStatistics.h wrapper.h

PayOffBridge.h vector

PayOff3.h

Functions

• int main ()

5.16.1 Function Documentation

5.16.1.1 int main ( )

Definition at line 25 of file StatsMain2.cpp.


Here is the call graph for this function:

VanillaOption::GetExpiry

ParametersInner::Integral
Parameters::IntegralSquare Square

Parameters::Integral ParametersInner::Integral

SimpleMonteCarlo5 GetOneGaussianByBoxMuller

main VanillaOption::OptionPayOff

ConvergenceTable::GetResults StatisticsMC::DumpOneResult
SoFar

StatisticsMC::GetResults
SoFar

5.17 Vanilla3.cpp File Reference

#include "Vanilla3.h"

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


46 File Documentation

Include dependency graph for Vanilla3.cpp:

Vanilla3.cpp

Vanilla3.h

PayOffBridge.h

PayOff3.h

5.18 Vanilla3.h File Reference

#include "PayOffBridge.h"
Include dependency graph for Vanilla3.h:

Vanilla3.h

PayOffBridge.h

PayOff3.h

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen


5.19 wrapper.h File Reference 47

This graph shows which files directly or indirectly include this file:

Vanilla3.h

SimpleMC7.h Vanilla3.cpp

SimpleMC7.cpp StatsMain2.cpp

Classes

• class VanillaOption

5.19 wrapper.h File Reference

This graph shows which files directly or indirectly include this file:

wrapper.h

ConvergenceTable.h

ConvergenceTable.cpp StatsMain2.cpp

Classes

• class Wrapper< T >

Generated on Sat Feb 28 2015 15:33:44 for My Project by Doxygen

Das könnte Ihnen auch gefallen