QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
burley2020sobolrsg.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) 2023 Peter Caspers
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/*! \file burley2020sobolrsg.hpp
21 \brief scrambled Sobol sequence following Burley, 2020
22*/
23
24#ifndef quantlib_burley2020_scrambled_sobolrsg_hpp
25#define quantlib_burley2020_scrambled_sobolrsg_hpp
26
28#include <ql/shared_ptr.hpp>
29
30namespace QuantLib {
31
32 //! Scrambled sobol sequence according to Burley, 2020
33 /*! Reference: Brent Burley: Practical Hash-based Owen Scrambling,
34 Journal of Computer Graphics Techniques, Vol. 9, No. 4, 2020 */
36 public:
38 explicit Burley2020SobolRsg(
39 Size dimensionality,
40 unsigned long seed = 42,
42 unsigned long scrambleSeed = 43);
43 const std::vector<std::uint32_t>& skipTo(std::uint32_t n) const;
44 const std::vector<std::uint32_t>& nextInt32Sequence() const;
46 const sample_type& lastSequence() const { return sequence_; }
47 Size dimension() const { return dimensionality_; }
48
49 private:
50 void reset() const;
52 unsigned long seed_;
54 mutable ext::shared_ptr<SobolRsg> sobolRsg_;
55 mutable std::vector<std::uint32_t> integerSequence_;
57 mutable std::uint32_t nextSequenceCounter_;
58 mutable std::vector<std::uint32_t> group4Seeds_;
59 };
60
61}
62
63
64#endif
Scrambled sobol sequence according to Burley, 2020.
const std::vector< std::uint32_t > & skipTo(std::uint32_t n) const
SobolRsg::DirectionIntegers directionIntegers_
const std::vector< std::uint32_t > & nextInt32Sequence() const
ext::shared_ptr< SobolRsg > sobolRsg_
std::vector< std::uint32_t > group4Seeds_
const SobolRsg::sample_type & nextSequence() const
const sample_type & lastSequence() const
std::vector< std::uint32_t > integerSequence_
Sample< std::vector< Real > > sample_type
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
Maps shared_ptr to either the boost or std implementation.
Sobol low-discrepancy sequence generator.
weighted sample
Definition: sample.hpp:35