Commit 82fac618 authored by Rohan Budhiraja's avatar Rohan Budhiraja
Browse files

[cppad] fix return type of constant_pi and add support of isfinite

parent f14c5bb6
......@@ -28,7 +28,14 @@ namespace boost
namespace detail
{
template<typename Scalar>
struct constant_pi< CppAD::AD<Scalar> > : constant_pi<Scalar> {};
struct constant_pi< CppAD::AD<Scalar> > : constant_pi<Scalar> {
template <int N>
static inline CppAD::AD<Scalar> get(const mpl::int_<N>& n)
{
return CppAD::AD<Scalar>(constant_pi<Scalar>::get(n));
}
};
}
}
}
......
......@@ -25,7 +25,13 @@ namespace boost
namespace detail
{
template<typename Scalar>
struct constant_pi< CppAD::cg::CG<Scalar> > : constant_pi<Scalar> {};
struct constant_pi< CppAD::cg::CG<Scalar> > : constant_pi<Scalar> {
template <int N>
static inline CppAD::cg::CG<Scalar> get(const mpl::int_<N>& n)
{
return CppAD::cg::CG<Scalar>(constant_pi<Scalar>::get(n));
}
};
}
}
}
......@@ -50,6 +56,15 @@ namespace Eigen
}
} // namespace Eigen
namespace CppAD
{
template <class Scalar>
bool isfinite(const cg::CG<Scalar> &x) { return std::isfinite(x.getValue()); }
template <class Scalar>
bool isfinite(const AD<Scalar> &x) { return isfinite(Value(x)); }
}
namespace pinocchio
{
template<typename Scalar>
......
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