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

autodiff with matrices

Tags: None
(comma "," separated)
martin_IM
Registered Member
Posts
9
Karma
0
OS

autodiff with matrices

Mon Feb 27, 2012 1:29 pm
Hello

I'm trying to use automatic differentiation with function that contains matrix operations, but i could not make it compile for simple matrix multiplications ! Anyone now how i could fix that without have to rewrite the matrix multiplication by myself using three loops ? Do i need to modify eigen library's code somewhere ?

Here is the code:

Code: Select all
#include <unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h>
using namespace Eigen;
void main(void){
  typedef Matrix<IMReal,5,1> DerivType;
  typedef AutoDiffScalar<DerivType> ADScalar;
  Matrix<ADScalar,3,3> a;
  Matrix<ADScalar,3,3> b;
  Matrix<ADScalar,3,3> c;
  c=a*b;}


and I get this compilation error message :


1>------ Build started: Project: OptasiaCharacter, Configuration: Debug Win32 ------
1> Character.cpp
1>b:\build\thirdpartylibs\eigen\src/Core/products/CoeffBasedProduct.h(56): error C2752: 'Eigen::internal::scalar_product_traits<T,U>' : more than one partial specialization matches the template argument list
1> with
1> [
1> T=Eigen::AutoDiffScalar<DerivType>,
1> U=Eigen::AutoDiffScalar<DerivType>
1> ]
1> B:\Build\ThirdPartyLibs\eigen\unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h(475): could be 'Eigen::internal::scalar_product_traits<Eigen::AutoDiffScalar<_DerType>,T>'
1> b:\build\thirdpartylibs\eigen\eigen-3.0.3-patch1\eigen\eigen\src/Core/util/Meta.h(192): or 'Eigen::internal::scalar_product_traits<T,T>'
1> b:\build\thirdpartylibs\eigen\src/Core/DenseBase.h(46) : see reference to class template instantiation 'Eigen::internal::traits<T>' being compiled
1> with
1> [
1> T=Eigen::CoeffBasedProduct<const Eigen::Matrix<ADScalar,3,3> ,const Eigen::Matrix<ADScalar,3,3> ,6>
1> ]
1> b:\build\thirdpartylibs\eigen\src/Core/MatrixBase.h(63) : see reference to class template instantiation 'Eigen::DenseBase<Derived>' being compiled
1> with
1> [
1> Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<ADScalar,3,3> ,const Eigen::Matrix<ADScalar,3,3> ,6>
1> ]
1> b:\build\thirdpartylibs\eigen\src/Core/products/CoeffBasedProduct.h(129) : see reference to class template instantiation 'Eigen::MatrixBase<Derived>' being compiled
1> with
1> [
1> Derived=Eigen::CoeffBasedProduct<const Eigen::Matrix<ADScalar,3,3> ,const Eigen::Matrix<ADScalar,3,3> ,6>
1> ]
1> x:test.cpp(302) : see reference to class template instantiation 'Eigen::CoeffBasedProduct<LhsNested,RhsNested,NestingFlags>' being compiled
1> with
1> [
1> LhsNested=const Eigen::Matrix<ADScalar,3,3> ,
1> RhsNested=const Eigen::Matrix<ADScalar,3,3> ,
1> NestingFlags=6
1> ]


Bookmarks



Who is online

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