roystgnr / MetaPhysicL

Metaprogramming and operator-overloaded classes for numerical simulations
Other
22 stars 12 forks source link

Everything is_convertible? #72

Closed hugary1995 closed 3 years ago

hugary1995 commented 3 years ago

I'm not sure if this issue is related to #70 and #71. Even if they are related, I need to open this issue since #70 is now closed. I get compile errors (after checking out #71) when trying to template Eigen over dual numbers. The minimal example would look like:

typedef double Real;
typedef MetaPhysicL::DualNumber<double, MetaPhysicL::DynamicSparseNumberArray<Real, unsigned int>>
    FirstDerivativeReal;
typedef MetaPhysicL::DualNumber<
    FirstDerivativeReal,
    MetaPhysicL::DynamicSparseNumberArray<FirstDerivativeReal, unsigned int>>
    ADReal;
typedef Eigen::Matrix<ADReal, 3, 3> ADRankTwoTensor;

std::cout << "std::is_convertible<ADRankTwoTensor, ADReal> == "
            << std::is_convertible<ADRankTwoTensor, ADReal>::value << '\n';

will output

std::is_convertible<ADRankTwoTensor, ADReal> == 1

which obviously causes issue when I multiply two ADRankTwoTensors -- it results in ambiguous overloading.

hugary1995 commented 3 years ago

Nvmd, I reinstalled the library to a different location......