12 #ifndef BOGUS_EIGEN_LINEAR_SOLVERS
13 #define BOGUS_EIGEN_LINEAR_SOLVERS
15 #include "../Utils/LinearSolverBase.hpp"
18 #include <Eigen/Cholesky>
22 template<
typename Decomposition,
typename RhsType>
25 #if EIGEN_VERSION_AT_LEAST(3,2,90)
26 typedef const Eigen::Solve< Decomposition, RhsType > Type ;
28 typedef Eigen::internal::solve_retval< Decomposition, RhsType > Type ;
32 template <
typename Derived >
35 typedef typename Derived::PlainObject MatrixType ;
36 typedef Eigen::FullPivLU< MatrixType > FactType ;
38 template <
typename RhsT >
struct Result {
39 typedef typename EigenSolveResult< FactType, RhsT >::Type Type ;
41 template <
typename RhsT >
42 struct Result< Eigen::MatrixBase< RhsT > > {
43 typedef typename Result< RhsT >::Type Type ;
48 template <
typename Derived >
49 struct LU< Eigen::MatrixBase< Derived > >
52 typedef Eigen::MatrixBase< Derived > MatrixType ;
56 template<
typename OtherDerived >
57 explicit LU (
const Eigen::MatrixBase< OtherDerived >& mat )
61 template<
typename OtherDerived >
64 m_fact.compute( mat ) ;
68 template <
typename RhsT,
typename ResT >
69 void solve(
const Eigen::MatrixBase< RhsT >& rhs, ResT& res )
const
71 res = m_fact.solve( rhs ) ;
74 template <
typename RhsT >
75 typename Traits::template Result< Eigen::MatrixBase< RhsT > >::Type
76 solve(
const Eigen::MatrixBase< RhsT >& rhs )
const
78 return m_fact.solve( rhs ) ;
82 typename Traits::FactType m_fact ;
85 template <
typename Scalar,
int Rows,
int Cols = Rows,
int Options = 0 >
86 struct DenseLU :
public LU< Eigen::MatrixBase< Eigen::Matrix< Scalar, Rows, Cols, Options > > >
89 template<
typename OtherDerived >
90 explicit DenseLU (
const Eigen::MatrixBase< OtherDerived >& mat )
95 template <
typename Derived >
98 typedef typename Derived::PlainObject MatrixType ;
99 typedef Eigen::LDLT< MatrixType > FactType ;
101 template <
typename RhsT >
struct Result {
102 typedef typename EigenSolveResult< FactType, RhsT >::Type Type ;
104 template <
typename RhsT >
105 struct Result< Eigen::MatrixBase< RhsT > > {
106 typedef typename Result< RhsT >::Type Type ;
111 template <
typename Derived >
112 struct LDLT< Eigen::MatrixBase< Derived > >
115 typedef Eigen::MatrixBase< Derived > MatrixType ;
119 template<
typename OtherDerived >
120 explicit LDLT (
const Eigen::MatrixBase< OtherDerived >& mat )
124 template<
typename OtherDerived >
127 m_fact.compute( mat ) ;
131 template <
typename RhsT,
typename ResT >
132 void solve(
const Eigen::MatrixBase< RhsT >& rhs, ResT& res )
const
134 res = m_fact.solve( rhs ) ;
137 template <
typename RhsT >
138 typename Traits::template Result< Eigen::MatrixBase< RhsT > >::Type
139 solve(
const Eigen::MatrixBase< RhsT >& rhs )
const
141 return m_fact.solve( rhs ) ;
145 typename Traits::FactType m_fact ;
148 template <
typename Scalar,
int Rows,
int Options = 0 >
149 struct DenseLDLT :
public LDLT< Eigen::MatrixBase< Eigen::Matrix< Scalar, Rows, Rows, Options > > >
152 template<
typename OtherDerived >
153 explicit DenseLDLT (
const Eigen::MatrixBase< OtherDerived >& mat )
158 template <
typename Derived,
typename RhsT >
162 return solver.solve( rhs ) ;
Definition: EigenLinearSolvers.hpp:23
Definition: EigenLinearSolvers.hpp:86
Definition: LinearSolverBase.hpp:22
Base class for linear solvers on base ( i.e. non-block ) matrices.
Definition: LinearSolverBase.hpp:26
Definition: EigenLinearSolvers.hpp:149
Base class for LDLT factorizations.
Definition: LinearSolverBase.hpp:72
Base class for LU factorizations.
Definition: LinearSolverBase.hpp:66
LinearSolverTraits< LU< MatrixType > >::template Result< RhsT >::Type solve(const RhsT &rhs) const
Returns the solution x of the linear system M * x = rhs.
Definition: LinearSolverBase.hpp:32