StochTree 0.0.1
Loading...
Searching...
No Matches
gamma_sampler.h
1
2#ifndef STOCHTREE_GAMMA_SAMPLER_H_
3#define STOCHTREE_GAMMA_SAMPLER_H_
4
5#include <random>
6
7namespace StochTree {
8
10 public:
11 GammaSampler() {}
12 ~GammaSampler() {}
13 double Sample(double a, double b, std::mt19937& gen, bool rate_param = true) {
14 double scale = rate_param ? 1./b : b;
15 gamma_dist_ = std::gamma_distribution<double>(a, scale);
16 return gamma_dist_(gen);
17 }
18 private:
20 std::gamma_distribution<double> gamma_dist_;
21};
22
23} // namespace StochTree
24
25#endif // STOCHTREE_IG_SAMPLER_H_
Definition gamma_sampler.h:9
Definition category_tracker.h:40