QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
haltonrsg.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2003 Ferdinando Ametrano
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
24#ifndef quantlib_halton_ld_rsg_h
25#define quantlib_halton_ld_rsg_h
26
27#include <ql/methods/montecarlo/sample.hpp>
28#include <vector>
29
30namespace QuantLib {
31
33
43 class HaltonRsg {
44 public:
46 explicit HaltonRsg(Size dimensionality,
47 unsigned long seed = 0,
48 bool randomStart = true,
49 bool randomShift = false);
50 const sample_type& nextSequence() const;
51 const sample_type& lastSequence() const {
52 return sequence_;
53 }
54 Size dimension() const {return dimensionality_;}
55 private:
57 mutable unsigned long sequenceCounter_ = 0;
59 std::vector<unsigned long> randomStart_;
60 std::vector<Real> randomShift_;
61 };
62}
63
64
65#endif
Halton low-discrepancy sequence generator.
Definition: haltonrsg.hpp:43
const sample_type & nextSequence() const
Definition: haltonrsg.cpp:56
std::vector< Real > randomShift_
Definition: haltonrsg.hpp:60
Size dimension() const
Definition: haltonrsg.hpp:54
sample_type sequence_
Definition: haltonrsg.hpp:58
const sample_type & lastSequence() const
Definition: haltonrsg.hpp:51
unsigned long sequenceCounter_
Definition: haltonrsg.hpp:57
Sample< std::vector< Real > > sample_type
Definition: haltonrsg.hpp:45
std::vector< unsigned long > randomStart_
Definition: haltonrsg.hpp:59
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
weighted sample
Definition: sample.hpp:35