Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 1 | namespace Eigen { |
| 2 | |
Gael Guennebaud | 93ee82b | 2013-01-05 16:37:11 +0100 | [diff] [blame] | 3 | /** \eigenManualPage TutorialBlockOperations Block operations |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 4 | |
Gael Guennebaud | 091a49c | 2013-01-06 23:48:59 +0100 | [diff] [blame] | 5 | This page explains the essentials of block operations. |
Benoit Jacob | 5a52f28 | 2010-07-01 20:52:40 -0400 | [diff] [blame] | 6 | A block is a rectangular part of a matrix or array. Blocks expressions can be used both |
| 7 | as rvalues and as lvalues. As usual with Eigen expressions, this abstraction has zero runtime cost |
| 8 | provided that you let your compiler optimize. |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 9 | |
Gael Guennebaud | 93ee82b | 2013-01-05 16:37:11 +0100 | [diff] [blame] | 10 | \eigenAutoToc |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 11 | |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 12 | \section TutorialBlockOperationsUsing Using block operations |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 13 | |
| 14 | The most general block operation in Eigen is called \link DenseBase::block() .block() \endlink. |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 15 | There are two versions, whose syntax is as follows: |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 16 | |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 17 | <table class="manual"> |
| 18 | <tr><th>\b %Block \b operation</td> |
| 19 | <th>Version constructing a \n dynamic-size block expression</th> |
| 20 | <th>Version constructing a \n fixed-size block expression</th></tr> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 21 | <tr><td>%Block of size <tt>(p,q)</tt>, starting at <tt>(i,j)</tt></td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 22 | <td>\code |
Benoit Jacob | 5a52f28 | 2010-07-01 20:52:40 -0400 | [diff] [blame] | 23 | matrix.block(i,j,p,q);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 24 | <td>\code |
Benoit Jacob | 5a52f28 | 2010-07-01 20:52:40 -0400 | [diff] [blame] | 25 | matrix.block<p,q>(i,j);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 26 | </tr> |
| 27 | </table> |
| 28 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 29 | As always in Eigen, indices start at 0. |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 30 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 31 | Both versions can be used on fixed-size and dynamic-size matrices and arrays. |
| 32 | These two expressions are semantically equivalent. |
| 33 | The only difference is that the fixed-size version will typically give you faster code if the block size is small, |
| 34 | but requires this size to be known at compile time. |
| 35 | |
| 36 | The following program uses the dynamic-size and fixed-size versions to print the values of several blocks inside a |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 37 | matrix. |
| 38 | |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 39 | <table class="example"> |
| 40 | <tr><th>Example:</th><th>Output:</th></tr> |
| 41 | <tr><td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 42 | \include Tutorial_BlockOperations_print_block.cpp |
| 43 | </td> |
| 44 | <td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 45 | \verbinclude Tutorial_BlockOperations_print_block.out |
| 46 | </td></tr></table> |
| 47 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 48 | In the above example the \link DenseBase::block() .block() \endlink function was employed as a \em rvalue, i.e. |
| 49 | it was only read from. However, blocks can also be used as \em lvalues, meaning that you can assign to a block. |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 50 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 51 | This is illustrated in the following example. This example also demonstrates blocks in arrays, which works exactly like the above-demonstrated blocks in matrices. |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 52 | |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 53 | <table class="example"> |
| 54 | <tr><th>Example:</th><th>Output:</th></tr> |
| 55 | <tr><td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 56 | \include Tutorial_BlockOperations_block_assignment.cpp |
| 57 | </td> |
| 58 | <td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 59 | \verbinclude Tutorial_BlockOperations_block_assignment.out |
| 60 | </td></tr></table> |
| 61 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 62 | While the \link DenseBase::block() .block() \endlink method can be used for any block operation, there are |
| 63 | other methods for special cases, providing more specialized API and/or better performance. On the topic of performance, all what |
| 64 | matters is that you give Eigen as much information as possible at compile time. For example, if your block is a single whole column in a matrix, |
| 65 | using the specialized \link DenseBase::col() .col() \endlink function described below lets Eigen know that, which can give it optimization opportunities. |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 66 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 67 | The rest of this page describes these specialized methods. |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 68 | |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 69 | \section TutorialBlockOperationsSyntaxColumnRows Columns and rows |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 70 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 71 | Individual columns and rows are special cases of blocks. Eigen provides methods to easily address them: |
| 72 | \link DenseBase::col() .col() \endlink and \link DenseBase::row() .row()\endlink. |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 73 | |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 74 | <table class="manual"> |
| 75 | <tr><th>%Block operation</th> |
| 76 | <th>Method</th> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 77 | <tr><td>i<sup>th</sup> row |
| 78 | \link DenseBase::row() * \endlink</td> |
| 79 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 80 | matrix.row(i);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 81 | </tr> |
| 82 | <tr><td>j<sup>th</sup> column |
| 83 | \link DenseBase::col() * \endlink</td> |
| 84 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 85 | matrix.col(j);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 86 | </tr> |
| 87 | </table> |
| 88 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 89 | The argument for \p col() and \p row() is the index of the column or row to be accessed. As always in Eigen, indices start at 0. |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 90 | |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 91 | <table class="example"> |
| 92 | <tr><th>Example:</th><th>Output:</th></tr> |
| 93 | <tr><td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 94 | \include Tutorial_BlockOperations_colrow.cpp |
| 95 | </td> |
| 96 | <td> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 97 | \verbinclude Tutorial_BlockOperations_colrow.out |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 98 | </td></tr></table> |
| 99 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 100 | That example also demonstrates that block expressions (here columns) can be used in arithmetic like any other expression. |
| 101 | |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 102 | |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 103 | \section TutorialBlockOperationsSyntaxCorners Corner-related operations |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 104 | |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 105 | Eigen also provides special methods for blocks that are flushed against one of the corners or sides of a |
| 106 | matrix or array. For instance, \link DenseBase::topLeftCorner() .topLeftCorner() \endlink can be used to refer |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 107 | to a block in the top-left corner of a matrix. |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 108 | |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 109 | The different possibilities are summarized in the following table: |
| 110 | |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 111 | <table class="manual"> |
| 112 | <tr><th>%Block \b operation</td> |
| 113 | <th>Version constructing a \n dynamic-size block expression</th> |
| 114 | <th>Version constructing a \n fixed-size block expression</th></tr> |
Jitse Niesen | 3070164 | 2010-06-29 11:42:51 +0100 | [diff] [blame] | 115 | <tr><td>Top-left p by q block \link DenseBase::topLeftCorner() * \endlink</td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 116 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 117 | matrix.topLeftCorner(p,q);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 118 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 119 | matrix.topLeftCorner<p,q>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 120 | </tr> |
Jitse Niesen | 3070164 | 2010-06-29 11:42:51 +0100 | [diff] [blame] | 121 | <tr><td>Bottom-left p by q block |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 122 | \link DenseBase::bottomLeftCorner() * \endlink</td> |
| 123 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 124 | matrix.bottomLeftCorner(p,q);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 125 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 126 | matrix.bottomLeftCorner<p,q>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 127 | </tr> |
Jitse Niesen | 3070164 | 2010-06-29 11:42:51 +0100 | [diff] [blame] | 128 | <tr><td>Top-right p by q block |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 129 | \link DenseBase::topRightCorner() * \endlink</td> |
| 130 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 131 | matrix.topRightCorner(p,q);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 132 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 133 | matrix.topRightCorner<p,q>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 134 | </tr> |
Jitse Niesen | 3070164 | 2010-06-29 11:42:51 +0100 | [diff] [blame] | 135 | <tr><td>Bottom-right p by q block |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 136 | \link DenseBase::bottomRightCorner() * \endlink</td> |
| 137 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 138 | matrix.bottomRightCorner(p,q);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 139 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 140 | matrix.bottomRightCorner<p,q>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 141 | </tr> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 142 | <tr><td>%Block containing the first q rows |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 143 | \link DenseBase::topRows() * \endlink</td> |
| 144 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 145 | matrix.topRows(q);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 146 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 147 | matrix.topRows<q>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 148 | </tr> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 149 | <tr><td>%Block containing the last q rows |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 150 | \link DenseBase::bottomRows() * \endlink</td> |
| 151 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 152 | matrix.bottomRows(q);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 153 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 154 | matrix.bottomRows<q>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 155 | </tr> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 156 | <tr><td>%Block containing the first p columns |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 157 | \link DenseBase::leftCols() * \endlink</td> |
| 158 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 159 | matrix.leftCols(p);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 160 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 161 | matrix.leftCols<p>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 162 | </tr> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 163 | <tr><td>%Block containing the last q columns |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 164 | \link DenseBase::rightCols() * \endlink</td> |
| 165 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 166 | matrix.rightCols(q);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 167 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 168 | matrix.rightCols<q>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 169 | </tr> |
| 170 | </table> |
| 171 | |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 172 | Here is a simple example illustrating the use of the operations presented above: |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 173 | |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 174 | <table class="example"> |
| 175 | <tr><th>Example:</th><th>Output:</th></tr> |
| 176 | <tr><td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 177 | \include Tutorial_BlockOperations_corner.cpp |
| 178 | </td> |
| 179 | <td> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 180 | \verbinclude Tutorial_BlockOperations_corner.out |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 181 | </td></tr></table> |
| 182 | |
| 183 | |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 184 | \section TutorialBlockOperationsSyntaxVectors Block operations for vectors |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 185 | |
Benoit Jacob | 1c15a6d | 2010-10-18 08:44:27 -0400 | [diff] [blame] | 186 | Eigen also provides a set of block operations designed specifically for the special case of vectors and one-dimensional arrays: |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 187 | |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 188 | <table class="manual"> |
| 189 | <tr><th> %Block operation</th> |
| 190 | <th>Version constructing a \n dynamic-size block expression</th> |
| 191 | <th>Version constructing a \n fixed-size block expression</th></tr> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 192 | <tr><td>%Block containing the first \p n elements |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 193 | \link DenseBase::head() * \endlink</td> |
| 194 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 195 | vector.head(n);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 196 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 197 | vector.head<n>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 198 | </tr> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 199 | <tr><td>%Block containing the last \p n elements |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 200 | \link DenseBase::tail() * \endlink</td> |
| 201 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 202 | vector.tail(n);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 203 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 204 | vector.tail<n>();\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 205 | </tr> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 206 | <tr><td>%Block containing \p n elements, starting at position \p i |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 207 | \link DenseBase::segment() * \endlink</td> |
| 208 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 209 | vector.segment(i,n);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 210 | <td>\code |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 211 | vector.segment<n>(i);\endcode </td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 212 | </tr> |
| 213 | </table> |
| 214 | |
| 215 | |
| 216 | An example is presented below: |
Gael Guennebaud | f66fe26 | 2010-10-19 11:40:49 +0200 | [diff] [blame] | 217 | <table class="example"> |
| 218 | <tr><th>Example:</th><th>Output:</th></tr> |
| 219 | <tr><td> |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 220 | \include Tutorial_BlockOperations_vector.cpp |
| 221 | </td> |
| 222 | <td> |
Jitse Niesen | b0bd1cf | 2010-07-14 10:16:12 +0100 | [diff] [blame] | 223 | \verbinclude Tutorial_BlockOperations_vector.out |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 224 | </td></tr></table> |
| 225 | |
Carlos Becker | 97889a7 | 2010-06-28 18:42:59 +0100 | [diff] [blame] | 226 | */ |
| 227 | |
| 228 | } |