10
10
#ifndef EIGEN_CHOLMODSUPPORT_H
11
11
#define EIGEN_CHOLMODSUPPORT_H
12
12
13
+ #ifndef R_MATRIX_CHOLMOD
14
+ # define R_MATRIX_CHOLMOD (_NAME_ ) cholmod_ ## _NAME_
15
+ #endif
16
+
13
17
namespace Eigen {
14
18
15
19
namespace internal {
@@ -84,10 +88,10 @@ cholmod_sparse viewAsCholmod(Ref<SparseMatrix<_Scalar,_Options,_StorageIndex> >
84
88
{
85
89
res.itype = CHOLMOD_INT;
86
90
}
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
+ // }
91
95
else
92
96
{
93
97
eigen_assert (false && " Index type not supported yet" );
@@ -167,10 +171,10 @@ namespace internal {
167
171
// template specializations for int and long that call the correct cholmod method
168
172
169
173
#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); }
171
175
172
176
#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); }
174
178
175
179
EIGEN_CHOLMOD_SPECIALIZE0 (int , start)
176
180
EIGEN_CHOLMOD_SPECIALIZE0 (int , finish)
@@ -181,16 +185,16 @@ EIGEN_CHOLMOD_SPECIALIZE1(int, free_sparse, cholmod_sparse*, A)
181
185
182
186
EIGEN_CHOLMOD_SPECIALIZE1 (cholmod_factor*, analyze, cholmod_sparse, A)
183
187
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); }
186
190
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); }
189
193
190
194
template <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); }
192
196
// 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); }
194
198
195
199
#undef EIGEN_CHOLMOD_SPECIALIZE0
196
200
#undef EIGEN_CHOLMOD_SPECIALIZE1
0 commit comments