|
@@ -46,7 +46,7 @@ specifically http://docs.nvidia.com/cuda/curand/index.html#topic_1_2_1 |
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
#include <math.h>
|
|
// #include <curand_kernel.h>
|
|
#include <random>
|
|
|
|
|
|
#define PI 3.14159265359f
|
|
#define PI 3.14159265359f
|
|
|
|
|
|
@@ -272,11 +272,13 @@ void sample_theta(float *theta, float *log_theta, int *y, float *n, |
|
float a, float b, int K){
|
|
float a, float b, int K){
|
|
|
|
|
|
float hyperA, hyperB;
|
|
float hyperA, hyperB;
|
|
|
|
std::default_random_engine generator;
|
|
|
|
|
|
for ( int i = 0; i < K; i++ ){
|
|
for ( int i = 0; i < K; i++ ){
|
|
hyperA = a + y[i];
|
|
hyperA = a + y[i];
|
|
hyperB = b + n[i];
|
|
hyperB = b + n[i];
|
|
theta[i] = rgamma(hyperA, hyperB);
|
|
std::gamma_distribution<double> distribution(hyperA, hyperB);
|
|
|
|
theta[i] = distribution(generator);
|
|
log_theta[i] = log(theta[i]);
|
|
log_theta[i] = log(theta[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|