QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
rngtraits.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2004 Ferdinando Ametrano
5 Copyright (C) 2000, 2001, 2002, 2003 RiskMap srl
6 Copyright (C) 2004 Walter Penschke
7
8 This file is part of QuantLib, a free-software/open-source library
9 for financial quantitative analysts and developers - http://quantlib.org/
10
11 QuantLib is free software: you can redistribute it and/or modify it
12 under the terms of the QuantLib license. You should have received a
13 copy of the license along with this program; if not, please email
14 <quantlib-dev@lists.sf.net>. The license is also available online at
15 <http://quantlib.org/license.shtml>.
16
17 This program is distributed in the hope that it will be useful, but WITHOUT
18 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 FOR A PARTICULAR PURPOSE. See the license for more details.
20*/
21
26#ifndef quantlib_rng_traits_hpp
27#define quantlib_rng_traits_hpp
28
29#include <ql/methods/montecarlo/pathgenerator.hpp>
30#include <ql/math/randomnumbers/mt19937uniformrng.hpp>
31#include <ql/math/randomnumbers/inversecumulativerng.hpp>
32#include <ql/math/randomnumbers/randomsequencegenerator.hpp>
33#include <ql/math/randomnumbers/sobolrsg.hpp>
34#include <ql/math/randomnumbers/inversecumulativersg.hpp>
35#include <ql/math/distributions/normaldistribution.hpp>
36#include <ql/math/distributions/poissondistribution.hpp>
37
38namespace QuantLib {
39
40 // random number traits
41
42 template <class URNG, class IC>
44 // typedefs
45 typedef URNG urng_type;
49 // more traits
50 enum { allowsErrorEstimate = 1 };
51 // factory
53 BigNatural seed) {
54 ursg_type g(dimension, seed);
55 return (icInstance ? rsg_type(g, *icInstance) : rsg_type(g));
56 }
57 // data
58 static ext::shared_ptr<IC> icInstance;
59 };
60
61 // static member initialization
62 template<class URNG, class IC>
64
65
67
72
74
79
80
81 template <class URSG, class IC>
83 // typedefs
84 typedef URSG ursg_type;
86 // more traits
87 enum { allowsErrorEstimate = 0 };
88 // factory
90 BigNatural seed) {
91 ursg_type g(dimension, seed);
92 return (icInstance ? rsg_type(g, *icInstance) : rsg_type(g));
93 }
94 // data
95 static ext::shared_ptr<IC> icInstance;
96 };
97
98 // static member initialization
99 template<class URSG, class IC>
101
102
106
107}
108
109
110#endif
Inverse cumulative normal distribution function.
Inverse cumulative Poisson distribution function.
Inverse cumulative random number generator.
Inverse cumulative random sequence generator.
Uniform random number generator.
Random sequence generator based on a pseudo-random number generator.
Sobol low-discrepancy sequence generator.
Definition: sobolrsg.hpp:110
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
GenericPseudoRandom< MersenneTwisterUniformRng, InverseCumulativePoisson > PoissonPseudoRandom
traits for Poisson-distributed pseudo-random number generation
Definition: rngtraits.hpp:78
GenericLowDiscrepancy< SobolRsg, InverseCumulativeNormal > LowDiscrepancy
default traits for low-discrepancy sequence generation
Definition: rngtraits.hpp:105
unsigned QL_BIG_INTEGER BigNatural
large positive integer
Definition: types.hpp:46
GenericPseudoRandom< MersenneTwisterUniformRng, InverseCumulativeNormal > PseudoRandom
default traits for pseudo-random number generation
Definition: rngtraits.hpp:71
static rsg_type make_sequence_generator(Size dimension, BigNatural seed)
Definition: rngtraits.hpp:89
InverseCumulativeRsg< ursg_type, IC > rsg_type
Definition: rngtraits.hpp:85
static ext::shared_ptr< IC > icInstance
Definition: rngtraits.hpp:95
InverseCumulativeRng< urng_type, IC > rng_type
Definition: rngtraits.hpp:46
static rsg_type make_sequence_generator(Size dimension, BigNatural seed)
Definition: rngtraits.hpp:52
InverseCumulativeRsg< ursg_type, IC > rsg_type
Definition: rngtraits.hpp:48
static ext::shared_ptr< IC > icInstance
Definition: rngtraits.hpp:58
RandomSequenceGenerator< urng_type > ursg_type
Definition: rngtraits.hpp:47