1313// IWYU pragma: private
1414#include " ./InternalHeaderCheck.h"
1515
16- #ifndef R_MATRIX_CHOLMOD
17- # define R_MATRIX_CHOLMOD (_NAME_ ) cholmod_ ## _NAME_
18- #endif
19-
2016namespace Eigen {
2117
2218namespace internal {
@@ -88,8 +84,8 @@ cholmod_sparse viewAsCholmod(Ref<SparseMatrix<Scalar_, Options_, StorageIndex_>
8884
8985 if (internal::is_same<StorageIndex_, int >::value) {
9086 res.itype = CHOLMOD_INT;
91- // } else if (internal::is_same<StorageIndex_, SuiteSparse_long>::value) {
92- // res.itype = CHOLMOD_LONG;
87+ } else if (internal::is_same<StorageIndex_, SuiteSparse_long>::value) {
88+ res.itype = CHOLMOD_LONG;
9389 } else {
9490 eigen_assert (false && " Index type not supported yet" );
9591 }
@@ -176,14 +172,22 @@ namespace internal {
176172#define EIGEN_CHOLMOD_SPECIALIZE0 (ret, name ) \
177173 template <typename StorageIndex_> \
178174 inline ret cm_##name(cholmod_common& Common) { \
179- return R_MATRIX_CHOLMOD (name)(&Common); \
180- }
175+ return cholmod_##name (&Common); \
176+ } \
177+ template <> \
178+ inline ret cm_##name<SuiteSparse_long>(cholmod_common & Common) { \
179+ return cholmod_l_##name (&Common); \
180+ }
181181
182- #define EIGEN_CHOLMOD_SPECIALIZE1 (ret, name, t1, a1 ) \
183- template <typename StorageIndex_> \
184- inline ret cm_##name(t1& a1, cholmod_common& Common) { \
185- return R_MATRIX_CHOLMOD (name) (&a1, &Common); \
186- }
182+ #define EIGEN_CHOLMOD_SPECIALIZE1 (ret, name, t1, a1 ) \
183+ template <typename StorageIndex_> \
184+ inline ret cm_##name(t1& a1, cholmod_common& Common) { \
185+ return cholmod_##name (&a1, &Common); \
186+ } \
187+ template <> \
188+ inline ret cm_##name<SuiteSparse_long>(t1 & a1, cholmod_common & Common) { \
189+ return cholmod_l_##name (&a1, &Common); \
190+ }
187191
188192EIGEN_CHOLMOD_SPECIALIZE0 (int , start)
189193EIGEN_CHOLMOD_SPECIALIZE0 (int , finish)
@@ -197,33 +201,33 @@ EIGEN_CHOLMOD_SPECIALIZE1(cholmod_sparse*, factor_to_sparse, cholmod_factor, L)
197201
198202template <typename StorageIndex_>
199203inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common& Common) {
200- return R_MATRIX_CHOLMOD (solve) (sys, &L, &B, &Common);
204+ return cholmod_solve (sys, &L, &B, &Common);
205+ }
206+ template <>
207+ inline cholmod_dense* cm_solve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common& Common) {
208+ return cholmod_l_solve (sys, &L, &B, &Common);
201209}
202- // template <>
203- // inline cholmod_dense* cm_solve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common& Common) {
204- // return cholmod_l_solve(sys, &L, &B, &Common);
205- // }
206210
207211template <typename StorageIndex_>
208212inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common& Common) {
209- return R_MATRIX_CHOLMOD (spsolve) (sys, &L, &B, &Common);
213+ return cholmod_spsolve (sys, &L, &B, &Common);
214+ }
215+ template <>
216+ inline cholmod_sparse* cm_spsolve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_sparse& B,
217+ cholmod_common& Common) {
218+ return cholmod_l_spsolve (sys, &L, &B, &Common);
210219}
211- // template <>
212- // inline cholmod_sparse* cm_spsolve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_sparse& B,
213- // cholmod_common& Common) {
214- // return cholmod_l_spsolve(sys, &L, &B, &Common);
215- // }
216220
217221template <typename StorageIndex_>
218222inline int cm_factorize_p (cholmod_sparse* A, double beta[2 ], StorageIndex_* fset, std::size_t fsize, cholmod_factor* L,
219223 cholmod_common& Common) {
220- return R_MATRIX_CHOLMOD (factorize_p) (A, beta, fset, fsize, L, &Common);
224+ return cholmod_factorize_p (A, beta, fset, fsize, L, &Common);
225+ }
226+ template <>
227+ inline int cm_factorize_p<SuiteSparse_long>(cholmod_sparse* A, double beta[2 ], SuiteSparse_long* fset,
228+ std::size_t fsize, cholmod_factor* L, cholmod_common& Common) {
229+ return cholmod_l_factorize_p (A, beta, fset, fsize, L, &Common);
221230}
222- // template <>
223- // inline int cm_factorize_p<SuiteSparse_long>(cholmod_sparse* A, double beta[2], SuiteSparse_long* fset,
224- // std::size_t fsize, cholmod_factor* L, cholmod_common& Common) {
225- // return cholmod_l_factorize_p(A, beta, fset, fsize, L, &Common);
226- // }
227231
228232#undef EIGEN_CHOLMOD_SPECIALIZE0
229233#undef EIGEN_CHOLMOD_SPECIALIZE1
0 commit comments