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 <boost/mpl/int.hpp>
14 #include <cppad/cg/support/cppadcg_eigen.hpp>
16 #include "pinocchio/autodiff/cppad.hpp"
26 template<
typename Scalar>
27 struct constant_pi<CppAD::cg::CG<Scalar>> : constant_pi<Scalar>
29 typedef CppAD::cg::CG<Scalar> CGScalar;
32 static inline CGScalar get(
const mpl::int_<N> & n)
34 return CGScalar(constant_pi<Scalar>::get(n));
37 #if BOOST_VERSION >= 107700
38 template<
class T, T value>
39 static inline CGScalar get(
const std::integral_constant<T, value> & n)
41 return CGScalar(constant_pi<Scalar>::get(n));
44 template<
class T, T value>
45 static inline CGScalar get(
const boost::integral_constant<T, value> & n)
47 return CGScalar(constant_pi<Scalar>::get(n));
61 template<
typename Scalar>
62 struct cast_impl<CppAD::cg::CG<Scalar>, Scalar>
64 #if EIGEN_VERSION_AT_LEAST(3, 2, 90)
67 static inline Scalar run(
const CppAD::cg::CG<Scalar> & x)
74 template<
typename Scalar>
75 struct cast_impl<CppAD::AD<CppAD::cg::CG<Scalar>>, Scalar>
77 #if EIGEN_VERSION_AT_LEAST(3, 2, 90)
80 static inline Scalar run(
const CppAD::AD<CppAD::cg::CG<Scalar>> & x)
82 return CppAD::Value(x).getValue();
93 template<
class Scalar>
94 bool isfinite(
const CG<Scalar> & x)
96 return std::isfinite(x.getValue());
103 template<
typename Scalar>
107 typedef CppAD::cg::CG<Scalar> CGScalar;
112 return CGScalar(Base::template precision<degree>());
116 template<
typename NewScalar,
typename Scalar>
119 static NewScalar cast(
const CppAD::cg::CG<Scalar> & cg_value)
121 return static_cast<NewScalar
>(cg_value.getValue());
Main pinocchio namespace.
Cast scalar type from type FROM to type TO.
static Scalar precision()
Computes the expected tolerance of the argument of a Taylor series expansion for a certain degree acc...