On Mon, Jan 4, 2010 at 9:23 AM, Hauke Heibel
<hauke.heibel@xxxxxxxxxxxxxx> wrote:
Thanks a lot for the explanation.
Is this completely specific to uBlas or are there other Boost
libraries standardizing on the same interface? uBlas alone is not
A few general thoughts on this stuff.
- Iteration on vectors is a no-brainer... follow the standard library.
- I would say that iterators for matrices (not vectors) in uBlas are very counterintuitive and not really proper iterators. They are more like cursors through the matrix (to be discussed later).
- Iteration through matrices is much more important for sparse algorithms than dense ones.
- Many on the ublas list are unhappy with the naming, etc. for the matrix iterators, so I wouldn't try to achieve consistency
- The iteration approach in ublas makes it very hard to integrate with multi-dimensional array/tensor libraries since it is tied to 2 dimensions. boost::multi_array has a differerent approach.
- It seems to me that MTL4 has a better iteration/cursor approach than ublas and may be a better model to match.
- The GLAS (next version of ublas hopefully, and providing a consistent interface for linear algebra)guys and MTL guys are sometimes talking so looking at those is a good idea.
So my suggestions would be:
1) Iteration for Vectors/slices of matrices/etc.:
- To me this is the first-order concern and would prevent me from using Eigen. I have a lot of code that uses vectors and multi_arrays for interpolation, etc. and I can't live without std::binary_search to bracket results efficiently
- The specifications for this are easy: http://www.sgi.com/tech/stl/RandomAccessContainer.html
- I think it is reasonable to drop a couple of the requirements on the Concept here, but I am not sure if it is necessary.
- If it was possible to patch this to Eigen2, then I might be able to convert over.
A few 2nd order comments on this:
- Since the standard library will have ranges soon enough to make the libraries more usable, I think that it may be worth designing ahead to ensure range compatibility; http://www..boost.org/doc/libs/1_41_0/libs/range/doc/range.html#bidirectional_range
- Also I use std::transform all over the place... thought it would be great if there was an easy Eigen equivalent: eigen::transform(my_eigen_container, my_eigen_container_out, my_functor). If this can use your reduction methods, that would be really awesome.
2) Separate Iterators vs. Cursors
With ublas, you don't really have iterators for matrices. It is more like a cursor through the matrix. If