New user self-registration is disabled due to spam. Please email eigen-core-team @ if you need an account.
Bug 1401 - SelfAdjointEigenSolver.h is not compatible with AutoDiffScalar
Summary: SelfAdjointEigenSolver.h is not compatible with AutoDiffScalar
Alias: None
Product: Eigen
Classification: Unclassified
Component: Eigenvalues (show other bugs)
Version: 3.3 (current stable)
Hardware: All All
: Normal Unknown
Assignee: Nobody
Depends on:
Reported: 2017-03-07 13:58 UTC by Shuntaro Yamazaki
Modified: 2017-03-08 15:18 UTC (History)
4 users (show)

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]

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: (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.