mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
bug #946: generalize Cholmod::solve to handle any rhs expression
This commit is contained in:
parent
15084cf1ac
commit
699634890a
@ -273,9 +273,10 @@ class CholmodBase : public SparseSolverBase<Derived>
|
|||||||
const Index size = m_cholmodFactor->n;
|
const Index size = m_cholmodFactor->n;
|
||||||
EIGEN_UNUSED_VARIABLE(size);
|
EIGEN_UNUSED_VARIABLE(size);
|
||||||
eigen_assert(size==b.rows());
|
eigen_assert(size==b.rows());
|
||||||
|
|
||||||
|
// 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());
|
||||||
|
|
||||||
// note: cd stands for Cholmod Dense
|
|
||||||
Rhs& b_ref(b.const_cast_derived());
|
|
||||||
cholmod_dense b_cd = viewAsCholmod(b_ref);
|
cholmod_dense b_cd = viewAsCholmod(b_ref);
|
||||||
cholmod_dense* x_cd = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &b_cd, &m_cholmod);
|
cholmod_dense* x_cd = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &b_cd, &m_cholmod);
|
||||||
if(!x_cd)
|
if(!x_cd)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user