[eigen] AutoDiff: complex doesn't compile

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Dear All,


in my Quest in using Eigen for own types, I realized, that Eigen::AutoDiff should posses the same difficulties.

Sadly, I can't get even a simple case working.

#include <complex>

#include <Eigen/Dense>
#include <unsupported/Eigen/AutoDiff>

typedef Eigen::AutoDiffScalar<Eigen::Vector2cd> TpFloat;
typedef Eigen::AutoDiffScalar<Eigen::Vector2d> TpRFloat;

int main( const int argc, const char *argv[] )
{
	TpRFloat x(3.0) ;   // o.k.
	TpFloat  z;   // not o.k.

	return 0;
}

Eigen::AutoDiffScalar doesn't compile for complex types. Since the type definitions are within nested traits,
    I couldn't spot a solution immediately.

As note, the doc may clarify, that "the vector type used to store/represent the derivatives",
means first-order derivatives, or gradients. I was first confused by assuming it would represent a Taylor
expansion.

Best regards,
Peter

__________________

$ g++   -std=c++11 -DNDEBUG -O2  TestAutoDiff.C  -I $HOME/Eigen/eigen -o DiffPC 2>&1 | tee Err.txt | more
In file included from /home/peter/Eigen/eigen/unsupported/Eigen/AutoDiff:32:0,
                 from TestAutoDiff.C:5:
/home/peter/Eigen/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h: In instantiation of 'struct Eigen::internal::auto_diff_special_op<Eigen::Matrix<std::complex<double>, 2, 1>, true>':
/home/peter/Eigen/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h:67:7:   required from 'class Eigen::AutoDiffScalar<Eigen::Matrix<std::complex<double>, 2, 1> >'
TestAutoDiff.C:18:10:   required from here
/home/peter/Eigen/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h:424:3: error: no type named 'Type' in 'class Eigen::CwiseUnaryOp<Eigen::internal::bind2nd_op<Eigen::internal::scalar_product_op<std::comp
lex<double>, double> >, Eigen::Matrix<std::complex<double>, 2, 1> >'
   operator*(const Real& other) const
   ^
/home/peter/Eigen/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h:432:3: error: no type named 'DerType' in 'class Eigen::CwiseUnaryOp<Eigen::internal::bind1st_op<Eigen::internal::scalar_product_op<double
, std::complex<double> > >, Eigen::Matrix<std::complex<double>, 2, 1> >'
   operator*(const Real& other, const AutoDiffScalar<_DerType>& a)
   ^
/home/peter/Eigen/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h: In instantiation of 'class Eigen::AutoDiffScalar<Eigen::Matrix<std::complex<double>, 2, 1> >':
TestAutoDiff.C:18:10:   required from here
/home/peter/Eigen/eigen/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h:81:25: error: no members matching 'Eigen::AutoDiffScalar<Eigen::Matrix<std::complex<double>, 2, 1> >::Base {aka Eigen::internal::auto_dif
f_special_op<Eigen::Matrix<std::complex<double>, 2, 1>, true>}::operator*' in 'Eigen::AutoDiffScalar<Eigen::Matrix<std::complex<double>, 2, 1> >::Base {aka struct Eigen::internal::auto_diff_special_op<Eigen::M
atrix<std::complex<double>, 2, 1>, true>}'
     using Base::operator*;
                         ^



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/