QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
sobolbrowniangenerator.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2006 StatPro Italia srl
5
6 This file is part of QuantLib, a free-software/open-source library
7 for financial quantitative analysts and developers - http://quantlib.org/
8
9 QuantLib is free software: you can redistribute it and/or modify it
10 under the terms of the QuantLib license. You should have received a
11 copy of the license along with this program; if not, please email
12 <quantlib-dev@lists.sf.net>. The license is also available online at
13 <http://quantlib.org/license.shtml>.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the license for more details.
18*/
19
20
21#ifndef quantlib_sobol_brownian_generator_hpp
22#define quantlib_sobol_brownian_generator_hpp
23
24#include <ql/models/marketmodels/browniangenerator.hpp>
25#include <ql/math/randomnumbers/inversecumulativersg.hpp>
26#include <ql/math/randomnumbers/sobolrsg.hpp>
27#include <ql/methods/montecarlo/brownianbridge.hpp>
28#include <ql/math/distributions/normaldistribution.hpp>
29#include <vector>
30
31namespace QuantLib {
32
34
38 public:
39 enum Ordering {
40 Factors,
42 Steps,
48 };
50 Size factors,
51 Size steps,
52 Ordering ordering,
53 unsigned long seed = 0,
54 SobolRsg::DirectionIntegers directionIntegers
56
57 Real nextPath() override;
58 Real nextStep(std::vector<Real>&) override;
59
60 Size numberOfFactors() const override;
61 Size numberOfSteps() const override;
62
63 // test interface
64 const std::vector<std::vector<Size> >& orderedIndices() const;
65 std::vector<std::vector<Real> > transform(
66 const std::vector<std::vector<Real> >& variates);
67
68 private:
73 // work variables
75 std::vector<std::vector<Size> > orderedIndices_;
76 std::vector<std::vector<Real> > bridgedVariates_;
77 };
78
80 public:
83 unsigned long seed = 0,
84 SobolRsg::DirectionIntegers directionIntegers
86 ext::shared_ptr<BrownianGenerator> create(Size factors, Size steps) const override;
87
88 private:
90 unsigned long seed_;
92 };
93
94}
95
96
97#endif
Builds Wiener process paths using Gaussian variates.
Inverse cumulative random sequence generator.
SobolBrownianGenerator::Ordering ordering_
ext::shared_ptr< BrownianGenerator > create(Size factors, Size steps) const override
Sobol Brownian generator for market-model simulations.
std::vector< std::vector< Size > > orderedIndices_
std::vector< std::vector< Real > > transform(const std::vector< std::vector< Real > > &variates)
Real nextStep(std::vector< Real > &) override
std::vector< std::vector< Real > > bridgedVariates_
const std::vector< std::vector< Size > > & orderedIndices() const
InverseCumulativeRsg< SobolRsg, InverseCumulativeNormal > generator_
QL_REAL Real
real number
Definition: types.hpp:50
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35