Commit c06156bd authored by Manuel Günther's avatar Manuel Günther
Browse files

Next trial to remove erros on Travis.

parent c42e7e33
......@@ -10,27 +10,6 @@
#include <boost/random.hpp>
namespace bob { namespace core { namespace random {
// for completeness, we provide the interfaces for other distributions through bob::core::random
template <class UniformRandomNumberGenerator=double, class RealType=double>
using uniform_01 = boost::uniform_01<UniformRandomNumberGenerator,RealType>;
template <class IntType=int>
using uniform_smallint_distribution = boost::uniform_smallint<IntType>;
template <class IntType=int>
using uniform_int_distribution = boost::uniform_int<IntType>;
template <class RealType=double>
using uniform_real_distribution = boost::uniform_real<RealType>;
template <class RealType=double>
using gamma_distribution = boost::gamma_distribution<RealType>;
} } }
#include <boost/version.hpp>
#if BOOST_VERSION >= 105600
......
......@@ -10,6 +10,7 @@
#include <bob.blitz/cppapi.h>
#include <boost/make_shared.hpp>
#include <boost/random.hpp>
#include <bob.core/random.h>
PyDoc_STRVAR(s_gamma_str, BOB_EXT_MODULE_PREFIX ".gamma");
......@@ -52,7 +53,7 @@ template <typename T>
boost::shared_ptr<void> make_gamma(PyObject* alpha) {
T calpha = 1.;
if (alpha) calpha = PyBlitzArrayCxx_AsCScalar<T>(alpha);
return boost::make_shared<bob::core::random::gamma_distribution<T>>(calpha);
return boost::make_shared<boost::gamma_distribution<T>>(calpha);
}
PyObject* PyBoostGamma_SimpleNew (int type_num, PyObject* alpha) {
......@@ -129,7 +130,7 @@ int PyBoostGamma_Converter(PyObject* o, PyBoostGammaObject** a) {
}
template <typename T> PyObject* get_alpha(PyBoostGammaObject* self) {
return PyBlitzArrayCxx_FromCScalar(boost::static_pointer_cast<bob::core::random::gamma_distribution<T>>(self->distro)->alpha());
return PyBlitzArrayCxx_FromCScalar(boost::static_pointer_cast<boost::gamma_distribution<T>>(self->distro)->alpha());
}
/**
......@@ -155,7 +156,7 @@ static PyObject* PyBoostGamma_GetDtype(PyBoostGammaObject* self) {
}
template <typename T> PyObject* reset(PyBoostGammaObject* self) {
boost::static_pointer_cast<bob::core::random::gamma_distribution<T>>(self->distro)->reset();
boost::static_pointer_cast<boost::gamma_distribution<T>>(self->distro)->reset();
Py_RETURN_NONE;
}
......@@ -176,7 +177,7 @@ static PyObject* PyBoostGamma_Reset(PyBoostGammaObject* self) {
}
template <typename T> PyObject* call(PyBoostGammaObject* self, PyBoostMt19937Object* rng) {
typedef bob::core::random::gamma_distribution<T> distro_t;
typedef boost::gamma_distribution<T> distro_t;
return PyBlitzArrayCxx_FromCScalar((*boost::static_pointer_cast<distro_t>(self->distro))(*rng->rng));
}
......
......@@ -10,7 +10,7 @@
#include <bob.blitz/cppapi.h>
#include <boost/make_shared.hpp>
#include <bob.core/random.h>
#include <boost/random.hpp>
PyDoc_STRVAR(s_uniform_str, BOB_EXT_MODULE_PREFIX ".uniform");
......@@ -34,7 +34,7 @@ static void PyBoostUniform_Delete (PyBoostUniformObject* o) {
}
static boost::shared_ptr<void> make_uniform_bool() {
return boost::make_shared<bob::core::random::uniform_smallint_distribution<uint8_t>>(0, 1);
return boost::make_shared<boost::uniform_smallint<uint8_t>>(0, 1);
}
template <typename T>
......@@ -43,7 +43,7 @@ boost::shared_ptr<void> make_uniform_int(PyObject* min, PyObject* max) {
if (min) cmin = PyBlitzArrayCxx_AsCScalar<T>(min);
T cmax = 9;
if (max) cmax = PyBlitzArrayCxx_AsCScalar<T>(max);
return boost::make_shared<bob::core::random::uniform_int_distribution<T>>(cmin, cmax);
return boost::make_shared<boost::uniform_int<T>>(cmin, cmax);
}
template <typename T>
......@@ -52,7 +52,7 @@ boost::shared_ptr<void> make_uniform_real(PyObject* min, PyObject* max) {
if (min) cmin = PyBlitzArrayCxx_AsCScalar<T>(min);
T cmax = 1;
if (max) cmax = PyBlitzArrayCxx_AsCScalar<T>(max);
return boost::make_shared<bob::core::random::uniform_real_distribution<T>>(cmin, cmax);
return boost::make_shared<boost::uniform_real<T>>(cmin, cmax);
}
PyObject* PyBoostUniform_SimpleNew (int type_num, PyObject* min, PyObject* max) {
......@@ -332,16 +332,16 @@ static PyObject* PyBoostUniform_Reset(PyBoostUniformObject* self) {
}
static PyObject* call_bool(PyBoostUniformObject* self, PyBoostMt19937Object* rng) {
if (boost::static_pointer_cast<bob::core::random::uniform_smallint_distribution<uint8_t>>(self->distro)->operator()(*rng->rng)) Py_RETURN_TRUE;
if (boost::static_pointer_cast<boost::uniform_smallint<uint8_t>>(self->distro)->operator()(*rng->rng)) Py_RETURN_TRUE;
Py_RETURN_FALSE;
}
template <typename T> PyObject* call_int(PyBoostUniformObject* self, PyBoostMt19937Object* rng) {
return PyBlitzArrayCxx_FromCScalar(boost::static_pointer_cast<bob::core::random::uniform_int_distribution<T>>(self->distro)->operator()(*rng->rng));
return PyBlitzArrayCxx_FromCScalar(boost::static_pointer_cast<boost::uniform_int<T>>(self->distro)->operator()(*rng->rng));
}
template <typename T> PyObject* call_real(PyBoostUniformObject* self, PyBoostMt19937Object* rng) {
return PyBlitzArrayCxx_FromCScalar(boost::static_pointer_cast<bob::core::random::uniform_real_distribution<T>>(self->distro)->operator()(*rng->rng));
return PyBlitzArrayCxx_FromCScalar(boost::static_pointer_cast<boost::uniform_real<T>>(self->distro)->operator()(*rng->rng));
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment