Make Eigen_diagonalize_traits compatible with epeck

This commit is contained in:
Simon Giraudot 2020-10-28 10:39:36 +01:00
parent d1b9e872b2
commit e58561aeca
1 changed files with 13 additions and 3 deletions

View File

@ -30,6 +30,15 @@
namespace CGAL {
namespace internal {
template <typename FT>
struct Restricted_FT { typedef double type; };
template <>
struct Restricted_FT<float> { typedef float type; };
}
/// \ingroup PkgSolverInterfaceRef
///
/// The class `Eigen_diagonalize_traits` provides an interface to the
@ -47,14 +56,15 @@ namespace CGAL {
template <typename FT, unsigned int dim = 3>
class Eigen_diagonalize_traits
{
typedef typename internal::Restricted_FT<FT>::type RFT;
public:
typedef std::array<FT, dim> Vector;
typedef std::array<FT, dim*dim> Matrix;
typedef std::array<FT, (dim * (dim+1) / 2)> Covariance_matrix;
private:
typedef Eigen::Matrix<FT, dim, dim> EigenMatrix;
typedef Eigen::Matrix<FT, dim, 1> EigenVector;
typedef Eigen::Matrix<RFT, dim, dim> EigenMatrix;
typedef Eigen::Matrix<RFT, dim, 1> EigenVector;
/// Construct the covariance matrix
static EigenMatrix construct_covariance_matrix(const Covariance_matrix& cov)
@ -65,7 +75,7 @@ private:
{
for(std::size_t j=i; j<dim; ++j)
{
m(i,j) = static_cast<FT>(cov[(dim * i) + j - ((i * (i+1)) / 2)]);
m(i,j) = static_cast<RFT>(CGAL::to_double(cov[(dim * i) + j - ((i * (i+1)) / 2)]));
if(i != j)
m(j,i) = m(i,j);