QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
rngtraits.hpp
Go to the documentation of this file.
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
22/*! \file rngtraits.hpp
23 \brief random-number generation policies
24*/
25
26#ifndef quantlib_rng_traits_hpp
27#define quantlib_rng_traits_hpp
28
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
66 //! default traits for pseudo-random number generation
67 /*! \test a sequence generator is generated and tested by comparing
68 samples against known good values.
69 */
72
73 //! traits for Poisson-distributed pseudo-random number generation
74 /*! \test sequence generators are generated and tested by comparing
75 samples against known good values.
76 */
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
103 //! default traits for low-discrepancy sequence generation
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
Inverse cumulative Gaussian random-number generator.
Inverse cumulative random sequence generator.
Mersenne Twister uniform random number generator.
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
normal, cumulative and inverse cumulative distributions
Generates random paths using a sequence generator.
Poisson distribution.
Random sequence generator based on a pseudo-random number generator.
Sobol low-discrepancy sequence generator.
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