38 #ifndef __COMMON_TYPES_H 
   39 #define __COMMON_TYPES_H 
   47 #include <boost/functional/hash.hpp> 
   49 #include <Eigen/Dense> 
   53 #include "Exceptions.h" 
   57 const double PI = 3.14159265358979323846;
 
   64 template <
typename TScalar> 
struct GenericEigenType {
 
   65     typedef Eigen::Matrix<TScalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> MatrixType;
 
   66     typedef Eigen::DiagonalMatrix<TScalar, Eigen::Dynamic> DiagMatrixType;
 
   67     typedef Eigen::Matrix<TScalar, Eigen::Dynamic, 1> VectorType;
 
   68     typedef Eigen::Matrix<TScalar, 1 , Eigen::Dynamic> RowVectorType;
 
   71 typedef GenericEigenType<ScalarType>::MatrixType MatrixType;
 
   72 typedef GenericEigenType<double>::MatrixType MatrixTypeDoublePrecision;
 
   73 typedef GenericEigenType<ScalarType>::DiagMatrixType DiagMatrixType;
 
   74 typedef GenericEigenType<ScalarType>::VectorType VectorType;
 
   75 typedef GenericEigenType<double>::VectorType VectorTypeDoublePrecision;
 
   76 typedef GenericEigenType<ScalarType>::RowVectorType RowVectorType;
 
   80 const static unsigned Void = 0; 
 
   81 const static unsigned SIGNED_CHAR = 2;
 
   82 const static unsigned UNSIGNED_CHAR  = 3;
 
   83 const static unsigned SIGNED_SHORT     =  4;
 
   84 const static unsigned UNSIGNED_SHORT = 5;
 
   85 const static unsigned SIGNED_INT             = 6;
 
   86 const static unsigned UNSIGNED_INT   = 7;
 
   87 const static unsigned SIGNED_LONG          =  8;
 
   88 const static unsigned UNSIGNED_LONG  = 9;
 
   89 const static unsigned FLOAT =         10;
 
   90 const static unsigned DOUBLE      =   11;
 
   92 template <
class T> 
unsigned GetDataTypeId() {
 
   93     throw StatisticalModelException(
"The datatype that was provided is not a valid statismo data type ");
 
   95 template <> 
inline unsigned GetDataTypeId<signed char>() {
 
   98 template <> 
inline unsigned GetDataTypeId<unsigned char>() {
 
  101 template <> 
inline unsigned GetDataTypeId<signed short>() {
 
  104 template <> 
inline unsigned GetDataTypeId<unsigned short>() {
 
  105     return UNSIGNED_SHORT;
 
  107 template <> 
inline unsigned GetDataTypeId<signed int>() {
 
  110 template <> 
inline unsigned GetDataTypeId<unsigned int>() {
 
  113 template <> 
inline unsigned GetDataTypeId<signed long>() {
 
  116 template <> 
inline unsigned GetDataTypeId<unsigned long>() {
 
  117     return UNSIGNED_LONG;
 
  119 template <> 
inline unsigned GetDataTypeId<float>() {
 
  122 template <> 
inline unsigned GetDataTypeId<double>() {
 
  134 inline size_t hash_value(
const statismo::VectorType& v) {
 
  137     for (
unsigned i = 0; i < v.size(); i++) {
 
  138         boost::hash_combine(value, v(i));
 
float ScalarType
the type that is used for all vector and matrices throughout the library. 
Definition: CommonTypes.h:60