autodiff / autodiff

automatic differentiation made easier for C++
https://autodiff.github.io
MIT License
1.63k stars 171 forks source link

current autodiff main branch does not work with current eigen master branch #328

Open bradbell opened 6 months ago

bradbell commented 6 months ago

If you install the current autodiff main branch and the current eigen master branch and try to run the tutorial example https://autodiff.github.io/tutorials/#gradient-vector-of-a-scalar-function

You get the following error:

prefix/include/autodiff/common/eigen.hpp:105:86: error: type/value mismatch at argument 3 in template parameter list for ‘template<class XprType, class RowIndices, class ColIndices> class Eigen::IndexedView’
  105 |     struct VectorTraits<Eigen::IndexedView<VectorType, IndicesType, Eigen::internal::SingleRange>>

The git hash for this version of the eigen master is e63d9f6ccb7f6f29f31241b87c542f3f0ab3112b

If you change from the current eigen master to the 3.4.0 release, the example works.

allanleal commented 5 months ago

Thanks for reporting this. At the moment, Eigen 3.4 is supported. Once they release a new version out of their master branch, that version should be supported.

rath3t commented 5 months ago

The problem here is the following commit: https://gitlab.com/libeigen/eigen/-/commit/77833f932040b46e79b6fa6522594a6df27e8a76, where SingleRange becomes a template of an Index link. It could be checked at link, if SingleRange is a template and then the right thing can be inserted. I don't have the time right now to provide a PR.

As a workaround it is maybe possible instead of checking out the master of Eigen, checking out the commit before the changes d26e19714fca2faf544619c3604f88d980e5a207

lseman commented 4 months ago

Any workaround for the SingleRange modifying the autodiff instead of Eigen?