I want to have a recursive function
template <typename Derived>
void f(Eigen::MatrixBase<Derived>& m)
{
size_t blockRows = ...
size_t blockCols = ...
....
f(m.block(0, 0, blockRows, blockCols));
}
This unfortunately results in an infinite compile time recursion.
The first call would be to
f<Eigen::MatrixBase<Derived> >
The second would be to
f<Eigen::Block<Eigen::MatrixBase<Derived>, ... > >
The third call would be to
f<Eigen::Block<Eigen::Block<Eigen::MatrixBase<Derived>, ... >, ... > >
Every time a block of block is requested.
What is the best practice to implement recursive functions in Eigen, which still work on any Eigen matrix type?
I think, I should use some type, that still wraps the same piece of memory, but is not an expression template and it is evaluated.