Go to the documentation of this file.
11 #ifndef EIGEN_BICGSTAB_H
12 #define EIGEN_BICGSTAB_H
28 template<
typename MatrixType,
typename Rhs,
typename Dest,
typename Preconditioner>
30 const Preconditioner& precond,
Index& iters,
39 Index maxIters = iters;
42 VectorType r = rhs -
mat *
x;
56 VectorType v = VectorType::Zero(
n), p = VectorType::Zero(
n);
57 VectorType
y(
n), z(
n);
58 VectorType kt(
n), ks(
n);
60 VectorType
s(
n), t(
n);
67 while ( r.squaredNorm() > tol2 && i<maxIters )
72 if (
abs(rho) < eps2*r0_sqnorm)
78 rho = r0_sqnorm = r.squaredNorm();
83 p = r + beta * (p - w * v);
87 v.noalias() =
mat *
y;
89 alpha = rho / r0.dot(v);
93 t.noalias() =
mat * z;
104 tol_error =
sqrt(r.squaredNorm()/rhs_sqnorm);
111 template<
typename _MatrixType,
112 typename _Preconditioner = DiagonalPreconditioner<typename _MatrixType::Scalar> >
117 template<
typename _MatrixType,
typename _Preconditioner>
157 template<
typename _MatrixType,
typename _Preconditioner>
187 template<
typename MatrixDerived>
193 template<
typename Rhs,
typename Dest>
197 for(
Index j=0; j<
b.cols(); ++j)
209 m_isInitialized =
true;
214 template<
typename Rhs,
typename Dest>
217 x.resize(this->rows(),
b.cols());
228 #endif // EIGEN_BICGSTAB_H
MatrixType::Scalar Scalar
const EIGEN_DEVICE_FUNC SqrtReturnType sqrt() const
void _solve_with_guess_impl(const Rhs &b, Dest &x) const
Map< Matrix< Scalar, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > MatrixType
NumTraits< Scalar >::Real RealScalar
_Preconditioner Preconditioner
bool bicgstab(const MatrixType &mat, const Rhs &rhs, Dest &x, const Preconditioner &precond, Index &iters, typename Dest::RealScalar &tol_error)
void _solve_impl(const MatrixBase< Rhs > &b, Dest &x) const
BiCGSTAB(const EigenBase< MatrixDerived > &A)
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
EIGEN_DEVICE_FUNC const EIGEN_STRONG_INLINE AbsReturnType abs() const
Index maxIterations() const
MatrixType::RealScalar RealScalar
Block< Derived, internal::traits< Derived >::RowsAtCompileTime, 1, !IsRowMajor > ColXpr
Base class for linear iterative solvers.
A bi conjugate gradient stabilized solver for sparse square problems.
void _solve_impl(const Rhs &b, SparseMatrixBase< DestDerived > &aDest) const
_Preconditioner Preconditioner
const ActualMatrixType & matrix() const
IterativeSolverBase< BiCGSTAB > Base
Base class for all dense matrices, vectors, and expressions.
MatrixType A(a, *n, *n, *lda)
Preconditioner m_preconditioner
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:05:38