diff options
author | 2010-07-01 20:52:40 -0400 | |
---|---|---|
committer | 2010-07-01 20:52:40 -0400 | |
commit | 5a52f2833f25fe6623a0e92d438afd5a86856f13 (patch) | |
tree | 02edb072fbb65be1246e57d8463aa2c953d66e1d /doc/C04_TutorialBlockOperations.dox | |
parent | 08c17c412ecf51621f03c131acff668fd5186d5d (diff) |
simplify and polish a bit the page 4 / block ops
Diffstat (limited to 'doc/C04_TutorialBlockOperations.dox')
-rw-r--r-- | doc/C04_TutorialBlockOperations.dox | 39 |
1 files changed, 8 insertions, 31 deletions
diff --git a/doc/C04_TutorialBlockOperations.dox b/doc/C04_TutorialBlockOperations.dox index 3f2916945..70773a463 100644 --- a/doc/C04_TutorialBlockOperations.dox +++ b/doc/C04_TutorialBlockOperations.dox @@ -6,39 +6,18 @@ namespace Eigen { \li \b Previous: \ref TutorialArrayClass \li \b Next: \ref TutorialAdvancedInitialization -This tutorial explains the essentials of Block operations together with many examples. +This tutorial page explains the essentials of block operations. +A block is a rectangular part of a matrix or array. Blocks expressions can be used both +as rvalues and as lvalues. As usual with Eigen expressions, this abstraction has zero runtime cost +provided that you let your compiler optimize. \b Table \b of \b contents - - \ref TutorialBlockOperationsWhatIs - - \ref TutorialBlockOperationsFixedAndDynamicSize + - \ref TutorialBlockOperationsUsing - \ref TutorialBlockOperationsSyntax - \ref TutorialBlockOperationsSyntaxColumnRows - \ref TutorialBlockOperationsSyntaxCorners - -\section TutorialBlockOperationsWhatIs What are Block operations? -Block operations are a set of functions that provide an easy way to access a set of coefficients -inside a \b Matrix or \link ArrayBase Array \endlink. A typical example is accessing a single row or -column within a given matrix, as well as extracting a sub-matrix from the latter. - -Blocks are highly flexible and can be used both as \b rvalues and \b lvalues in expressions, simplifying -the task of writing combined expressions with Eigen. - -\subsection TutorialBlockOperationsFixedAndDynamicSize Block operations and compile-time optimizations -As said earlier, a block operation is a way of accessing a group of coefficients inside a Matrix or -Array object. Eigen considers two different cases in order to provide compile-time optimization for -block operations, depending on whether the the size of the block to be accessed is known at compile time or not. - -To deal with these two situations, for each type of block operation Eigen provides a default version that -is able to work with run-time dependant block sizes and another one for block operations whose block size is -known at compile-time. - -Even though both functions can be applied to fixed-size objects, it is advisable to use special block operations -in this case, allowing Eigen to perform more optimizations at compile-time. - \section TutorialBlockOperationsUsing Using block operations -Block operations are implemented such that they are easy to use and combine with operators and other -matrices or arrays. The most general block operation in Eigen is called \link DenseBase::block() .block() \endlink. This function returns a block of size <tt>(p,q)</tt> whose origin is at <tt>(i,j)</tt> by using @@ -48,13 +27,11 @@ the following syntax: <tr><td align="center">\b Block \b operation</td> <td align="center">Default \b version</td> <td align="center">Optimized version when the<br>size is known at compile time</td></tr> -<tr><td>Block of length <tt>(p,q)</tt>, starting at <tt>(i,j)</tt></td> +<tr><td>Block of size <tt>(p,q)</tt>, starting at <tt>(i,j)</tt></td> <td>\code -MatrixXf m; -std::cout << m.block(i,j,p,q);\endcode </td> +matrix.block(i,j,p,q);\endcode </td> <td>\code -Matrix3f m; -std::cout << m.block<p,q>(i,j);\endcode </td> +matrix.block<p,q>(i,j);\endcode </td> </tr> </table> |