Re: [eigen] On a flexible API for submatrices, slicing, indexing, masking, etc. |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
This and the shorter "Fix" are both nice. I still prefer the all lower case version though, since it's a function and there's no name collision.yes, my favorites so far are: ic<N>, fix<N>, fixed<N>
I also want to revisit the ordering of first, last, and the (optional) incr parameters. We have these existing conventions:- Matlab/Julia: (first, [incr,] last)- Numpy: (first, end [, incr]), and also indices can be negative numbersAs you can see, it matches neither.the first,last[,incr] convention is not new:- Fortran,- S-Lang,- Mathematica- boost::irange- R: seq()- Swift: stride()- and probably more
I fail to see a good reason why we shouldn't just adopt Matlab's convention of (first, incr, last), similar to libigl's colon(), so that there's one few set of convention to remember.A strong argument is that in C++ optional parameters usually go last. Moreover, we also need to be consistant between the two variants, and aseqn(first,incr,size) would be really new, whereas many functions/language follows the (first,size,incr) order.
Martlab aficionados are still free to declare "auto colon(first,incr,last) { return aseq(first,last,incr)); }", and done.BTW, regarding inclusive vs exclusive upper bound, python's users seem to have several arguments, all grounded on the zero-based indexing thing: http://stackoverflow.com/questions/11364533/why-are- .slice-and-range-upper-bound- exclusive
gael
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |