QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
faurersg.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) 2004 Gianni Piolanti
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
25#ifndef quantlib_faure_ld_rsg_h
26#define quantlib_faure_ld_rsg_h
27
28#include <ql/math/matrix.hpp>
29#include <ql/methods/montecarlo/sample.hpp>
30#include <vector>
31
32
33namespace QuantLib {
34
36
46 class FaureRsg {
47 public:
49 FaureRsg(Size dimensionality);
50 const std::vector<long int>& nextIntSequence() const {
52 return integerSequence_;
53 }
54 const std::vector<long int>& lastIntSequence() const {
55 return integerSequence_;
56 }
57 const sample_type& nextSequence() const {
59 for (Size i=0; i<dimensionality_; i++)
61 return sequence_;
62 }
63 const sample_type& lastSequence() const { return sequence_; }
64 Size dimension() const { return dimensionality_; }
65 private:
66 void generateNextIntSequence() const;
68 // mutable unsigned long sequenceCounter_;
70 mutable std::vector<long int> integerSequence_;
71 mutable std::vector<long int> bary_;
72 mutable std::vector<std::vector<long int> > gray_;
74 std::vector<std::vector<long int> > powBase_;
75 std::vector<long int> addOne_;
76 std::vector<std::vector<std::vector<long int> > > pascal3D;
78 };
79
80}
81
82#endif
83
84
Faure low-discrepancy sequence generator.
Definition: faurersg.hpp:46
const sample_type & nextSequence() const
Definition: faurersg.hpp:57
const std::vector< long int > & nextIntSequence() const
Definition: faurersg.hpp:50
double normalizationFactor_
Definition: faurersg.hpp:77
std::vector< std::vector< long int > > gray_
Definition: faurersg.hpp:72
Size dimension() const
Definition: faurersg.hpp:64
sample_type sequence_
Definition: faurersg.hpp:69
std::vector< long int > addOne_
Definition: faurersg.hpp:75
const std::vector< long int > & lastIntSequence() const
Definition: faurersg.hpp:54
std::vector< long int > integerSequence_
Definition: faurersg.hpp:70
const sample_type & lastSequence() const
Definition: faurersg.hpp:63
std::vector< std::vector< long int > > powBase_
Definition: faurersg.hpp:74
std::vector< std::vector< std::vector< long int > > > pascal3D
Definition: faurersg.hpp:76
void generateNextIntSequence() const
Definition: faurersg.cpp:109
Sample< std::vector< Real > > sample_type
Definition: faurersg.hpp:48
std::vector< long int > bary_
Definition: faurersg.hpp:71
std::size_t Size
size of a container
Definition: types.hpp:58
Definition: any.hpp:35
weighted sample
Definition: sample.hpp:35