Skip to content

Commit

Permalink
Export Xoshiro256** RNG
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Oct 3, 2023
1 parent 881eeab commit 65aedc5
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions SWIG/randomnumbers.i
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ using QuantLib::Sample;
using QuantLib::LecuyerUniformRng;
using QuantLib::KnuthUniformRng;
using QuantLib::MersenneTwisterUniformRng;
using QuantLib::Xoshiro256StarStarUniformRng;

typedef QuantLib::PseudoRandom::urng_type UniformRandomGenerator;

Expand Down Expand Up @@ -97,6 +98,12 @@ class MersenneTwisterUniformRng {
Sample<Real> next() const;
};

class Xoshiro256StarStarUniformRng {
public:
Xoshiro256StarStarUniformRng(BigInteger seed = 0);
Sample<Real> next() const;
};

class UniformRandomGenerator {
public:
UniformRandomGenerator(BigInteger seed=0);
Expand All @@ -121,8 +128,8 @@ template<class RNG> class CLGaussianRng {

%template(CentralLimitLecuyerGaussianRng) CLGaussianRng<LecuyerUniformRng>;
%template(CentralLimitKnuthGaussianRng) CLGaussianRng<KnuthUniformRng>;
%template(CentralLimitMersenneTwisterGaussianRng)
CLGaussianRng<MersenneTwisterUniformRng>;
%template(CentralLimitMersenneTwisterGaussianRng) CLGaussianRng<MersenneTwisterUniformRng>;
%template(CentralLimitXoshiro256StarStarGaussianRng) CLGaussianRng<Xoshiro256StarStarUniformRng>;

template<class RNG> class BoxMullerGaussianRng {
public:
Expand All @@ -132,8 +139,8 @@ template<class RNG> class BoxMullerGaussianRng {

%template(BoxMullerLecuyerGaussianRng) BoxMullerGaussianRng<LecuyerUniformRng>;
%template(BoxMullerKnuthGaussianRng) BoxMullerGaussianRng<KnuthUniformRng>;
%template(BoxMullerMersenneTwisterGaussianRng)
BoxMullerGaussianRng<MersenneTwisterUniformRng>;
%template(BoxMullerMersenneTwisterGaussianRng) BoxMullerGaussianRng<MersenneTwisterUniformRng>;
%template(BoxMullerXoshiro256StarStarGaussianRng) BoxMullerGaussianRng<Xoshiro256StarStarUniformRng>;

template<class RNG, class F> class InverseCumulativeRng {
public:
Expand All @@ -146,15 +153,18 @@ template<class RNG, class F> class InverseCumulativeRng {
%template(MoroInvCumulativeKnuthGaussianRng)
InverseCumulativeRng<KnuthUniformRng,MoroInverseCumulativeNormal>;
%template(MoroInvCumulativeMersenneTwisterGaussianRng)
InverseCumulativeRng<MersenneTwisterUniformRng,
MoroInverseCumulativeNormal>;
InverseCumulativeRng<MersenneTwisterUniformRng,MoroInverseCumulativeNormal>;
%template(MoroInvCumulativeXoshiro256StarStarGaussianRng)
InverseCumulativeRng<Xoshiro256StarStarUniformRng,MoroInverseCumulativeNormal>;

%template(InvCumulativeLecuyerGaussianRng)
InverseCumulativeRng<LecuyerUniformRng,InverseCumulativeNormal>;
%template(InvCumulativeKnuthGaussianRng)
InverseCumulativeRng<KnuthUniformRng,InverseCumulativeNormal>;
%template(InvCumulativeMersenneTwisterGaussianRng)
InverseCumulativeRng<MersenneTwisterUniformRng,InverseCumulativeNormal>;
%template(InvCumulativeXoshiro256StarStarGaussianRng)
InverseCumulativeRng<Xoshiro256StarStarUniformRng,InverseCumulativeNormal>;

class GaussianRandomGenerator {
public:
Expand Down Expand Up @@ -225,6 +235,8 @@ template<class RNG> class RandomSequenceGenerator {
RandomSequenceGenerator<KnuthUniformRng>;
%template(MersenneTwisterUniformRsg)
RandomSequenceGenerator<MersenneTwisterUniformRng>;
%template(Xoshiro256StarStarUniformRsg)
RandomSequenceGenerator<Xoshiro256StarStarUniformRng>;

class UniformRandomSequenceGenerator {
public:
Expand Down Expand Up @@ -266,6 +278,9 @@ class InverseCumulativeRsg {
%template(MoroInvCumulativeMersenneTwisterGaussianRsg)
InverseCumulativeRsg<RandomSequenceGenerator<MersenneTwisterUniformRng>,
MoroInverseCumulativeNormal>;
%template(MoroInvCumulativeXoshiro256StarStarGaussianRsg)
InverseCumulativeRsg<RandomSequenceGenerator<Xoshiro256StarStarUniformRng>,
MoroInverseCumulativeNormal>;
%template(MoroInvCumulativeHaltonGaussianRsg)
InverseCumulativeRsg<HaltonRsg,MoroInverseCumulativeNormal>;
%template(MoroInvCumulativeSobolGaussianRsg)
Expand All @@ -280,6 +295,9 @@ class InverseCumulativeRsg {
%template(InvCumulativeMersenneTwisterGaussianRsg)
InverseCumulativeRsg<RandomSequenceGenerator<MersenneTwisterUniformRng>,
InverseCumulativeNormal>;
%template(InvCumulativeXoshiro256StarStarGaussianRsg)
InverseCumulativeRsg<RandomSequenceGenerator<Xoshiro256StarStarUniformRng>,
InverseCumulativeNormal>;
%template(InvCumulativeHaltonGaussianRsg)
InverseCumulativeRsg<HaltonRsg,InverseCumulativeNormal>;
%template(InvCumulativeSobolGaussianRsg)
Expand Down

0 comments on commit 65aedc5

Please sign in to comment.