10 #ifndef EIGEN_ITERATIVE_SOLVER_BASE_H 11 #define EIGEN_ITERATIVE_SOLVER_BASE_H 17 template<
typename MatrixType>
21 template <
typename T0>
28 struct no {
int a[2];};
40 template<
typename MatrixType>
50 template<
typename MatrixType>
55 template<
int UpLo>
struct ConstSelfAdjointViewReturnType {
64 : m_dummy(0,0), m_matrix(m_dummy)
67 template<
typename InputType>
72 const ActualMatrixType&
matrix()
const 77 template<
typename MatrixDerived>
86 if(&(mat.derived()) != &m_matrix)
99 template<
typename MatrixType>
104 template<
int UpLo>
struct ConstSelfAdjointViewReturnType
142 template<
typename Derived>
147 using Base::m_isInitialized;
157 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
158 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
181 template<
typename MatrixDerived>
183 : m_matrixWrapper(A.derived())
196 template<
typename MatrixDerived>
200 m_preconditioner.analyzePattern(
matrix());
201 m_isInitialized =
true;
202 m_analysisIsOk =
true;
203 m_info = m_preconditioner.info();
216 template<
typename MatrixDerived>
219 eigen_assert(m_analysisIsOk &&
"You must first call analyzePattern()");
221 m_preconditioner.factorize(
matrix());
222 m_factorizationIsOk =
true;
223 m_info = m_preconditioner.info();
237 template<
typename MatrixDerived>
241 m_preconditioner.compute(
matrix());
242 m_isInitialized =
true;
243 m_analysisIsOk =
true;
244 m_factorizationIsOk =
true;
245 m_info = m_preconditioner.info();
267 m_tolerance = tolerance;
283 return (m_maxIterations<0) ? 2*
matrix().cols() : m_maxIterations;
291 m_maxIterations = maxIters;
298 eigen_assert(m_isInitialized &&
"ConjugateGradient is not initialized.");
307 eigen_assert(m_isInitialized &&
"ConjugateGradient is not initialized.");
316 template<
typename Rhs,
typename Guess>
320 eigen_assert(m_isInitialized &&
"Solver is not initialized.");
321 eigen_assert(derived().
rows()==b.rows() &&
"solve(): invalid number of rows of the right hand side matrix b");
328 eigen_assert(m_isInitialized &&
"IterativeSolverBase is not initialized.");
333 template<
typename Rhs,
typename DestDerived>
338 Index rhsCols = b.cols();
340 DestDerived& dest(aDest.
derived());
346 typename DestDerived::PlainObject tmp(
cols(),rhsCols);
347 for(
Index k=0; k<rhsCols; ++k)
350 tx = derived().solve(tb);
351 tmp.col(k) = tx.sparseView(0);
359 m_isInitialized =
false;
360 m_analysisIsOk =
false;
361 m_factorizationIsOk =
false;
362 m_maxIterations = -1;
371 return m_matrixWrapper.matrix();
374 template<
typename InputType>
377 m_matrixWrapper.grab(A);
394 #endif // EIGEN_ITERATIVE_SOLVER_BASE_H
generic_matrix_wrapper(const InputType &mat)
void _solve_impl(const Rhs &b, SparseMatrixBase< DestDerived > &aDest) const
EIGEN_DEVICE_FUNC void swap(DenseBase< OtherDerived > &other)
Pseudo expression representing a solving operation.
Derived & setTolerance(const RealScalar &tolerance)
void grab(const MatrixType &mat)
static yes test(const Ref< const T > &, int)
IterativeSolverBase(const EigenBase< MatrixDerived > &A)
static MatrixType ms_from
A base class for sparse solvers.
any_conversion(const volatile T &)
internal::generic_matrix_wrapper< MatrixType > MatrixWrapper
Namespace containing all symbols from the Eigen library.
internal::traits< Derived >::Preconditioner Preconditioner
const ActualMatrixType & matrix() const
void grab(const EigenBase< MatrixDerived > &mat)
generic_matrix_wrapper(const MatrixType &mat)
Derived & factorize(const EigenBase< MatrixDerived > &A)
Index maxIterations() const
MatrixType::StorageIndex StorageIndex
SparseSolverBase< Derived > Base
MatrixType ActualMatrixType
MatrixType::Scalar Scalar
Base class of any sparse matrices or sparse expressions.
MatrixWrapper::ActualMatrixType ActualMatrixType
Derived & analyzePattern(const EigenBase< MatrixDerived > &A)
Preconditioner m_preconditioner
Derived & compute(const EigenBase< MatrixDerived > &A)
const SolveWithGuess< Derived, Rhs, Guess > solveWithGuess(const MatrixBase< Rhs > &b, const Guess &x0) const
ActualMatrixType m_matrix
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
ComputationInfo info() const
RealScalar tolerance() const
const ActualMatrixType & matrix() const
const ActualMatrixType & matrix() const
NumTraits< Scalar >::Real RealScalar
Ref< const MatrixType > ActualMatrixType
Derived & setMaxIterations(Index maxIters)
A matrix or vector expression mapping an existing expression.
ActualMatrixType::template ConstSelfAdjointViewReturnType< UpLo >::Type Type
const Derived & derived() const
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
MatrixType::RealScalar RealScalar
Preconditioner & preconditioner()
void grab(const Ref< const MatrixType > &mat)
EIGEN_DONT_INLINE void compute(Solver &solver, const MatrixType &A)
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
The matrix class, also used for vectors and row-vectors.
internal::traits< Derived >::MatrixType MatrixType
const ActualMatrixType * mp_matrix
Base class for linear iterative solvers.
MatrixWrapper m_matrixWrapper
EIGEN_DEVICE_FUNC Derived & derived()
Base class for all dense matrices, vectors, and expressions.
const Preconditioner & preconditioner() const
void grab(const InputType &A)