Re: [eigen] On a flexible API for submatrices, slicing, indexing, masking, etc. |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
- you kept "span" (one less character?), but I think "range" is more intuitive (minor)There are several advantages:- Yes one fewer character! Shorter without adding confusion is always better.- Consistency with Armadillo (minor advantage).- The word "range" is overloaded much more than span. There's boost::range, the WIP range v3, and the "range-based" for loops. These big shots can have different conventions, some times [first, last) (range-based for), some times [begin, end) (boost's irange). For span, the only conflict is gsl::span right now (which should really be named array_view anyway, akin to std::string_view. It also takes in (base_ptr, length), so it's categorically different from our use).Just thought of two more points:1. The word "range" in the C++ context often means iterator ranges. Iterators copies the pointer usage, you can ++ until it equals the end of the range, and more importantly you can dereference them. The range we are discussing are range of indices. It might be a good idea to distance away from the (iterator) range connotation.2. If we really want to be nerdy, mathematician has precise definition of spans, as in "linear span" and "convex span". Convex span is sort of exactly what we mean when we write span(first, last). So there you go...
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |