Re: [eigen] Strange behaviour with part<> in eigen2

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


On 13.06.2011 22:41, Sameer Agarwal wrote:
Consider the following two programs

#include "Eigen/Core"
#include "Eigen/LU"

void Bar() {
   typedef Eigen::Matrix<double, 3,3, Eigen::RowMajor>  MType;
   MType A  = MType::Identity();
   MType B;

   A.part<Eigen::SelfAdjoint>().computeInverse(&B);
}

int main(int argc, char** argv) {
   Bar();
   return 0;
}

and this compiles. No problem.  Now consider

#include "Eigen/Core"
#include "Eigen/LU"

template<int block_size>
void Bar() {
  typedef Eigen::Matrix<double, block_size, block_size, Eigen::RowMajor>
MType;
   MType A  = MType::Identity();
   MType B;

   A.part<Eigen::SelfAdjoint>().computeInverse(&B);

You need to write

	A.template part<Eigen::SelfAdjoint>().computeInverse(&B);

here. It's because gcc does not know that part is a templated function (and it can't know that for sure at this point).

Since similar problems seem to arise frequently, an entry in the FAQ might be useful for all related problems ...


Christoph



--
----------------------------------------------
Dipl.-Inf. Christoph Hertzberg
Cartesium 0.051
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: (+49) 421-218-64252
----------------------------------------------



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