Commit efc1cb20 authored by Jean-Baptiste Mouret's avatar Jean-Baptiste Mouret
Browse files

fix a few missing inline keywords (to avoid the export / multiple definition)

parent e978e48a
......@@ -66,7 +66,7 @@ namespace limbo {
///@ingroup opt_tools
/// get the gradient from a function evaluation (eval_t)
const Eigen::VectorXd& grad(const eval_t& fg)
inline const Eigen::VectorXd& grad(const eval_t& fg)
{
assert(std::get<1>(fg).is_initialized());
return std::get<1>(fg).get();
......@@ -74,7 +74,7 @@ namespace limbo {
///@ingroup opt_tools
/// get the value from a function evaluation (eval_t)
double fun(const eval_t& fg)
inline double fun(const eval_t& fg)
{
return std::get<0>(fg);
}
......@@ -82,7 +82,7 @@ namespace limbo {
///@ingroup opt_tools
/// Evaluate f without gradient (to be called from the optimization algorithms that do not use the gradient)
template <typename F>
double eval(const F& f, const Eigen::VectorXd& x)
inline double eval(const F& f, const Eigen::VectorXd& x)
{
return std::get<0>(f(x, false));
}
......@@ -90,7 +90,7 @@ namespace limbo {
///@ingroup opt_tools
/// Evaluate f with gradient (to be called from the optimization algorithms that use the gradient)
template <typename F>
eval_t eval_grad(const F& f, const Eigen::VectorXd& x)
inline eval_t eval_grad(const F& f, const Eigen::VectorXd& x)
{
return f(x, true);
}
......
......@@ -61,7 +61,7 @@ namespace limbo {
/// @ingroup tools
/// make a 1-D vector from a double (useful when we need to return vectors)
Eigen::VectorXd make_vector(double x)
inline Eigen::VectorXd make_vector(double x)
{
Eigen::VectorXd res(1);
res(0) = x;
......
......@@ -80,7 +80,7 @@ namespace limbo {
/// @ingroup par_tools
/// convert a std::vector to something else (e.g. a std::list)
template <typename V>
std::vector<typename V::value_type> convert_vector(const V& v)
inline std::vector<typename V::value_type> convert_vector(const V& v)
{
std::vector<typename V::value_type> v2(v.size());
std::copy(v.begin(), v.end(), v2.begin());
......@@ -99,7 +99,7 @@ namespace limbo {
#endif
template <typename V>
V convert_vector(const V& v)
inline V convert_vector(const V& v)
{
return v;
}
......@@ -114,7 +114,7 @@ namespace limbo {
#else
/// @ingroup par_tools
/// init TBB (if activated) for multi-core computing
void init()
inline void init()
{
}
#endif
......@@ -152,7 +152,7 @@ namespace limbo {
/// @ingroup par_tools
/// parallel max
template <typename T, typename F, typename C>
T max(const T& init, int num_steps, const F& f, const C& comp)
inline T max(const T& init, int num_steps, const F& f, const C& comp)
{
#ifdef USE_TBB
auto body = [&](const tbb::blocked_range<size_t>& r, T current_max) -> T {
......
......@@ -104,7 +104,7 @@ namespace limbo {
///
/// - this function is thread safe because we use a random generator for each thread
/// - we use a C++11 random number generator
Eigen::VectorXd random_vector_bounded(int size)
inline Eigen::VectorXd random_vector_bounded(int size)
{
static thread_local rgen_double_t rgen(0.0, 1.0);
Eigen::VectorXd res(size);
......@@ -118,7 +118,7 @@ namespace limbo {
///
/// - this function is thread safe because we use a random generator for each thread
/// - we use a C++11 random number generator
Eigen::VectorXd random_vector_unbounded(int size)
inline Eigen::VectorXd random_vector_unbounded(int size)
{
static thread_local rgen_gauss_t rgen(0.0, 10.0);
Eigen::VectorXd res(size);
......@@ -138,7 +138,7 @@ namespace limbo {
/// @ingroup tools
/// generate n random samples with Latin Hypercube Sampling (LHS) in [0, 1]^dim
Eigen::MatrixXd random_lhs(int dim, int n)
inline Eigen::MatrixXd random_lhs(int dim, int n)
{
Eigen::VectorXd cut = Eigen::VectorXd::LinSpaced(n + 1, 0., 1.);
Eigen::MatrixXd u = Eigen::MatrixXd::Zero(n, dim);
......
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