Benoit Jacob | e078bb2 | 2010-06-26 14:00:00 -0400 | [diff] [blame^] | 1 | namespace Eigen { |
| 2 | |
| 3 | /** \page TutorialAdvancedInitialization Tutorial - Advanced initialization |
| 4 | \ingroup Tutorial |
| 5 | |
| 6 | \section TutorialMatrixArithmCommaInitializer Comma initializer |
| 7 | |
| 8 | Eigen offers a comma initializer syntax which allows to set all the coefficients |
| 9 | of any dense objects (matrix, vector, array, block, etc.) to specific values: |
| 10 | \include Tutorial_commainit_01.cpp |
| 11 | Output: \verbinclude Tutorial_commainit_01.out |
| 12 | |
| 13 | Moreover, the elements of the initialization list may themselves be Eigen expressions: |
| 14 | \include Tutorial_commainit_02.cpp |
| 15 | Output: \verbinclude Tutorial_commainit_02.out |
| 16 | |
| 17 | <span class="note">\b Side \b note: here \link CommaInitializer::finished() .finished() \endlink |
| 18 | is used to get the actual matrix object once the comma initialization |
| 19 | of our temporary submatrix is done. Note that despite the apparent complexity of such an expression, |
| 20 | Eigen's comma initializer usually compiles to very optimized code without any overhead.</span> |
| 21 | |
| 22 | |
| 23 | TODO mention using the comma initializer to fill a block xpr like m.row(i) << 1,2,3; |
| 24 | |
| 25 | TODO add more sections about Identity(), Zero(), Constant(), Random(), LinSpaced(). |
| 26 | |
| 27 | */ |
| 28 | |
| 29 | } |