New user self-registration is currently disabled. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Bug 1401 - SelfAdjointEigenSolver.h is not compatible with AutoDiffScalar
SelfAdjointEigenSolver.h is not compatible with AutoDiffScalar
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Eigenvalues
3.3 (current stable)
All All
: Normal Unknown
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-03-07 13:58 UTC by Shuntaro Yamazaki
Modified: 2017-03-08 15:18 UTC (History)
4 users (show)



Attachments
patch (1016 bytes, patch)
2017-03-07 13:58 UTC, Shuntaro Yamazaki
no flags Details | Diff

Description Shuntaro Yamazaki 2017-03-07 13:58:09 UTC
Created attachment 780 [details]
patch

Attached a patch to fix the following compilation error. This might be an issue of AutoDiffScalar.

$ cat a.cpp 
#include <Eigen/Dense>
#include <unsupported/Eigen/AutoDiff>
int main() {
    typedef Eigen::Matrix<Eigen::AutoDiffScalar<Eigen::Vector2d>,1,1> Mat;
    Mat m;
    Eigen::SelfAdjointEigenSolver<Mat> e(m);
    return 0;
}

$ clang++ -I. a.cpp
In file included from a.cpp:1:
In file included from ./Eigen/Dense:7:
In file included from ./Eigen/Eigenvalues:39:
./Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h:826:62: error: conditional expression is ambiguous; 'AutoDiffScalar<Eigen::Matrix<double, 2, 1, 0,
      2, 1>>' can be converted to 'const AutoDiffScalar<CwiseUnaryOp<internal::scalar_opposite_op<Scalar>, const DerType>>' and vice versa
    else                  mu -= e2 / (td + (td>RealScalar(0) ? h : -h));
                                                             ^ ~   ~~

$ clang++ -v
clang version 3.7.0 (trunk 239477)
Target: x86_64-unknown-linux-gnu
Comment 1 Gael Guennebaud 2017-03-08 15:18:40 UTC
Let's rather fix AutoDiff:

https://bitbucket.org/eigen/eigen/commits/f59b477e4c4e/
https://bitbucket.org/eigen/eigen/commits/c7cf575724de/ (3.3)
Summary:     Bug 1401: fix compilation of "cond ? x : -x" with x an AutoDiffScalar

Note You need to log in before you can comment on or make changes to this bug.