5 #ifndef __pinocchio_codegen_ccpadcg_hpp__
6 #define __pinocchio_codegen_ccpadcg_hpp__
8 #define PINOCCHIO_WITH_CPPADCG_SUPPORT
10 #include "pinocchio/math/fwd.hpp"
13 #include <cppad/cg/support/cppadcg_eigen.hpp>
15 #include "pinocchio/autodiff/cppad.hpp"
17 #ifndef PINOCCHIO_WITH_CXX11_SUPPORT
18 #error CppADCodeGen requires C++11 or more
29 template<
typename Scalar>
30 struct constant_pi< CppAD::cg::CG<Scalar> > : constant_pi<Scalar>
32 typedef CppAD::cg::CG<Scalar> CGScalar;
35 static inline CGScalar get(
const mpl::int_<N>& n)
37 return CGScalar(constant_pi<Scalar>::get(n));
40 #if BOOST_VERSION >= 107700
41 template <
class T, T value>
42 static inline CGScalar get(
const std::integral_constant<T, value> &n)
44 return CGScalar(constant_pi<Scalar>::get(n));
47 template <
class T, T value>
48 static inline CGScalar get(
const boost::integral_constant<T, value> &n)
50 return CGScalar(constant_pi<Scalar>::get(n));
64 template<
typename Scalar>
65 struct cast_impl<CppAD::cg::CG<Scalar>,Scalar>
67 #if EIGEN_VERSION_AT_LEAST(3,2,90)
70 static inline Scalar run(
const CppAD::cg::CG<Scalar> & x)
80 template <
class Scalar>
81 bool isfinite(
const AD<Scalar> & x) {
return isfinite(Value(x)); }
85 template <
class Scalar>
86 bool isfinite(
const CG<Scalar> &x) {
return std::isfinite(
x.getValue()); }
92 template<
typename Scalar>
96 typedef CppAD::cg::CG<Scalar> CGScalar;
101 return CGScalar(Base::template precision<degree>());
107 #endif // #ifndef __pinocchio_codegen_ccpadcg_hpp__