Re: [eigen] array slicing/range

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


Hi Jinglei,

>  I'm wondering if it's possible to use array(i:j)

Nope.  The : isn't a reserved operator in C++, so for you to use an
expression like array(i:j), the best thing you could do would be to
write your own preprocessor that automagically takes expressions of
that form and translates them to array.segment(i,j)

David Bindel (Cornell) has a piece of software that does similar (but
not what you want) preprocessing work for constant matrices:

http://www.cs.cornell.edu/~bindel/cims/matexpr/

However, my recommendation is that you just stick with the Eigen API
unless you want to spend three days learning a parsing tool like YACC
to do what you want.

Warm Regards,
Aron Ahmadia

On Fri, Feb 5, 2010 at 1:53 PM, Jinglei Hu <jingleihu@xxxxxxxxx> wrote:
> Hi guys,
>
> I knew from the Eigen developer that one can use array.segment(i, j) to get
> slice of an array. I'm wondering if it's possible to use array(i:j) to get
> slice just like Fortran.
>
> Cheers,
> Jinglei
>
>
>



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