This forum has been archived. All content is frozen. Please use KDE Discuss instead.

AutoDiff

Tags: None
(comma "," separated)
-Roman-
Registered Member
Posts
16
Karma
0

AutoDiff

Wed Oct 10, 2012 11:52 am
Hello,

I'm trying to use the unsupported Eigen module AutoDiff. It seems to work fine (regarding the tests for this module) unless I try to differentiate an expression involving the computation of eigenvalues. E.g. when I try to differentiate the output of eigenvalueTest

Code: Select all
template<typename Vector>
EIGEN_DONT_INLINE typename Vector::Scalar eigenvalueTest (const Vector& v)
{
  typedef typename Vector::Scalar Scalar;
  typedef Matrix<Scalar,5,5> MatrixType;
  MatrixType mat;
  mat << 0, 1, 0, 0, 0,
              0, 0,1, 0, 0,
              0, 0, 0, 1, 0,
              0, 0, 0, 0, 1,
              pow (v[0], 4), v[1], v[2], v[3], v[4];
  return ((mat.eigenvalues()).real())[0];
}


I get the following compiler errors:

Code: Select all
~/eigen/eigen-3.1.1/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h(103): error: no instance of constructor "Eigen::CwiseBinaryOp<BinaryOp, Lhs, Rhs>::CwiseBinaryOp [with BinaryOp=Eigen::internal::scalar_sum_op<double>, Lhs=const Eigen::Matrix<double, 5, 1, 0, 5, 1>, Rhs=const Eigen::Matrix<double, 5, 1, 0, 5, 1>]" matches the argument list
            argument types are: (const Eigen::CwiseUnaryOp<Eigen::internal::scalar_multiple_op<double>, const Eigen::CwiseBinaryOp<Eigen::internal::scalar_sum_op<double>, const Eigen::Matrix<double, 5, 1, 0, 5, 1>, const Eigen::Matrix<double, 5, 1, 0, 5, 1>>>)
        : m_value(other.value()), m_derivatives(other.derivatives())
                                               ^


Is it possible to fix this? If not, what AD software would you recommend to be used together with Eigen?

Roman
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: AutoDiff

Wed Oct 10, 2012 8:32 pm
if you want the derivatives of eigenvalues and eigenvectors, please use the specific formulas to get them -> this will be much faster! See for instance "On Differentiating Eigenvalues and Eigenvectors" by J. Magnus.
-Roman-
Registered Member
Posts
16
Karma
0

Re: AutoDiff

Sat Oct 13, 2012 3:14 pm
Thanks for the suggestion.

Roman
-Roman-
Registered Member
Posts
16
Karma
0

Re: AutoDiff

Tue Oct 16, 2012 2:57 pm
Edit: Moved to correct thread.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]