10 #ifndef EIGEN_SPARSESOLVERBASE_H
11 #define EIGEN_SPARSESOLVERBASE_H
21 template<
typename Decomposition,
typename Rhs,
typename Dest>
22 void 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();
52 template<
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());
101 #endif // EIGEN_PARSED_BY_DOXYGEN
105 mutable bool m_isInitialized;
110 #endif // EIGEN_SPARSESOLVERBASE_H
A base class for sparse solvers.
Definition: SparseSolverBase.h:53
const Solve< Derived, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition: SparseSolverBase.h:74
Derived & derived()
Definition: EigenBase.h:44
const unsigned int RowMajorBit
Definition: Constants.h:61
Base class of any sparse matrices or sparse expressions.
Definition: ForwardDeclarations.h:278
const Solve< Derived, Rhs > solve(const SparseMatrixBase< Rhs > &b) const
Definition: SparseSolverBase.h:87
Definition: Eigen_Colamd.h:54
SparseSolverBase()
Definition: SparseSolverBase.h:58
Index rows() const
Definition: SparseMatrixBase.h:163
Pseudo expression representing a solving operation.
Definition: Solve.h:62
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48