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

Boosteigencompilewithboost146 #49

Merged
merged 3 commits into from
Jan 22, 2014
Merged
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
23 changes: 16 additions & 7 deletions src/caffe/util/math_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,15 @@ void caffe_vRngUniform(const int n, Dtype* r,

// FIXME check if boundaries are handled in the same way ?
// Fixed by caffe_nextafter
boost::random::uniform_real_distribution<Dtype> random_distribution(
boost::uniform_real<Dtype> random_distribution(
a, caffe_nextafter<Dtype>(b));
Caffe::random_generator_t &generator = Caffe::vsl_stream();
boost::variate_generator<Caffe::random_generator_t,
boost::uniform_real<Dtype> > variate_generator(
generator, random_distribution);

for(int i = 0; i < n; i += 1) {
r[i] = random_distribution(generator);
for (int i = 0; i < n; ++i) {
r[i] = variate_generator();
}
}

Expand Down Expand Up @@ -431,9 +434,12 @@ void caffe_vRngGaussian(const int n, Dtype* r, const Dtype a,
// the tests are irrelevant to the random numbers.
boost::normal_distribution<Dtype> random_distribution(a, sigma);
Caffe::random_generator_t &generator = Caffe::vsl_stream();
boost::variate_generator<Caffe::random_generator_t,
boost::normal_distribution<Dtype> > variate_generator(
generator, random_distribution);

for(int i = 0; i < n; i += 1) {
r[i] = random_distribution(generator);
for (int i = 0; i < n; ++i) {
r[i] = variate_generator();
}
}

Expand All @@ -454,9 +460,12 @@ void caffe_vRngBernoulli(const int n, Dtype* r, const double p) {
// FIXME check if parameters are handled in the same way ?
boost::bernoulli_distribution<Dtype> random_distribution(p);
Caffe::random_generator_t &generator = Caffe::vsl_stream();
boost::variate_generator<Caffe::random_generator_t,
boost::bernoulli_distribution<Dtype> > variate_generator(
generator, random_distribution);

for(int i = 0; i < n; i += 1) {
r[i] = random_distribution(generator);
for (int i = 0; i < n; ++i) {
r[i] = variate_generator();
}
}

Expand Down