aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/SuperLUSupport
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-02-13 10:03:53 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-02-13 10:03:53 +0100
commitfe513199808654bfa5080fe16bda7dcdafbd57c6 (patch)
tree71c207f44df25ebd76d19531e65cb6e22efd5c89 /Eigen/src/SuperLUSupport
parente8cdbedefb1913b5a0e2f2b7d38470f081cb8d29 (diff)
parent0918c51e600bed36a53448fa276b01387119a3c2 (diff)
Merge Index-refactoring branch with default, fix PastixSupport, remove some useless typedefs
Diffstat (limited to 'Eigen/src/SuperLUSupport')
-rw-r--r--Eigen/src/SuperLUSupport/SuperLUSupport.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/Eigen/src/SuperLUSupport/SuperLUSupport.h b/Eigen/src/SuperLUSupport/SuperLUSupport.h
index f00bc3976..3a9b5fd74 100644
--- a/Eigen/src/SuperLUSupport/SuperLUSupport.h
+++ b/Eigen/src/SuperLUSupport/SuperLUSupport.h
@@ -627,8 +627,12 @@ void SuperLU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest>
m_sluFerr.resize(rhsCols);
m_sluBerr.resize(rhsCols);
- m_sluB = SluMatrix::Map(b.const_cast_derived());
- m_sluX = SluMatrix::Map(x.derived());
+
+ Ref<const Matrix<typename Rhs::Scalar,Dynamic,Dynamic,ColMajor> > b_ref(b);
+ Ref<const Matrix<typename Dest::Scalar,Dynamic,Dynamic,ColMajor> > x_ref(x);
+
+ m_sluB = SluMatrix::Map(b_ref.const_cast_derived());
+ m_sluX = SluMatrix::Map(x_ref.const_cast_derived());
typename Rhs::PlainObject b_cpy;
if(m_sluEqued!='N')
@@ -651,6 +655,10 @@ void SuperLU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest>
&m_sluFerr[0], &m_sluBerr[0],
&m_sluStat, &info, Scalar());
StatFree(&m_sluStat);
+
+ if(&x.coeffRef(0) != x_ref.data())
+ x = x_ref;
+
m_info = info==0 ? Success : NumericalIssue;
}
@@ -938,8 +946,12 @@ void SuperILU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest
m_sluFerr.resize(rhsCols);
m_sluBerr.resize(rhsCols);
- m_sluB = SluMatrix::Map(b.const_cast_derived());
- m_sluX = SluMatrix::Map(x.derived());
+
+ Ref<const Matrix<typename Rhs::Scalar,Dynamic,Dynamic,ColMajor> > b_ref(b);
+ Ref<const Matrix<typename Dest::Scalar,Dynamic,Dynamic,ColMajor> > x_ref(x);
+
+ m_sluB = SluMatrix::Map(b_ref.const_cast_derived());
+ m_sluX = SluMatrix::Map(x_ref.const_cast_derived());
typename Rhs::PlainObject b_cpy;
if(m_sluEqued!='N')
@@ -962,6 +974,9 @@ void SuperILU<MatrixType>::_solve_impl(const MatrixBase<Rhs> &b, MatrixBase<Dest
&recip_pivot_growth, &rcond,
&m_sluStat, &info, Scalar());
StatFree(&m_sluStat);
+
+ if(&x.coeffRef(0) != x_ref.data())
+ x = x_ref;
m_info = info==0 ? Success : NumericalIssue;
}