bug #946: generalize Cholmod::solve to handle any rhs expression

This commit is contained in:
Gael Guennebaud 2016-01-29 23:02:22 +01:00
parent 15084cf1ac
commit 699634890a

View File

@ -274,8 +274,9 @@ class CholmodBase : public SparseSolverBase<Derived>
EIGEN_UNUSED_VARIABLE(size);
eigen_assert(size==b.rows());
// note: cd stands for Cholmod Dense
Rhs& b_ref(b.const_cast_derived());
// Cholmod needs column-major stoarge without inner-stride, which corresponds to the default behavior of Ref.
Ref<const Matrix<typename Rhs::Scalar,Dynamic,Dynamic,ColMajor> > b_ref(b.derived());
cholmod_dense b_cd = viewAsCholmod(b_ref);
cholmod_dense* x_cd = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &b_cd, &m_cholmod);
if(!x_cd)