24#ifndef quantlib_randomized_lds_hpp
25#define quantlib_randomized_lds_hpp
58 class PRS = RandomSequenceGenerator<MersenneTwisterUniformRng> >
86 template <
class LDS,
class PRS>
88 : ldsg_(ldsg), pristineldsg_(ldsg), prsg_(
std::move(prsg)), dimension_(ldsg_.dimension()),
89 x(
std::vector<
Real>(dimension_), 1.0), randomizer_(
std::vector<
Real>(dimension_), 1.0) {
92 "generator mismatch: "
94 <<
"and " <<
prsg_.dimension() <<
"-dim pseudo random");
99 template <
class LDS,
class PRS>
101 : ldsg_(ldsg), pristineldsg_(ldsg),
102 prsg_(ldsg_.dimension()), dimension_(ldsg_.dimension()),
103 x(
std::vector<
Real> (dimension_), 1.0), randomizer_(
std::vector<
Real> (dimension_), 1.0) {
109 template <
class LDS,
class PRS>
113 : ldsg_(dimensionality, ldsSeed), pristineldsg_(dimensionality, ldsSeed),
114 prsg_(dimensionality, prsSeed), dimension_(dimensionality),
115 x(
std::vector<
Real> (dimensionality), 1.0), randomizer_(
std::vector<
Real> (dimensionality), 1.0) {
120 template <
class LDS,
class PRS>
123 typename LDS::sample_type sample =
124 ldsg_.nextSequence();
125 x.
weight = randomizer_.weight * sample.weight;
126 for (
Size i = 0; i < dimension_; i++) {
127 x.value[i] = randomizer_.value[i] + sample.value[i];
Randomized (random shift) low-discrepancy sequence.
RandomizedLDS(const LDS &ldsg, PRS prsg)
const sample_type & nextSequence() const
returns next sample using a given randomizing vector
const sample_type & lastSequence() const
Sample< std::vector< Real > > sample_type
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
std::size_t Size
size of a container
unsigned QL_BIG_INTEGER BigNatural
large positive integer
Random sequence generator based on a pseudo-random number generator.