Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean gnu directory #3225

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions src/gnu/Binomial.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,11 @@ class Binomial: public Random {
public:
Binomial(int n, double u, RNG *gen);

int n();
int n(int xn);

double u();
double u(int xu);

virtual double operator()();

double operator()() override;
};


inline Binomial::Binomial(int n, double u, RNG *gen)
: Random(gen){
pN = n; pU = u;
}

inline int Binomial::n() { return pN; }
inline int Binomial::n(int xn) { int tmp = pN; pN = xn; return tmp; }

inline double Binomial::u() { return pU; }
inline double Binomial::u(int xu) { double tmp = pU; pU = xu; return tmp; }
25 changes: 1 addition & 24 deletions src/gnu/DiscUnif.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ class DiscreteUniform: public Random {
public:
DiscreteUniform(long low, long high, RNG *gen);

long low();
long low(long x);
long high();
long high(long x);

virtual double operator()();
double operator()() override;
};


Expand All @@ -46,21 +41,3 @@ inline DiscreteUniform::DiscreteUniform(long low, long high, RNG *gen)
pHigh = (low < high) ? high : low;
delta = (pHigh - pLow) + 1;
}

inline long DiscreteUniform::low() { return pLow; }

inline long DiscreteUniform::low(long x) {
long tmp = pLow;
pLow = x;
delta = (pHigh - pLow) + 1;
return tmp;
}

inline long DiscreteUniform::high() { return pHigh; }

inline long DiscreteUniform::high(long x) {
long tmp = pHigh;
pHigh = x;
delta = (pHigh - pLow) + 1;
return tmp;
}
17 changes: 1 addition & 16 deletions src/gnu/Erlang.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ class Erlang: public Random {
public:
Erlang(double mean, double variance, RNG *gen);

double mean();
double mean(double x);
double variance();
double variance(double x);

virtual double operator()();
double operator()() override;

};

Expand All @@ -50,13 +45,3 @@ inline Erlang::Erlang(double mean, double variance, RNG *gen) : Random(gen)
pMean = mean; pVariance = variance;
setState();
}

inline double Erlang::mean() { return pMean; }
inline double Erlang::mean(double x) {
double tmp = pMean; pMean = x; setState(); return tmp;
};

inline double Erlang::variance() { return pVariance; }
inline double Erlang::variance(double x) {
double tmp = pVariance; pVariance = x; setState(); return tmp;
}
11 changes: 1 addition & 10 deletions src/gnu/Geom.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ class Geometric: public Random {
public:
Geometric(double mean, RNG *gen);

double mean();
double mean(double x);

virtual double operator()();
double operator()() override;

};

Expand All @@ -36,9 +33,3 @@ inline Geometric::Geometric(double mean, RNG *gen) : Random(gen)
{
pMean = mean;
}


inline double Geometric::mean() { return pMean; }
inline double Geometric::mean(double x) {
double tmp = pMean; pMean = x; return tmp;
}
21 changes: 1 addition & 20 deletions src/gnu/HypGeom.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,7 @@ class HyperGeometric: public Random {
public:
HyperGeometric(double mean, double variance, RNG *gen);

double mean();
double mean(double x);
double variance();
double variance(double x);

virtual double operator()();
double operator()() override;
};


Expand All @@ -48,17 +43,3 @@ inline HyperGeometric::HyperGeometric(double mean, double variance, RNG *gen)
pMean = mean; pVariance = variance;
setState();
}

inline double HyperGeometric::mean() { return pMean; };

inline double HyperGeometric::mean(double x) {
double t = pMean; pMean = x;
setState(); return t;
}

inline double HyperGeometric::variance() { return pVariance; }

inline double HyperGeometric::variance(double x) {
double t = pVariance; pVariance = x;
setState(); return t;
}
26 changes: 1 addition & 25 deletions src/gnu/LogNorm.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ class LogNormal: public Normal {
void setState();
public:
LogNormal(double mean, double variance, RNG *gen);
double mean();
double mean(double x);
double variance();
double variance(double x);
virtual double operator()();
double operator()() override;
};


Expand All @@ -50,23 +46,3 @@ inline LogNormal::LogNormal(double mean, double variance, RNG *gen)
logVariance = variance;
setState();
}

inline double LogNormal::mean() {
return logMean;
}

inline double LogNormal::mean(double x)
{
double t=logMean; logMean = x; setState();
return t;
}

inline double LogNormal::variance() {
return logVariance;
}

inline double LogNormal::variance(double x)
{
double t=logVariance; logVariance = x; setState();
return t;
}
10 changes: 1 addition & 9 deletions src/gnu/NegExp.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,12 @@ class NegativeExpntl: public Random {
double pMean;
public:
NegativeExpntl(double xmean, RNG *gen);
double mean();
double mean(double x);

virtual double operator()();
double operator()() override;
};


inline NegativeExpntl::NegativeExpntl(double xmean, RNG *gen)
: Random(gen) {
pMean = xmean;
}

inline double NegativeExpntl::mean() { return pMean; }
inline double NegativeExpntl::mean(double x) {
double t = pMean; pMean = x;
return t;
}
19 changes: 1 addition & 18 deletions src/gnu/Normal.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ class Normal: public Random {

public:
Normal(double xmean, double xvariance, RNG *gen);
double mean();
double mean(double x);
double variance();
double variance(double x);
virtual double operator()();
double operator()() override;
};


Expand All @@ -44,16 +40,3 @@ inline Normal::Normal(double xmean, double xvariance, RNG *gen)
pStdDev = sqrt(pVariance);
haveCachedNormal = 0;
}

inline double Normal::mean() { return pMean; };
inline double Normal::mean(double x) {
double t=pMean; pMean = x;
return t;
}

inline double Normal::variance() { return pVariance; }
inline double Normal::variance(double x) {
double t=pVariance; pVariance = x;
pStdDev = sqrt(pVariance);
return t;
};
12 changes: 1 addition & 11 deletions src/gnu/Poisson.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,11 @@ class Poisson: public Random {
public:
Poisson(double mean, RNG *gen);

double mean();
double mean(double x);

virtual double operator()();
double operator()() override;
};


inline Poisson::Poisson(double mean, RNG *gen)
: Random(gen) {
pMean = mean;
}

inline double Poisson::mean() { return pMean; }
inline double Poisson::mean(double x) {
double t = pMean;
pMean = x;
return t;
}
18 changes: 1 addition & 17 deletions src/gnu/RNG.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
#pragma once
#include <cstdint>
#include <limits>

class RNG {
public:
using result_type = std::uint32_t;

RNG() = default;
virtual ~RNG() = default;

// Return a long-words word of random bits
virtual result_type asLong() = 0;
virtual std::uint32_t asLong() = 0;
virtual void reset() = 0;

// Return random bits converted to a double
virtual double asDouble() = 0;

static constexpr result_type min() {
return std::numeric_limits<result_type>::min();
}
static constexpr result_type max() {
return std::numeric_limits<result_type>::max();
}
result_type operator()() {
return asLong();
}
};
25 changes: 1 addition & 24 deletions src/gnu/Uniform.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ class Uniform: public Random {
public:
Uniform(double low, double high, RNG *gen);

double low();
double low(double x);
double high();
double high(double x);

virtual double operator()();
double operator()() override;
};


Expand All @@ -45,21 +40,3 @@ inline Uniform::Uniform(double low, double high, RNG *gen) : Random(gen)
pHigh = (low < high) ? high : low;
delta = pHigh - pLow;
}

inline double Uniform::low() { return pLow; }

inline double Uniform::low(double x) {
double tmp = pLow;
pLow = x;
delta = pHigh - pLow;
return tmp;
}

inline double Uniform::high() { return pHigh; }

inline double Uniform::high(double x) {
double tmp = pHigh;
pHigh = x;
delta = pHigh - pLow;
return tmp;
}
24 changes: 1 addition & 23 deletions src/gnu/Weibull.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ class Weibull: public Random {
public:
Weibull(double alpha, double beta, RNG *gen);

double alpha();
double alpha(double x);

double beta();
double beta(double x);

virtual double operator()();
double operator()() override;
};


Expand All @@ -50,19 +44,3 @@ inline Weibull::Weibull(double alpha, double beta, RNG *gen) : Random(gen)
pBeta = beta;
setState();
}

inline double Weibull::alpha() { return pAlpha; }

inline double Weibull::alpha(double x) {
double tmp = pAlpha;
pAlpha = x;
setState();
return tmp;
}

inline double Weibull::beta() { return pBeta; };
inline double Weibull::beta(double x) {
double tmp = pBeta;
pBeta = x;
return tmp;
};
Loading