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

Problem passing TridiagonalMatrix as function argument

Tags: None
(comma "," separated)
rookiequant
Registered Member
Posts
1
Karma
0
OS
I'm trying to write a function (illustrative example below) which takes as one of its arguments a tridiagonal matrix. It works fine when the argument is either a reference or value type, but when it's a const reference it spews out a bunch of compiler errors (see below). Any help in how I can get it working with a const reference is much appreciated.

Code: Select all
void test(const Eigen::internal::TridiagonalMatrix<double, Eigen::Dynamic, 0>& m) {

   double x = m.super()[0];
}





1>c:\eigen\eigen\src\core\bandmatrix.h(131): error C2665: 'Eigen::Block<XprType,BlockRows,BlockCols>::Block' : none of the 5 overloads could convert all the argument types
1> with
1> [
1> XprType=Eigen::Matrix<double,3,-1,1>,
1> BlockRows=1,
1> BlockCols=-1
1> ]
1> c:\eigen\eigen\src\core\block.h(294): could be 'Eigen::Block<XprType,BlockRows,BlockCols>::Block(XprType &,__w64 int,__w64 int,__w64 int,__w64 int)'
1> with
1> [
1> XprType=Eigen::Matrix<double,3,-1,1>,
1> BlockRows=1,
1> BlockCols=-1
1> ]
1> while trying to match the argument list '(const Eigen::Matrix<_Scalar,_Rows,_Cols,_Options>, const int, const int, int, __w64 int)'
1> with
1> [
1> _Scalar=double,
1> _Rows=3,
1> _Cols=-1,
1> _Options=1
1> ]
1> c:\eigen\eigen\src\core\bandmatrix.h(335) : see reference to function template instantiation 'const Eigen::Block<XprType,BlockRows,BlockCols> Eigen::internal::BandMatrixBase<Derived>::diagonal<1>(void) const' being compiled
1> with
1> [
1> XprType=Eigen::Matrix<double,3,-1,1>,
1> BlockRows=1,
1> BlockCols=-1,
1> Derived=Eigen::internal::BandMatrix<double,-1,-1,1,1,1>
1> ]
1> c:\eigen\eigen\src\core\bandmatrix.h(335) : while compiling class template member function 'const Eigen::Block<XprType,BlockRows,BlockCols> Eigen::internal::TridiagonalMatrix<Scalar,Size,Options>::super(void) const'
1> with
1> [
1> XprType=Eigen::Matrix<double,3,-1,1>,
1> BlockRows=1,
1> BlockCols=-1,
1> Scalar=double,
1> Size=-1,
1> Options=0
1> ]
1> c:\documents and settings\troy morgan\my documents\visual studio 2010\projects\linearalgrebatest\linearalgrebatest\test.cpp(9) : see reference to class template instantiation 'Eigen::internal::TridiagonalMatrix<Scalar,Size,Options>' being compiled
1> with
1> [
1> Scalar=double,
1> Size=-1,
1> Options=0
1> ]


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora