10#ifndef EIGEN_SPARSESOLVERBASE_H
11#define EIGEN_SPARSESOLVERBASE_H
21template<
typename Decomposition,
typename Rhs,
typename Dest>
22void solve_sparse_through_dense_panels(
const Decomposition &dec,
const Rhs& rhs, Dest &dest)
24 EIGEN_STATIC_ASSERT((Dest::Flags&
RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);
25 typedef typename Dest::Scalar DestScalar;
27 static const Index NbColsAtOnce = 4;
28 Index rhsCols = rhs.cols();
29 Index size = rhs.rows();
31 Index tmpCols = (std::min)(rhsCols, NbColsAtOnce);
34 for(Index k=0; k<rhsCols; k+=NbColsAtOnce)
36 Index actualCols = std::min<Index>(rhsCols-k, NbColsAtOnce);
37 tmp.leftCols(actualCols) = rhs.middleCols(k,actualCols);
38 tmpX.leftCols(actualCols) = dec.solve(tmp.leftCols(actualCols));
39 dest.middleCols(k,actualCols) = tmpX.leftCols(actualCols).sparseView();
52template<
typename Derived>
59 : m_isInitialized(
false)
65 Derived& derived() {
return *
static_cast<Derived*
>(
this); }
66 const Derived& derived()
const {
return *
static_cast<const Derived*
>(
this); }
72 template<
typename Rhs>
73 inline const Solve<Derived, Rhs>
76 eigen_assert(m_isInitialized &&
"Solver is not initialized.");
77 eigen_assert(derived().rows()==b.rows() &&
"solve(): invalid number of rows of the right hand side matrix b");
85 template<
typename Rhs>
89 eigen_assert(m_isInitialized &&
"Solver is not initialized.");
90 eigen_assert(derived().rows()==b.rows() &&
"solve(): invalid number of rows of the right hand side matrix b");
94 #ifndef EIGEN_PARSED_BY_DOXYGEN
96 template<
typename Rhs,
typename Dest>
99 internal::solve_sparse_through_dense_panels(derived(), b.derived(), dest.derived());
105 mutable bool m_isInitialized;
Pseudo expression representing a solving operation.
Definition Solve.h:63
A base class for sparse solvers.
Definition SparseSolverBase.h:54
const Solve< Derived, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition SparseSolverBase.h:74
const Solve< Derived, Rhs > solve(const SparseMatrixBase< Rhs > &b) const
Definition SparseSolverBase.h:87
SparseSolverBase()
Default constructor.
Definition SparseSolverBase.h:58
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61