Googler | 45874d8 | 2019-08-21 12:06:47 -0700 | [diff] [blame] | 1 | |
| 2 | namespace Eigen { |
| 3 | |
| 4 | /** |
| 5 | |
| 6 | \eigenManualPage MatrixfreeSolverExample Matrix-free solvers |
| 7 | |
| 8 | Iterative solvers such as ConjugateGradient and BiCGSTAB can be used in a matrix free context. To this end, user must provide a wrapper class inheriting EigenBase<> and implementing the following methods: |
| 9 | - \c Index \c rows() and \c Index \c cols(): returns number of rows and columns respectively |
| 10 | - \c operator* with your type and an %Eigen dense column vector (its actual implementation goes in a specialization of the internal::generic_product_impl class) |
| 11 | |
| 12 | \c Eigen::internal::traits<> must also be specialized for the wrapper type. |
| 13 | |
| 14 | Here is a complete example wrapping an Eigen::SparseMatrix: |
| 15 | \include matrixfree_cg.cpp |
| 16 | Output: \verbinclude matrixfree_cg.out |
| 17 | |
| 18 | */ |
| 19 | |
| 20 | } |