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

Adding Functionalities to BandMatrix

Tags: None
(comma "," separated)
fmeirinhos
Registered Member
Posts
4
Karma
0
I am trying to add functionalities to the BandMatrix class.

To add a row() function to BandMatrix, I inherit the Eigen::internal::BandMatrixBase and add a row function inside:
Code: Select all
template <typename Derived>
   class BANDEDMatrixBase : public Eigen::internal::BandMatrixBase<Derived> {
      // returns a vector expression of the i-th row
      inline auto row(Eigen::Index i){...}
   };


I now carbon-copy the Eigen::internal::BandMatrix class, with the difference that the base is my custom BANDEDMatrixBase
Code: Select all
template<typename _Scalar, int Rows, int Cols, int Supers, int Subs, int Options>
   class BANDEDMatrix : public BANDEDMatrixBase<BandedMatrix<_Scalar,Rows,Cols,Supers,Subs,Options> >
   {


This all seems to work ok but when I now create a banded matrix, I get an error that the class template has too few template arguments.
Why exactly does this happen and what's the fix? I know I could simply change Eigen's source code but I am looking for portability for now. Even by using the original BandMatrixBase, I always get the error that the template has too few arguments.
fmeirinhos
Registered Member
Posts
4
Karma
0
The fix was in forward declaring the new class
Code: Select all
template<typename _Scalar, int Rows=Dynamic, int Cols=Dynamic, int Supers=Dynamic, int Subs=Dynamic, int Options=0>class BandedMatrix;


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]