-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
autodiff::fvar doesn't work with Eigen #424
Comments
@wgledbetter : Yes, we're interested. @pulver : Can your review the PR when it shows up? |
The build errors @wgledbetter forewarned of are on https://travis-ci.org/github/boostorg/math/builds/721216811
In case this helps someone diagnose this, the larger context in
This appears to be called when the RealType is a multiprecision: |
I was able to solve this problem by creating an Just a side note, I got this same has_right_shift error with RealType = double on my personal machine with clang-10 and gcc-10 and c++-17, but the new update on #425 fixes it, too. |
Currently, the templated copy constructor for
autodiff::fvar
interferes with Eigen's lazy evaluation, and, in my experience, produces two types of errors:ambiguous overload for ‘operator*’ (operand types are ‘Eigen::Transpose<Eigen::Matrix<boost::math::differentiation::autodiff_v1::detail::fvar<double, 1>, 4, 1> >’ and ‘Eigen::Matrix<boost::math::differentiation::autodiff_v1::detail::fvar<double, 1>, 4, 1>’)
static_cast
a matrix into an fvarerror: invalid ‘static_cast’ from type ‘const Eigen::CwiseUnaryOp<Eigen::internal::scalar_cast_op<double, boost::math::differentiation::autodiff_v1::detail::fvar<double, 1> >, const Eigen::Matrix<double, 4, 4> >’ to type ‘double’
A solution would be to only define the constructor for types that are convertible to the fvar's RealType. A colleague and I worked out a potential fix using SFINAE that I'm currently testing against the existing
test_autodiff
files. Tests 1-3 have succeeded with the existing travis configuration, but I'm having issues in test_autodiff_4 withboost::has_right_shift
as called fromboost::lexical_cast
.Is there any interest in merging a solution to this problem? I can post the work I've done so far.
The text was updated successfully, but these errors were encountered: