Re: [eigen] RFC - how to avoid (impossible) recursive declarations

[ Thread Index | Date Index | More Archives ]

On 09/21/2012 10:56:29 AM, Christoph Hertzberg wrote:
On 21.09.2012 10:46, Helmut Jarausch wrote:
template <typename Derived, typename OtherDerived>
VectorXd Block_Solve(MatrixBase<Derived>& A, const
MatrixBase<OtherDerived>& b )
{ int   N = A.rows(),  m = Teil_Dim, mrest= N-m;
typedef typename Eigen::Block<Derived,Dynamic,Dynamic> PartialMatrix;
   typedef typename OtherDerived::SegmentReturnType PartialVector;


seems to get the compiler into endless recursion since I get endless
error messages.
It probably tries recursive definitions which have to fail.

That's essentially the same problem Norman Goldstein faces at the moment (see the thread "Recursion and block matrices"). The easiest solution would be to use the Ref-class from the dev-branch (see Gael's mails in that thread),

Many thanks for that pointer, I'm going to look into it.

otherwise you need to handcraft some kind of Map object.

This evokes some old, ugly memories on FORTRAN EQUIVALANCE, which is almost a guarantee for bugs.

The other alternative is to avoid recursion at all. Essentially you can simulate both "walking up" and "walking down" the stack by one for-loop each.

Yes, thanks. Currently, I don't "need" a solution. It's some sort of sport. I'm trying to convert an example using my own, old, non-template matrix library. And recursion is so much more elegant while loops are sometimes hard to understand.

Many thanks,

P.S. I'm using the dev-branch all the time - I just didn't know about the Ref-class.

Mail converted by MHonArc 2.6.19+