1010#ifndef EIGEN_CHOLMODSUPPORT_H
1111#define EIGEN_CHOLMODSUPPORT_H
1212
13+ #ifndef R_MATRIX_CHOLMOD
14+ # define R_MATRIX_CHOLMOD (_NAME_ ) cholmod_ ## _NAME_
15+ #endif
16+
1317namespace Eigen {
1418
1519namespace internal {
@@ -84,10 +88,10 @@ cholmod_sparse viewAsCholmod(Ref<SparseMatrix<_Scalar,_Options,_StorageIndex> >
8488 {
8589 res.itype = CHOLMOD_INT;
8690 }
87- else if (internal::is_same<_StorageIndex,SuiteSparse_long>::value)
88- {
89- res.itype = CHOLMOD_LONG;
90- }
91+ // else if (internal::is_same<_StorageIndex,SuiteSparse_long>::value)
92+ // {
93+ // res.itype = CHOLMOD_LONG;
94+ // }
9195 else
9296 {
9397 eigen_assert (false && " Index type not supported yet" );
@@ -167,10 +171,10 @@ namespace internal {
167171// template specializations for int and long that call the correct cholmod method
168172
169173#define EIGEN_CHOLMOD_SPECIALIZE0 (ret, name ) \
170- template <typename _StorageIndex> inline ret cm_ ## name (cholmod_common &Common) { return cholmod_ ## name (&Common); }
174+ template <typename _StorageIndex> inline ret cm_ ## name (cholmod_common &Common) { return R_MATRIX_CHOLMOD ( name) (&Common); }
171175
172176#define EIGEN_CHOLMOD_SPECIALIZE1 (ret, name, t1, a1 ) \
173- template <typename _StorageIndex> inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_ ## name (&a1, &Common); }
177+ template <typename _StorageIndex> inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return R_MATRIX_CHOLMOD ( name) (&a1, &Common); }
174178
175179EIGEN_CHOLMOD_SPECIALIZE0 (int , start)
176180EIGEN_CHOLMOD_SPECIALIZE0 (int , finish)
@@ -181,16 +185,16 @@ EIGEN_CHOLMOD_SPECIALIZE1(int, free_sparse, cholmod_sparse*, A)
181185
182186EIGEN_CHOLMOD_SPECIALIZE1 (cholmod_factor*, analyze, cholmod_sparse, A)
183187
184- template <typename _StorageIndex> inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_solve (sys, &L, &B, &Common); }
185- // template<> inline cholmod_dense* cm_solve<SuiteSparse_long> (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_l_solve (sys, &L, &B, &Common); }
188+ template <typename _StorageIndex> inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return R_MATRIX_CHOLMOD (solve) (sys, &L, &B, &Common); }
189+ // template<> inline cholmod_dense* cm_solve<SuiteSparse_long> (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return R_MATRIX_CHOLMOD(l_solve) (sys, &L, &B, &Common); }
186190
187- template <typename _StorageIndex> inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_spsolve (sys, &L, &B, &Common); }
188- // template<> inline cholmod_sparse* cm_spsolve<SuiteSparse_long> (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_l_spsolve (sys, &L, &B, &Common); }
191+ template <typename _StorageIndex> inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return R_MATRIX_CHOLMOD (spsolve) (sys, &L, &B, &Common); }
192+ // template<> inline cholmod_sparse* cm_spsolve<SuiteSparse_long> (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return R_MATRIX_CHOLMOD(l_spsolve) (sys, &L, &B, &Common); }
189193
190194template <typename _StorageIndex>
191- inline int cm_factorize_p (cholmod_sparse* A, double beta[2 ], _StorageIndex* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_factorize_p (A, beta, fset, fsize, L, &Common); }
195+ inline int cm_factorize_p (cholmod_sparse* A, double beta[2 ], _StorageIndex* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return R_MATRIX_CHOLMOD (factorize_p) (A, beta, fset, fsize, L, &Common); }
192196// template<>
193- // inline int cm_factorize_p<SuiteSparse_long> (cholmod_sparse* A, double beta[2], SuiteSparse_long* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_l_factorize_p (A, beta, fset, fsize, L, &Common); }
197+ // inline int cm_factorize_p<SuiteSparse_long> (cholmod_sparse* A, double beta[2], SuiteSparse_long* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return R_MATRIX_CHOLMOD(l_factorize_p) (A, beta, fset, fsize, L, &Common); }
194198
195199#undef EIGEN_CHOLMOD_SPECIALIZE0
196200#undef EIGEN_CHOLMOD_SPECIALIZE1
0 commit comments