+
+ function |
+ description |
+ example |
+
+
+ \code seq(firstIdx,lastIdx) \endcode |
+ represents the sequence of integers ranging from \c firstIdx to \c lastIdx |
+ \code seq(2,5) <=> {2,3,4,5} \endcode |
+
+
+ \code seq(firstIdx,lastIdx,incr) \endcode |
+ same but using the increment \c incr to advance from one index to the next |
+ \code seq(2,8,2) <=> {2,4,6,8} \endcode |
+
+
+ \code seqN(firstIdx,size) \endcode |
+ represents the sequence of \c size integers starting from \c firstIdx |
+ \code seqN(2,5) <=> {2,3,4,5,6} \endcode |
+
+
+ \code seqN(firstIdx,size,incr) \endcode |
+ same but using the increment \c incr to advance from one index to the next |
+ \code seqN(2,3,3) <=> {2,5,8} \endcode |
+
+
+
+The \c firstIdx and \c lastIdx parameters can also be defined with the help of the Eigen::last symbol representing the index of the last row, column or element of the underlying matrix/vector once the arithmetic sequence is passed to it through operator().
+Here are some examples for a 2D array/matrix \c A and a 1D array/vector \c v.
+
+
+ Intent |
+ Code |
+ Block-API equivalence |
+
+
+ Bottom-left corner starting at row \c i with \c n columns |
+ \code A(seq(i,last), seqN(0,n)) \endcode |
+ \code A.bottomLeftCorner(A.rows()-i,n) \endcode |
+
+
+ %Block starting at \c i,j having \c m rows, and \c n columns |
+ \code A(seqN(i,m), seqN(i,n) \endcode |
+ \code A.block(i,j,m,n) \endcode |
+
+
+ %Block starting at \c i0,j0 and ending at \c i1,j1 |
+ \code A(seq(i0,i1), seq(j0,j1) \endcode |
+ \code A.block(i0,j0,i1-i0+1,j1-j0+1) \endcode |
+
+
+ Even columns of A |
+ \code A(all, seq(0,last,2)) \endcode |
+ |
+
+
+ First \c n odd rows A |
+ \code A(seqN(1,n,2), all) \endcode |
+ |
+
+
+ The last past one column |
+ \code A(all, last-1) \endcode |
+ \code A.col(A.cols()-2) \endcode |
+
+
+ The middle row |
+ \code A(last/2,all) \endcode |
+ \code A.row((A.rows()-1)/2) \endcode |
+
+
+ Last elements of v starting at i |
+ \code v(seq(i,last)) \endcode |
+ \code v.tail(v.size()-i) \endcode |
+
+
+ Last \c n elements of v |
+ \code v(seq(last+1-n,last)) \endcode |
+ \code v.tail(n) \endcode |
+
+
+
+As seen in the last exemple, referencing the
+
+ Intent |
+ Code |
+ Block-API equivalence |
+
+
+ Last \c n elements of v |
+ \code v(lastN(n)) \endcode |
+ \code v.tail(n) \endcode |
+
+
+ Bottom-right corner of A of size \c m times \c n |
+ \code v(lastN(m), lastN(n)) \endcode |
+ \code A.bottomRightCorner(m,n) \endcode |
+
+
+ Bottom-right corner of A of size \c m times \c n |
+ \code v(lastN(m), lastN(n)) \endcode |
+ \code A.bottomRightCorner(m,n) \endcode |
+
+
+ Last \c n columns taking 1 column over 3 |
+ \code A(all, lastN(n,3)) \endcode |
+ |
+
+
+
+\section TutorialSlicingFixed Compile time size and increment
+
+In terms of performance, %Eigen and the compiler can take advantage of compile-time size and increment.
+To this end, you can enforce compile-time parameters using Eigen::fix