10 #ifndef EIGEN_SPARSE_SOLVE_H 11 #define EIGEN_SPARSE_SOLVE_H 20 template<
typename DecompositionType,
typename Rhs>
23 typedef typename DecompositionType::MatrixType
MatrixType;
28 :
public ReturnByValue<sparse_solve_retval_base<_DecompositionType, Rhs> >
33 typedef typename Base::Index
Index;
36 : m_dec(dec), m_rhs(rhs)
39 inline Index
rows()
const {
return m_dec.cols(); }
40 inline Index
cols()
const {
return m_rhs.cols(); }
41 inline const DecompositionType&
dec()
const {
return m_dec; }
42 inline const RhsNestedCleaned&
rhs()
const {
return m_rhs; }
44 template<
typename Dest>
inline void evalTo(Dest& dst)
const 50 template<
typename DestScalar,
int DestOptions,
typename DestIndex>
54 static const int NbColsAtOnce = 4;
55 int rhsCols = m_rhs.cols();
56 int size = m_rhs.rows();
59 for(
int k=0; k<rhsCols; k+=NbColsAtOnce)
61 int actualCols = std::min<int>(rhsCols-k, NbColsAtOnce);
62 tmp.leftCols(actualCols) = m_rhs.middleCols(k,actualCols);
63 tmpX.leftCols(actualCols) = m_dec.solve(tmp.leftCols(actualCols));
64 dst.
middleCols(k,actualCols) = tmpX.leftCols(actualCols).sparseView();
71 #define EIGEN_MAKE_SPARSE_SOLVE_HELPERS(DecompositionType,Rhs) \ 72 typedef typename DecompositionType::MatrixType MatrixType; \ 73 typedef typename MatrixType::Scalar Scalar; \ 74 typedef typename MatrixType::RealScalar RealScalar; \ 75 typedef typename MatrixType::Index Index; \ 76 typedef Eigen::internal::sparse_solve_retval_base<DecompositionType,Rhs> Base; \ 81 sparse_solve_retval(const DecompositionType& dec, const Rhs& rhs) \ 88 template<
typename DecompositionType,
typename Rhs,
typename Guess>
91 typedef typename DecompositionType::MatrixType
MatrixType;
92 typedef Matrix<
typename Rhs::Scalar,
93 MatrixType::ColsAtCompileTime,
94 Rhs::ColsAtCompileTime,
95 Rhs::PlainObject::Options,
96 MatrixType::MaxColsAtCompileTime,
101 :
public ReturnByValue<solve_retval_with_guess<DecompositionType, Rhs, Guess> >
103 typedef typename DecompositionType::Index
Index;
106 : m_dec(dec), m_rhs(rhs), m_guess(guess)
109 inline Index
rows()
const {
return m_dec.cols(); }
110 inline Index
cols()
const {
return m_rhs.cols(); }
112 template<
typename Dest>
inline void evalTo(Dest& dst)
const 115 m_dec._solveWithGuess(m_rhs,dst);
128 #endif // EIGEN_SPARSE_SOLVE_H A versatible sparse matrix representation.
ReturnByValue< sparse_solve_retval_base > Base
void evalTo(Dest &dst) const
void evalTo(Dest &dst) const
const DecompositionType & m_dec
remove_all< typename Rhs::Nested >::type RhsNestedCleaned
void defaultEvalTo(SparseMatrix< DestScalar, DestOptions, DestIndex > &dst) const
_DecompositionType DecompositionType
SparseMatrix< typename Rhs::Scalar, Rhs::Options, typename Rhs::Index > ReturnType
DecompositionType::MatrixType MatrixType
ColsBlockXpr middleCols(Index startCol, Index numCols)
const DecompositionType & dec() const
const Guess::Nested m_guess
DecompositionType::MatrixType MatrixType
The matrix class, also used for vectors and row-vectors.
const RhsNestedCleaned & rhs() const
DecompositionType::Index Index
sparse_solve_retval_base(const DecompositionType &dec, const Rhs &rhs)
solve_retval_with_guess(const DecompositionType &dec, const Rhs &rhs, const Guess &guess)
Matrix< typename Rhs::Scalar, MatrixType::ColsAtCompileTime, Rhs::ColsAtCompileTime, Rhs::PlainObject::Options, MatrixType::MaxColsAtCompileTime, Rhs::MaxColsAtCompileTime > ReturnType
const DecompositionType & m_dec