diff --git a/CMakeLists.txt b/CMakeLists.txt index 265c78e4a71834765568250eb905bb27b4da9c1d..55e5098fa79270d21614bdf547442898ff0fb97b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,6 +71,10 @@ SEARCH_FOR_BOOST() # ---------------------------------------------------- # --- INCLUDE ---------------------------------------- # ---------------------------------------------------- +SET(${PROJECT_NAME}_UTILS_HEADERS + include/eigenpy/utils/scalar-name.hpp + ) + SET(${PROJECT_NAME}_SOLVERS_HEADERS include/eigenpy/solvers/solvers.hpp include/eigenpy/solvers/preconditioners.hpp @@ -83,6 +87,7 @@ SET(${PROJECT_NAME}_SOLVERS_HEADERS ) SET(${PROJECT_NAME}_HEADERS + ${${PROJECT_NAME}_UTILS_HEADERS} ${${PROJECT_NAME}_SOLVERS_HEADERS} include/eigenpy/computation-info.hpp include/eigenpy/eigenpy.hpp diff --git a/include/eigenpy/utils/scalar-name.hpp b/include/eigenpy/utils/scalar-name.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2d3a949069ada44c8b56fd2e9b2383c4a33a4afc --- /dev/null +++ b/include/eigenpy/utils/scalar-name.hpp @@ -0,0 +1,44 @@ +/* +* Copyright 2020 INRIA +*/ + +#ifndef __eigenpy_utils_scalar_name_hpp__ +#define __eigenpy_utils_scalar_name_hpp__ + +#include <string> +#include <complex> + +namespace eigenpy +{ + template<typename Scalar> + struct scalar_name + { + static std::string shortname(); + }; + + template<> + struct scalar_name<float> + { + static std::string shortname() { return "f"; }; + }; + + template<> + struct scalar_name<double> + { + static std::string shortname() { return "d"; }; + }; + + template<> + struct scalar_name<long double> + { + static std::string shortname() { return "ld"; }; + }; + + template<typename Scalar> + struct scalar_name< std::complex<Scalar> > + { + static std::string shortname() { return "c" + scalar_name<Scalar>(); }; + }; +} + +#endif // ifndef __eigenpy_utils_scalar_name_hpp__