hops
ChordStepDistributions.hpp
Go to the documentation of this file.
1 #ifndef HOPS_CHORDSTEPDISTRIBUTIONS_HPP
2 #define HOPS_CHORDSTEPDISTRIBUTIONS_HPP
3 
4 #include "../../RandomNumberGenerator/RandomNumberGenerator.hpp"
5 #include <random>
6 #include <string>
8 
9 namespace hops {
10  template<typename RealType = double>
12  public:
13  RealType draw(RandomNumberGenerator &randomNumberGenerator, RealType lowerLimit, RealType upperLimit) {
14  typename std::uniform_real_distribution<RealType>::param_type params(lowerLimit, upperLimit);
15  return uniformRealDistribution(randomNumberGenerator, params);
16  }
17 
18  constexpr RealType computeInverseNormalizationConstant(RealType, RealType, RealType) {
19  return 1.;
20  }
21 
22  private:
23  std::uniform_real_distribution<RealType> uniformRealDistribution;
24  };
25 
26  template<typename RealType = double>
28  public:
29  RealType draw(RandomNumberGenerator &randomNumberGenerator, RealType lowerLimit,
30  RealType upperLimit) {
31  return truncatedNormalDistribution(randomNumberGenerator, {stepSize, lowerLimit, upperLimit});
32  }
33 
34  RealType draw(RandomNumberGenerator &randomNumberGenerator,
35  double m_sigma,
36  RealType lowerLimit,
37  RealType upperLimit) {
38  return truncatedNormalDistribution(randomNumberGenerator, {m_sigma, lowerLimit, upperLimit});
39  }
40 
41  RealType getStepSize() const {
42  return stepSize;
43  }
44 
45  void setStepSize(RealType newStepSize) {
46  stepSize = newStepSize;
47  }
48 
49  RealType computeInverseNormalizationConstant(RealType m_sigma, RealType m_lowerBound, RealType m_upperBound) {
50  return truncatedNormalDistribution.inverseNormalization({m_sigma, m_lowerBound, m_upperBound});
51  }
52 
53  RealType computeProbabilityDensity(RealType x, RealType m_sigma, RealType m_lowerBound, RealType m_upperBound){
54  return truncatedNormalDistribution.probabilityDensity(x, m_sigma, m_lowerBound, m_upperBound);
55  }
56 
57  private:
58  RealType stepSize = 1.;
59  TruncatedNormalDistribution<RealType> truncatedNormalDistribution;
60  };
61 }
62 
63 #endif //HOPS_CHORDSTEPDISTRIBUTIONS_HPP
hops::UniformStepDistribution::draw
RealType draw(RandomNumberGenerator &randomNumberGenerator, RealType lowerLimit, RealType upperLimit)
Definition: ChordStepDistributions.hpp:13
hops::GaussianStepDistribution::getStepSize
RealType getStepSize() const
Definition: ChordStepDistributions.hpp:41
pcg_detail::engine
Definition: pcg_random.hpp:364
TruncatedNormalDistribution.hpp
hops::GaussianStepDistribution::computeInverseNormalizationConstant
RealType computeInverseNormalizationConstant(RealType m_sigma, RealType m_lowerBound, RealType m_upperBound)
Definition: ChordStepDistributions.hpp:49
hops::UniformStepDistribution
Definition: ChordStepDistributions.hpp:11
hops::GaussianStepDistribution::draw
RealType draw(RandomNumberGenerator &randomNumberGenerator, double m_sigma, RealType lowerLimit, RealType upperLimit)
Definition: ChordStepDistributions.hpp:34
hops
Definition: CsvReader.hpp:8
hops::GaussianStepDistribution
Definition: ChordStepDistributions.hpp:27
hops::GaussianStepDistribution::draw
RealType draw(RandomNumberGenerator &randomNumberGenerator, RealType lowerLimit, RealType upperLimit)
Definition: ChordStepDistributions.hpp:29
hops::TruncatedNormalDistribution
Truncated normal distribution with mean 0.
Definition: TruncatedNormalDistribution.hpp:13
hops::UniformStepDistribution::computeInverseNormalizationConstant
constexpr RealType computeInverseNormalizationConstant(RealType, RealType, RealType)
Definition: ChordStepDistributions.hpp:18
hops::GaussianStepDistribution::setStepSize
void setStepSize(RealType newStepSize)
Definition: ChordStepDistributions.hpp:45
hops::GaussianStepDistribution::computeProbabilityDensity
RealType computeProbabilityDensity(RealType x, RealType m_sigma, RealType m_lowerBound, RealType m_upperBound)
Definition: ChordStepDistributions.hpp:53