10#ifndef EIGEN_ITERATIVE_SOLVER_BASE_H
11#define EIGEN_ITERATIVE_SOLVER_BASE_H
17template<
typename MatrixType>
21 template <
typename T0>
24 template <
typename T> any_conversion(
const volatile T&);
25 template <
typename T> any_conversion(T&);
27 struct yes {
int a[1];};
28 struct no {
int a[2];};
33 static no test(any_conversion<T>, ...);
37 enum {
value =
sizeof(test<MatrixType>(
ms_from, 0))==
sizeof(yes) };
40template<
typename MatrixType>
46template<typename MatrixType, bool MatrixFree = !internal::is_ref_compatible<MatrixType>::value>
50template<
typename MatrixType>
55 template<
int UpLo>
struct ConstSelfAdjointViewReturnType {
64 : m_dummy(0,0), m_matrix(m_dummy)
67 template<
typename InputType>
77 template<
typename MatrixDerived>
80 m_matrix.~Ref<
const MatrixType>();
86 if(&(mat.derived()) != &m_matrix)
88 m_matrix.~Ref<
const MatrixType>();
99template<
typename MatrixType>
104 template<
int UpLo>
struct ConstSelfAdjointViewReturnType
126 void grab(
const MatrixType &mat)
142template<
typename Derived>
152 typedef typename MatrixType::Scalar
Scalar;
181 template<
typename MatrixDerived>
196 template<
typename MatrixDerived>
216 template<
typename MatrixDerived>
237 template<
typename MatrixDerived>
316 template<
typename Rhs,
typename Guess>
333 template<
typename Rhs,
typename DestDerived>
340 DestDerived& dest(aDest.
derived());
341 typedef typename DestDerived::Scalar DestScalar;
346 typename DestDerived::PlainObject tmp(
cols(),rhsCols);
348 for(
Index k=0; k<rhsCols; ++k)
352 derived()._solve_vector_with_guess_impl(tb,tx);
353 tmp.col(k) = tx.sparseView(0);
366 template<
typename Rhs,
typename DestDerived>
373 DestDerived& dest(aDest.derived());
375 for(
Index k=0; k<rhsCols; ++k)
379 derived()._solve_vector_with_guess_impl(bk,xk);
391 template<
typename Rhs,
typename DestDerived>
395 derived()._solve_vector_with_guess_impl(
b,dest.derived());
399 template<
typename Rhs,
typename Dest>
403 derived()._solve_with_guess_impl(
b,x);
424 template<
typename InputType>
const Block< const Derived, internal::traits< Derived >::RowsAtCompileTime, 1, !IsRowMajor > ConstColXpr
Definition: BlockMethods.h:15
Block< Derived, internal::traits< Derived >::RowsAtCompileTime, 1, !IsRowMajor > ColXpr
Definition: BlockMethods.h:14
#define EIGEN_NOEXCEPT
Definition: Macros.h:1428
#define EIGEN_CONSTEXPR
Definition: Macros.h:797
#define eigen_assert(x)
Definition: Macros.h:1047
Base class for linear iterative solvers.
Definition: IterativeSolverBase.h:144
internal::generic_matrix_wrapper< MatrixType > MatrixWrapper
Definition: IterativeSolverBase.h:416
bool m_analysisIsOk
Definition: IterativeSolverBase.h:439
IterativeSolverBase()
Default constructor.
Definition: IterativeSolverBase.h:166
@ MaxColsAtCompileTime
Definition: IterativeSolverBase.h:158
@ ColsAtCompileTime
Definition: IterativeSolverBase.h:157
ComputationInfo info() const
Definition: IterativeSolverBase.h:326
bool m_factorizationIsOk
Definition: IterativeSolverBase.h:439
RealScalar error() const
Definition: IterativeSolverBase.h:305
Index maxIterations() const
Definition: IterativeSolverBase.h:281
Derived & setMaxIterations(Index maxIters)
Sets the max number of iterations.
Definition: IterativeSolverBase.h:289
internal::traits< Derived >::MatrixType MatrixType
Definition: IterativeSolverBase.h:150
ComputationInfo m_info
Definition: IterativeSolverBase.h:438
Derived & compute(const EigenBase< MatrixDerived > &A)
Initializes the iterative solver with the matrix A for further solving Ax=b problems.
Definition: IterativeSolverBase.h:238
IterativeSolverBase(const EigenBase< MatrixDerived > &A)
Initialize the solver with matrix A for further Ax=b solving.
Definition: IterativeSolverBase.h:182
internal::enable_if< Rhs::ColsAtCompileTime==1||DestDerived::ColsAtCompileTime==1 >::type _solve_with_guess_impl(const Rhs &b, MatrixBase< DestDerived > &dest) const
Definition: IterativeSolverBase.h:393
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: IterativeSolverBase.h:250
MatrixWrapper::ActualMatrixType ActualMatrixType
Definition: IterativeSolverBase.h:417
MatrixType::RealScalar RealScalar
Definition: IterativeSolverBase.h:154
void grab(const InputType &A)
Definition: IterativeSolverBase.h:425
MatrixType::Scalar Scalar
Definition: IterativeSolverBase.h:152
const Preconditioner & preconditioner() const
Definition: IterativeSolverBase.h:275
MatrixWrapper m_matrixWrapper
Definition: IterativeSolverBase.h:430
internal::traits< Derived >::Preconditioner Preconditioner
Definition: IterativeSolverBase.h:151
Derived & analyzePattern(const EigenBase< MatrixDerived > &A)
Initializes the iterative solver for the sparsity pattern of the matrix A for further solving Ax=b pr...
Definition: IterativeSolverBase.h:197
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: IterativeSolverBase.h:253
void init()
Definition: IterativeSolverBase.h:407
Derived & factorize(const EigenBase< MatrixDerived > &A)
Initializes the iterative solver with the numerical values of the matrix A for further solving Ax=b p...
Definition: IterativeSolverBase.h:217
RealScalar m_error
Definition: IterativeSolverBase.h:436
void _solve_impl(const Rhs &b, Dest &x) const
Definition: IterativeSolverBase.h:400
Preconditioner m_preconditioner
Definition: IterativeSolverBase.h:431
MatrixType::StorageIndex StorageIndex
Definition: IterativeSolverBase.h:153
void _solve_with_guess_impl(const Rhs &b, SparseMatrixBase< DestDerived > &aDest) const
Definition: IterativeSolverBase.h:334
~IterativeSolverBase()
Definition: IterativeSolverBase.h:189
SparseSolverBase< Derived > Base
Definition: IterativeSolverBase.h:146
Index m_iterations
Definition: IterativeSolverBase.h:437
Preconditioner & preconditioner()
Definition: IterativeSolverBase.h:272
Index m_maxIterations
Definition: IterativeSolverBase.h:433
internal::enable_if< Rhs::ColsAtCompileTime!=1 &&DestDerived::ColsAtCompileTime!=1 >::type _solve_with_guess_impl(const Rhs &b, MatrixBase< DestDerived > &aDest) const
Definition: IterativeSolverBase.h:368
Derived & setTolerance(const RealScalar &tolerance)
Sets the tolerance threshold used by the stopping criteria.
Definition: IterativeSolverBase.h:265
bool m_isInitialized
Definition: SparseSolverBase.h:119
Derived & derived()
Definition: SparseSolverBase.h:79
RealScalar tolerance() const
Definition: IterativeSolverBase.h:258
RealScalar m_tolerance
Definition: IterativeSolverBase.h:434
const SolveWithGuess< Derived, Rhs, Guess > solveWithGuess(const MatrixBase< Rhs > &b, const Guess &x0) const
Definition: IterativeSolverBase.h:318
Index iterations() const
Definition: IterativeSolverBase.h:296
const ActualMatrixType & matrix() const
Definition: IterativeSolverBase.h:419
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:180
A matrix or vector expression mapping an existing expression.
Definition: Ref.h:283
Pseudo expression representing a solving operation.
Definition: SolveWithGuess.h:42
Base class of any sparse matrices or sparse expressions.
Definition: SparseMatrixBase.h:28
const Derived & derived() const
Definition: SparseMatrixBase.h:143
A base class for sparse solvers.
Definition: SparseSolverBase.h:68
bool m_isInitialized
Definition: SparseSolverBase.h:119
Derived & derived()
Definition: SparseSolverBase.h:79
const ActualMatrixType & matrix() const
Definition: IterativeSolverBase.h:72
generic_matrix_wrapper()
Definition: IterativeSolverBase.h:63
generic_matrix_wrapper(const InputType &mat)
Definition: IterativeSolverBase.h:68
Ref< const MatrixType > ActualMatrixType
Definition: IterativeSolverBase.h:54
void grab(const EigenBase< MatrixDerived > &mat)
Definition: IterativeSolverBase.h:78
MatrixType m_dummy
Definition: IterativeSolverBase.h:94
void grab(const Ref< const MatrixType > &mat)
Definition: IterativeSolverBase.h:84
ActualMatrixType m_matrix
Definition: IterativeSolverBase.h:95
const ActualMatrixType & matrix() const
Definition: IterativeSolverBase.h:121
void grab(const MatrixType &mat)
Definition: IterativeSolverBase.h:126
generic_matrix_wrapper(const MatrixType &mat)
Definition: IterativeSolverBase.h:117
MatrixType ActualMatrixType
Definition: IterativeSolverBase.h:103
const ActualMatrixType * mp_matrix
Definition: IterativeSolverBase.h:132
generic_matrix_wrapper()
Definition: IterativeSolverBase.h:113
Definition: IterativeSolverBase.h:47
ComputationInfo
Enum for reporting the status of a computation.
Definition: Constants.h:440
@ NumericalIssue
The provided data did not satisfy the prerequisites.
Definition: Constants.h:444
@ Success
Computation was successful.
Definition: Constants.h:442
@ NoConvergence
Iterative procedure did not converge.
Definition: Constants.h:446
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
Namespace containing all symbols from the Eigen library.
Definition: MatrixExponential.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Definition: Eigen_Colamd.h:50
Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor Matrix...
Definition: EigenBase.h:30
EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:46
Holds information about the various numeric (i.e.
Definition: NumTraits.h:233
ActualMatrixType::template ConstSelfAdjointViewReturnType< UpLo >::Type Type
Definition: IterativeSolverBase.h:56
ActualMatrixType Type
Definition: IterativeSolverBase.h:106
Definition: IterativeSolverBase.h:19
static MatrixType ms_from
Definition: IterativeSolverBase.h:36
Definition: IterativeSolverBase.h:42
Definition: ForwardDeclarations.h:17