Skip to content
Snippets Groups Projects
Verified Commit 53c77255 authored by Justin Carpentier's avatar Justin Carpentier Committed by Justin Carpentier
Browse files

[Macros] Add dedicated file to contain Eigen macros

This splitting is mandatory with CPPAD support.
parent 2f61e252
No related branches found
No related tags found
No related merge requests found
......@@ -367,6 +367,7 @@ SET(HEADERS
exception.hpp
assert.hpp
macros.hpp
eigen-macros.hpp
fwd.hpp
)
LIST(REMOVE_DUPLICATES HEADERS)
......
//
// Copyright (c) 2017-2018 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.
#ifndef __se3_eigen_macros_hpp__
#define __se3_eigen_macros_hpp__
#include "pinocchio/utils/eigen-fix.hpp"
/// \brief Macro giving access to the equivalent plain type of D
#define EIGEN_PLAIN_TYPE(D) Eigen::internal::plain_matrix_type< typename se3::helper::argument_type<void(D)>::type >::type
/// \brief Similar to macro EIGEN_PLAIN_TYPE but with guaranty to provite a column major type
#define EIGEN_PLAIN_COLUMN_MAJOR_TYPE(D) se3::helper::handle_return_type_without_typename<D,Eigen::internal::plain_matrix_type_column_major>::type
/// \brief Similar to macro EIGEN_PLAIN_TYPE but with guaranty to provite a row major type
#define EIGEN_PLAIN_ROW_MAJOR_TYPE(D) se3::helper::handle_return_type_without_typename<D,Eigen::internal::fix::plain_matrix_type_row_major>::type
/// \brief Macro giving access to the reference type of D
#define EIGEN_REF_CONSTTYPE(D) Eigen::internal::ref_selector<D>::type
#if EIGEN_VERSION_AT_LEAST(3,2,90)
#define EIGEN_REF_TYPE(D) Eigen::internal::ref_selector<D>::non_const_type
#else
#define EIGEN_REF_TYPE(D) \
Eigen::internal::conditional< \
bool(Eigen::internal::traits<D>::Flags & Eigen::NestByRefBit), \
D &, \
D \
>::type
#endif
/// \brief Macro giving access to the return type of the dot product operation
#if EIGEN_VERSION_AT_LEAST(3,3,0)
#define EIGEN_DOT_PRODUCT_RETURN_TYPE(D1,D2) \
Eigen::ScalarBinaryOpTraits< typename Eigen::internal::traits< D1 >::Scalar, typename Eigen::internal::traits< D2 >::Scalar >::ReturnType
#else
#define EIGEN_DOT_PRODUCT_RETURN_TYPE(D1,D2) \
Eigen::internal::scalar_product_traits<typename Eigen::internal::traits< D1 >::Scalar,typename Eigen::internal::traits< D2 >::Scalar>::ReturnType
#endif
/// \brief Macro for an automatic const_cast
#define EIGEN_CONST_CAST(TYPE,OBJ) const_cast<TYPE &>(OBJ.derived())
#endif // ifndef __se3_eigen_macros_hpp__
......@@ -18,12 +18,16 @@
#ifndef __se3_fwd_hpp__
#define __se3_fwd_hpp__
#include "pinocchio/macros.hpp"
#ifdef PINOCCHIO_WITH_CPPAD_SUPPORT
#include "pinocchio/math/cppad.hpp"
#else
#include <Eigen/Core>
#endif
#include "pinocchio/eigen-macros.hpp"
namespace se3
{
///
......
......@@ -18,9 +18,6 @@
#ifndef __se3_macros_hpp__
#define __se3_macros_hpp__
#include <Eigen/Core>
#include "pinocchio/utils/eigen-fix.hpp"
#if __cplusplus >= 201103L
#define PINOCCHIO_WITH_CXX11_SUPPORT
#endif
......@@ -62,37 +59,4 @@ namespace se3
}
}
/// \brief Macro giving access to the equivalent plain type of D
#define EIGEN_PLAIN_TYPE(D) Eigen::internal::plain_matrix_type< typename se3::helper::argument_type<void(D)>::type >::type
/// \brief Similar to macro EIGEN_PLAIN_TYPE but with guaranty to provite a column major type
#define EIGEN_PLAIN_COLUMN_MAJOR_TYPE(D) se3::helper::handle_return_type_without_typename<D,Eigen::internal::plain_matrix_type_column_major>::type
/// \brief Similar to macro EIGEN_PLAIN_TYPE but with guaranty to provite a row major type
#define EIGEN_PLAIN_ROW_MAJOR_TYPE(D) se3::helper::handle_return_type_without_typename<D,Eigen::internal::fix::plain_matrix_type_row_major>::type
/// \brief Macro giving access to the reference type of D
#define EIGEN_REF_CONSTTYPE(D) Eigen::internal::ref_selector<D>::type
#if EIGEN_VERSION_AT_LEAST(3,2,90)
#define EIGEN_REF_TYPE(D) Eigen::internal::ref_selector<D>::non_const_type
#else
#define EIGEN_REF_TYPE(D) \
Eigen::internal::conditional< \
bool(Eigen::internal::traits<D>::Flags & Eigen::NestByRefBit), \
D &, \
D \
>::type
#endif
/// \brief Macro giving access to the return type of the dot product operation
#if EIGEN_VERSION_AT_LEAST(3,3,0)
#define EIGEN_DOT_PRODUCT_RETURN_TYPE(D1,D2) \
Eigen::ScalarBinaryOpTraits< typename Eigen::internal::traits< D1 >::Scalar, typename Eigen::internal::traits< D2 >::Scalar >::ReturnType
#else
#define EIGEN_DOT_PRODUCT_RETURN_TYPE(D1,D2) \
Eigen::internal::scalar_product_traits<typename Eigen::internal::traits< D1 >::Scalar,typename Eigen::internal::traits< D2 >::Scalar>::ReturnType
#endif
/// \brief Macro for an automatic const_cast
#define EIGEN_CONST_CAST(TYPE,OBJ) const_cast<TYPE &>(OBJ.derived())
#endif // ifndef __se3_macros_hpp__
......@@ -27,13 +27,14 @@
#define EIGEN_MATRIXBASE_PLUGIN <cppad/example/eigen_plugin.hpp>
#endif
#include <Eigen/Core>
#if defined(PINOCCHIO_WITH_CPPADCG_SUPPORT) && defined(PINOCCHIO_WITH_CXX11_SUPPORT)
#include <cppad/cg/support/cppadcg_eigen.hpp>
#else
#include <cppad/cppad.hpp>
#endif
#include <Eigen/Core>
namespace Eigen
{
namespace internal
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment