QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes | List of all members
ConvergenceStatistics< T, U > Class Template Reference

statistics class with convergence table More...

#include <convergencestatistics.hpp>

+ Inheritance diagram for ConvergenceStatistics< T, U >:
+ Collaboration diagram for ConvergenceStatistics< T, U >:

Public Types

typedef T::value_type value_type
 
typedef std::vector< std::pair< Size, value_type > > table_type
 

Public Member Functions

 ConvergenceStatistics (const T &stats, const U &rule=U())
 
 ConvergenceStatistics (const U &rule=U())
 
void add (const value_type &value, Real weight=1.0)
 
template<class DataIterator >
void addSequence (DataIterator begin, DataIterator end)
 
template<class DataIterator , class WeightIterator >
void addSequence (DataIterator begin, DataIterator end, WeightIterator wbegin)
 
void reset ()
 
const std::vector< std::pair< Size, value_type > > & convergenceTable () const
 

Private Attributes

table_type table_
 
samplingRule_
 
Size nextSampleSize_
 

Detailed Description

template<class T, class U = DoublingConvergenceSteps>
class QuantLib::ConvergenceStatistics< T, U >

statistics class with convergence table

This class decorates another statistics class adding a convergence table calculation. The table tracks the convergence of the mean.

It is possible to specify the number of samples at which the mean should be stored by mean of the second template parameter; the default is to store \( 2^{n-1} \) samples at the \( n \)-th step. Any passed class must implement the following interface:

Size initialSamples() const;
Size nextSamples(Size currentSamples) const;
std::size_t Size
size of a container
Definition: types.hpp:58

as well as a copy constructor.

Tests:
results are tested against known good values.

Definition at line 58 of file convergencestatistics.hpp.

Member Typedef Documentation

◆ value_type

typedef T::value_type value_type

Definition at line 60 of file convergencestatistics.hpp.

◆ table_type

typedef std::vector<std::pair<Size,value_type> > table_type

Definition at line 61 of file convergencestatistics.hpp.

Constructor & Destructor Documentation

◆ ConvergenceStatistics() [1/2]

ConvergenceStatistics ( const T stats,
const U &  rule = U() 
)

Definition at line 90 of file convergencestatistics.hpp.

+ Here is the call graph for this function:

◆ ConvergenceStatistics() [2/2]

ConvergenceStatistics ( const U &  rule = U())

Definition at line 97 of file convergencestatistics.hpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ add()

void add ( const value_type value,
Real  weight = 1.0 
)
+ Here is the caller graph for this function:

◆ addSequence() [1/2]

void addSequence ( DataIterator  begin,
DataIterator  end 
)

Definition at line 67 of file convergencestatistics.hpp.

+ Here is the call graph for this function:

◆ addSequence() [2/2]

void addSequence ( DataIterator  begin,
DataIterator  end,
WeightIterator  wbegin 
)

Definition at line 72 of file convergencestatistics.hpp.

+ Here is the call graph for this function:

◆ reset()

void reset

Definition at line 116 of file convergencestatistics.hpp.

+ Here is the caller graph for this function:

◆ convergenceTable()

const ConvergenceStatistics< T, U >::table_type & convergenceTable

Definition at line 124 of file convergencestatistics.hpp.

Member Data Documentation

◆ table_

table_type table_
private

Definition at line 81 of file convergencestatistics.hpp.

◆ samplingRule_

U samplingRule_
private

Definition at line 82 of file convergencestatistics.hpp.

◆ nextSampleSize_

Size nextSampleSize_
private

Definition at line 83 of file convergencestatistics.hpp.