Re: [eigen] On a flexible API for submatrices, slicing, indexing, masking, etc. |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
[…]. Last Massimilliano's post seems to imply that APL also uses this strategy to define bounds...gaelI didn’t mean that sorry, I was just referring to the general idea behind APL's iota function, eg. transforman integer N into the sequence [1,…,N], then *lazily* apply operations like arithmetics, transpositions,etc… to create/manipulate vectors.the API you’re proposing clearly differs in that N is given by the 'source’ vector, and the resulting index setis clamped to fit in, but the idea ( and its benefits ) seems the same conceptually …as an alternative to gael’s iota < bounds, one could follow more closely APL by introducing an _expression_representing the number of source elements:A(iota(all)) // as A(all)A(iota(5)) // first five elementsA(2+iota(5)) // from index 2 to 6A(2*iota(all) ) // even numbers
A(2*iota(5) ) // even numbers up to 8A(3+2*iota(all-2) ) // 3,5,7,… up to N-2A(all - iota(5) ) // N-1,N-2,..,N-5...where bound checking is meant to follow Eigen habits ( eg. hard error if compile time, assert on runtime )
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |