[eigen] Flexible index ranges and sections

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hello,

This may be a little "out there" but I was wondering if there is any interest in supporting flexible index ranges a la Fortran and going beyond blocks to support arbitrary array sections (with strides). I've built these into our ObjexxFCL arrays and they can be done in C++11 with a nice syntax:
   MatrixXd A( {-m,m}, {1,n} ); // Index ranges
   A( {-j,j}, {k,n,2} ) // Section with non-unit column stride
There is no element lookup performance hit if the array stores an extra offset pointer. You can use operator[] to provide 0-based "1D" lookups but I'm not sure that having matrix(n) also do 0-based lookup doesn't become a confusing API. Adding array sections is probably a more invasive change, esp. to get max performance with different striding/contiguity scenarios. Operations between arrays/matrices should probably take a Fortranic view: OK if they are conformable and all generated arrays/matrices use the default 0-based indexing.

I could evaluate/experiment with this for Eigen if there is interest. I am using Eigen in a 3D structural modeling system but since it is too hard to change all the indexing it is limited to the LU solver engine at this point. I can imagine that Eigen could see wider use with greater indexing and sectioning flexibility.

Stuart
--
Stuart G Mentzer
Objexx Engineering
http://objexx.com



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/