Re: [eigen] New indexing/slicing API: almost ready to be merged

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


yes, I've initially thought about head/tail to match the current API. It does read well for vectors, but for matrices it's borderline: A(head(n),tail(m)) and when used alone head(n) to say [0,1,...,n-1] it's really weird.

​​Just thought of something: use first(n) and last(n),​ and rename last to back. This coincides with STL's vector/list::back() which refers to the last element.

The capitalized 'N' also help to see the connection with seqN.

​True, but there's no version without N in this case, so there's no risk of confusion as in seq vs seqN.

If anyone have other better suggestions to offer, I'm all for it!!
 

Also, for what it's worth, I do prefer 'seqn' to 'seqN'. I feel the word "seq" is already short enough that adding an extra letter differentiates it enough. Of course I do realize that 'N' helps emphasizing the difference between seq and seqN so it helps with maintaining correctness. 

true story: yesterday I wasted 5mn in debugging a unit test whereas I simply made a typo in writing seq(...) instead of seqN(...), so I would rather re-enforce the differences!

Okay ​I'm convinced. Correctness over everything else...


 

So I propose to:

1) Eigen::placeholders::all   -->  Eigen::All
2) move last/end to Eigen::Symbols

​Whatever we name the sub namespace, I feel "all" should be in the same place as "last" and "end". Also I prefer "all" to "All". I find it confusing to have symbols with different capitalization rules when indexing, i.e., A(end) vs A(All).



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