xref: /aosp_15_r20/external/eigen/doc/MatrixfreeSolverExample.dox (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Li
2*bf2c3715SXin Linamespace Eigen {
3*bf2c3715SXin Li
4*bf2c3715SXin Li/**
5*bf2c3715SXin Li
6*bf2c3715SXin Li\eigenManualPage MatrixfreeSolverExample Matrix-free solvers
7*bf2c3715SXin Li
8*bf2c3715SXin LiIterative 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*bf2c3715SXin Li - \c Index \c rows() and \c Index \c cols(): returns number of rows and columns respectively
10*bf2c3715SXin Li - \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*bf2c3715SXin Li
12*bf2c3715SXin Li\c Eigen::internal::traits<> must also be specialized for the wrapper type.
13*bf2c3715SXin Li
14*bf2c3715SXin LiHere is a complete example wrapping an Eigen::SparseMatrix:
15*bf2c3715SXin Li\include matrixfree_cg.cpp
16*bf2c3715SXin LiOutput: \verbinclude matrixfree_cg.out
17*bf2c3715SXin Li
18*bf2c3715SXin Li*/
19*bf2c3715SXin Li
20*bf2c3715SXin Li}