From bc065c75d2a8df928cb368d0352b8fcb25791fa8 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 1 Sep 2014 14:50:59 +0200 Subject: [PATCH] Implement the missing bits to make Solve compatible with sparse rhs --- Eigen/src/Core/Solve.h | 9 +++++++++ Eigen/src/SparseCore/SparseAssign.h | 12 ++++++++++++ Eigen/src/SparseCore/SparseUtil.h | 8 ++++++++ 3 files changed, 29 insertions(+) diff --git a/Eigen/src/Core/Solve.h b/Eigen/src/Core/Solve.h index c28789968..a1501c259 100644 --- a/Eigen/src/Core/Solve.h +++ b/Eigen/src/Core/Solve.h @@ -99,6 +99,15 @@ private: Scalar coeff(Index i) const; }; +#ifdef EIGEN_TEST_EVALUATORS +// Generic API dispatcher +template +class SolveImpl : public internal::generic_xpr_base, MatrixXpr, StorageKind>::type +{ + public: + typedef typename internal::generic_xpr_base, MatrixXpr, StorageKind>::type Base; +}; +#endif namespace internal { diff --git a/Eigen/src/SparseCore/SparseAssign.h b/Eigen/src/SparseCore/SparseAssign.h index 0a29cb32f..36c9fe845 100644 --- a/Eigen/src/SparseCore/SparseAssign.h +++ b/Eigen/src/SparseCore/SparseAssign.h @@ -284,6 +284,18 @@ struct Assignment +struct Assignment, internal::assign_op, Sparse2Sparse, Scalar> +{ + typedef Solve SrcXprType; + static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) + { + src.dec()._solve_impl(src.rhs(), dst); + } +}; + } // end namespace internal #endif // EIGEN_TEST_EVALUATORS diff --git a/Eigen/src/SparseCore/SparseUtil.h b/Eigen/src/SparseCore/SparseUtil.h index 0183907a1..28bf89bca 100644 --- a/Eigen/src/SparseCore/SparseUtil.h +++ b/Eigen/src/SparseCore/SparseUtil.h @@ -156,6 +156,14 @@ template struct plain_matrix_type typedef SparseMatrix<_Scalar, _Options, _Index> type; }; +#ifdef EIGEN_TEST_EVALUATORS +template +struct solve_traits +{ + typedef typename sparse_eval::type PlainObject; +}; +#endif + template struct generic_xpr_base {