Hi,
sorry for changing the subject, but since I only recently joint the list
I could not directly answer to the original thread (or at least don't
know how to).
I had a similar problem as Jesse Perla which prevented me from moving
from uBlas to Eigen2. Especially, I missed the support for iterators for
dense matrices. After reading the thread, this is no longer the case,
but for non-trivial reasons.
As far as I know, there are two main reasons why iterators are helpful:
1) Performance (i.e. iterating through a two-dimensional array is
usually faster than access by index)
2) Generic programming
However, as Benoit Jacob explained, 1) is generally not true for Eigen2,
and there are better alternatives. For Vectors, its not necessary anyway
(at least as long as they occupy a connected part of memory) since
pointers are simple but effective iterators.
For matrices, iterators are harder to implement, but couldn't be
implemented in a standard way, since there is no standard. Thus, Generic
programming wouldn't work for matrices.
For example, unless Jesse Perla explains, it ublas offers standard
compliant iterators for columns and rows, but the syntax is different,
e.g. looks like
column(A, colIndex).begin()
column(A, colIndex).end()
row(A, rowIndex).begin()
row(A, rowIndex).end()
with A some matrix. Same for ranges, slices, etc. This is done by and
matrix template implementation differently, and therefore, code that
takes some unknown matrix class as template parameter couldn't be really
generic, unless it just operates on indices (since the ()-operator as
access by index is implemented by every matrix class implementation I
know).
Still, iterator support might be helpful to re-use algorithms that take
iterators as input. But there is a much easier solution to achieve that
(at least that's how I solved this problem): just use both interfaces in
parallel. For example, initialise your matrix as uBlas matrix and then
initialise an Eigen2 matrix using exactly the same block of memory
occupied by the original uBlas matrix. Thus, depending on the situation,
you could either use the uBlas or the Eigen2 interface, whatever suits
you best (okay, some care dealing with delayed execution is required).
At least, for me that works perfectly well and I don't need iterator
support any more. Even more, I think adding this support could be even
dangerous, since I am pretty sure that it would be used much more often
then would be wise.
Anyway, I would recommend to add some remarks and explanations in the
documentation especially for future Eigen users who come from an
iterator approach. This will prevent them from writing bad code just
because they stick to their well-known iterators.
Regards,
Mark