aboutsummaryrefslogtreecommitdiffhomepage
path: root/unsupported
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2011-10-11 19:53:18 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2011-10-11 19:53:18 +0200
commit15cb4f5b0982b51699bbcc22a048ad310bc55977 (patch)
treed4ea3973e646db51eb43124c9081025196c9f1d6 /unsupported
parent21d27c6f71b764443c56f45bf689203f61ec54b1 (diff)
extend BiCGSTAB to arbitrary rhs
Diffstat (limited to 'unsupported')
-rw-r--r--unsupported/Eigen/src/IterativeSolvers/BiCGSTAB.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/unsupported/Eigen/src/IterativeSolvers/BiCGSTAB.h b/unsupported/Eigen/src/IterativeSolvers/BiCGSTAB.h
index d04158bb6..ee2ab128d 100644
--- a/unsupported/Eigen/src/IterativeSolvers/BiCGSTAB.h
+++ b/unsupported/Eigen/src/IterativeSolvers/BiCGSTAB.h
@@ -45,7 +45,7 @@ void bicgstab(const MatrixType& mat, const Rhs& rhs, Dest& x,
using std::abs;
typedef typename Dest::RealScalar RealScalar;
typedef typename Dest::Scalar Scalar;
- typedef Dest VectorType;
+ typedef Matrix<Scalar,Dynamic,1> VectorType;
RealScalar tol = tol_error;
int maxIters = iters;
@@ -217,11 +217,15 @@ public:
/** \internal */
template<typename Rhs,typename Dest>
void _solve(const Rhs& b, Dest& x) const
- {
- m_iterations = Base::m_maxIterations;
- m_error = Base::m_tolerance;
-
- internal::bicgstab(*mp_matrix, b, x, Base::m_preconditioner, m_iterations, m_error);
+ {
+ for(int j=0; j<b.cols(); ++j)
+ {
+ m_iterations = Base::m_maxIterations;
+ m_error = Base::m_tolerance;
+
+ typename Dest::ColXpr xj(x,j);
+ internal::bicgstab(*mp_matrix, b.col(j), xj, Base::m_preconditioner, m_iterations, m_error);
+ }
m_isInitialized = true;
m_info = m_error <= Base::m_tolerance ? Success : NoConvergence;