1- diff --git c/inst/include/Eigen/CholmodSupport i /inst/include/Eigen/CholmodSupport
1+ diff --git c/inst/include/Eigen/CholmodSupport w /inst/include/Eigen/CholmodSupport
22index adc5f8d..bff39e6 100644
33--- c/inst/include/Eigen/CholmodSupport
4- +++ i /inst/include/Eigen/CholmodSupport
4+ +++ w /inst/include/Eigen/CholmodSupport
55@@ -12,7 +12,7 @@
6-
6+
77 #include "src/Core/util/DisableStupidWarnings.h"
8-
8+
99- #include <cholmod.h>
1010+ #include <RcppEigenCholmod.h>
11-
11+
1212 /** \ingroup Support_modules
1313 * \defgroup CholmodSupport_Module CholmodSupport module
14- diff --git c/inst/include/Eigen/src/CholmodSupport/CholmodSupport.h i /inst/include/Eigen/src/CholmodSupport/CholmodSupport.h
15- index 7e3c881..cf0059f 100644
14+ diff --git c/inst/include/Eigen/src/CholmodSupport/CholmodSupport.h w /inst/include/Eigen/src/CholmodSupport/CholmodSupport.h
15+ index 7e3c881..758fb5a 100644
1616--- c/inst/include/Eigen/src/CholmodSupport/CholmodSupport.h
17- +++ i/inst/include/Eigen/src/CholmodSupport/CholmodSupport.h
18- @@ -170,24 +170,12 @@ namespace internal {
19- // template specializations for int and long that call the correct cholmod method
20-
17+ +++ w/inst/include/Eigen/src/CholmodSupport/CholmodSupport.h
18+ @@ -13,6 +13,10 @@
19+ // IWYU pragma: private
20+ #include "./InternalHeaderCheck.h"
21+
22+ + #ifndef R_MATRIX_CHOLMOD
23+ + # define R_MATRIX_CHOLMOD(_NAME_) cholmod_ ## _NAME_
24+ + #endif
25+ +
26+ namespace Eigen {
27+
28+ namespace internal {
29+ @@ -84,8 +88,8 @@ cholmod_sparse viewAsCholmod(Ref<SparseMatrix<Scalar_, Options_, StorageIndex_>
30+
31+ if (internal::is_same<StorageIndex_, int>::value) {
32+ res.itype = CHOLMOD_INT;
33+ - } else if (internal::is_same<StorageIndex_, SuiteSparse_long>::value) {
34+ - res.itype = CHOLMOD_LONG;
35+ + // } else if (internal::is_same<StorageIndex_, SuiteSparse_long>::value) {
36+ + // res.itype = CHOLMOD_LONG;
37+ } else {
38+ eigen_assert(false && "Index type not supported yet");
39+ }
40+ @@ -172,22 +176,14 @@ namespace internal {
2141 #define EIGEN_CHOLMOD_SPECIALIZE0(ret, name) \
22- - template <typename StorageIndex_> \
23- - inline ret cm_##name(cholmod_common& Common) { \
42+ template <typename StorageIndex_> \
43+ inline ret cm_##name(cholmod_common& Common) { \
2444- return cholmod_##name(&Common); \
2545- } \
2646- template <> \
2747- inline ret cm_##name<SuiteSparse_long>(cholmod_common & Common) { \
2848- return cholmod_l_##name(&Common); \
2949- }
30- + template<typename _StorageIndex> inline ret cm_ ## name \
31- + (cholmod_common &Common) { return cholmod_ ## name (&Common); }
32-
33- #define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \
50+ + return R_MATRIX_CHOLMOD( name)(&Common); \
51+ + }
52+
53+ - #define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \
3454- template <typename StorageIndex_> \
3555- inline ret cm_##name(t1& a1, cholmod_common& Common) { \
3656- return cholmod_##name(&a1, &Common); \
@@ -39,64 +59,72 @@ index 7e3c881..cf0059f 100644
3959- inline ret cm_##name<SuiteSparse_long>(t1 & a1, cholmod_common & Common) { \
4060- return cholmod_l_##name(&a1, &Common); \
4161- }
42- + template<typename _StorageIndex> inline ret cm_ ## name \
43- + (t1& a1, cholmod_common &Common) { return cholmod_ ## name (&a1, &Common); }
44-
62+ + #define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \
63+ + template <typename StorageIndex_> \
64+ + inline ret cm_##name(t1& a1, cholmod_common& Common) { \
65+ + return R_MATRIX_CHOLMOD(name) (&a1, &Common); \
66+ + }
67+
4568 EIGEN_CHOLMOD_SPECIALIZE0(int, start)
4669 EIGEN_CHOLMOD_SPECIALIZE0(int, finish)
47- @@ -203,31 +191,31 @@ template <typename StorageIndex_>
70+ @@ -201,33 +197,33 @@ EIGEN_CHOLMOD_SPECIALIZE1(cholmod_sparse*, factor_to_sparse, cholmod_factor, L)
71+
72+ template <typename StorageIndex_>
4873 inline cholmod_dense* cm_solve(int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common& Common) {
49- return cholmod_solve(sys, &L, &B, &Common);
50- }
74+ - return cholmod_solve(sys, &L, &B, &Common);
75+ - }
5176- template <>
5277- inline cholmod_dense* cm_solve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common& Common) {
5378- return cholmod_l_solve(sys, &L, &B, &Common);
54- - }
55- + //template <>
56- + //inline cholmod_dense* cm_solve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common& Common) {
57- + // return cholmod_l_solve(sys, &L, &B, &Common);
58- + //}
59-
79+ + return R_MATRIX_CHOLMOD(solve) (sys, &L, &B, &Common);
80+ }
81+ + // template <>
82+ + // inline cholmod_dense* cm_solve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common& Common) {
83+ + // return cholmod_l_solve(sys, &L, &B, &Common);
84+ + // }
85+
6086 template <typename StorageIndex_>
6187 inline cholmod_sparse* cm_spsolve(int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common& Common) {
62- return cholmod_spsolve(sys, &L, &B, &Common);
63- }
88+ - return cholmod_spsolve(sys, &L, &B, &Common);
89+ - }
6490- template <>
6591- inline cholmod_sparse* cm_spsolve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_sparse& B,
6692- cholmod_common& Common) {
6793- return cholmod_l_spsolve(sys, &L, &B, &Common);
68- - }
69- + //template <>
70- + //inline cholmod_sparse* cm_spsolve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_sparse& B,
71- + // cholmod_common& Common) {
72- + // return cholmod_l_spsolve(sys, &L, &B, &Common);
73- + //}
74-
94+ + return R_MATRIX_CHOLMOD(spsolve) (sys, &L, &B, &Common);
95+ }
96+ + // template <>
97+ + // inline cholmod_sparse* cm_spsolve<SuiteSparse_long>(int sys, cholmod_factor& L, cholmod_sparse& B,
98+ + // cholmod_common& Common) {
99+ + // return cholmod_l_spsolve(sys, &L, &B, &Common);
100+ + // }
101+
75102 template <typename StorageIndex_>
76103 inline int cm_factorize_p(cholmod_sparse* A, double beta[2], StorageIndex_* fset, std::size_t fsize, cholmod_factor* L,
77104 cholmod_common& Common) {
78- return cholmod_factorize_p(A, beta, fset, fsize, L, &Common);
79- }
105+ - return cholmod_factorize_p(A, beta, fset, fsize, L, &Common);
106+ - }
80107- template <>
81108- inline int cm_factorize_p<SuiteSparse_long>(cholmod_sparse* A, double beta[2], SuiteSparse_long* fset,
82109- std::size_t fsize, cholmod_factor* L, cholmod_common& Common) {
83110- return cholmod_l_factorize_p(A, beta, fset, fsize, L, &Common);
84- - }
85- + //template <>
86- + //inline int cm_factorize_p<SuiteSparse_long>(cholmod_sparse* A, double beta[2], SuiteSparse_long* fset,
87- + // std::size_t fsize, cholmod_factor* L, cholmod_common& Common) {
88- + // return cholmod_l_factorize_p(A, beta, fset, fsize, L, &Common);
89- + //}
90-
111+ + return R_MATRIX_CHOLMOD(factorize_p) (A, beta, fset, fsize, L, &Common);
112+ }
113+ + // template <>
114+ + // inline int cm_factorize_p<SuiteSparse_long>(cholmod_sparse* A, double beta[2], SuiteSparse_long* fset,
115+ + // std::size_t fsize, cholmod_factor* L, cholmod_common& Common) {
116+ + // return cholmod_l_factorize_p(A, beta, fset, fsize, L, &Common);
117+ + // }
118+
91119 #undef EIGEN_CHOLMOD_SPECIALIZE0
92120 #undef EIGEN_CHOLMOD_SPECIALIZE1
93- diff --git c/inst/include/Eigen/src/Core/util/DisableStupidWarnings.h i /inst/include/Eigen/src/Core/util/DisableStupidWarnings.h
121+ diff --git c/inst/include/Eigen/src/Core/util/DisableStupidWarnings.h w /inst/include/Eigen/src/Core/util/DisableStupidWarnings.h
94122index ab0c542..8c27b14 100644
95123--- c/inst/include/Eigen/src/Core/util/DisableStupidWarnings.h
96- +++ i /inst/include/Eigen/src/Core/util/DisableStupidWarnings.h
124+ +++ w /inst/include/Eigen/src/Core/util/DisableStupidWarnings.h
97125@@ -42,45 +42,45 @@
98126 #pragma warning disable 2196 279 1684 2259
99-
127+
100128 #elif defined __clang__
101129- #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
102130- #pragma clang diagnostic push
@@ -138,9 +166,9 @@ index ab0c542..8c27b14 100644
138166+ // #endif
139167+ // #endif
140168+ // #endif
141-
169+
142170 #elif defined __GNUC__ && !defined(__FUJITSU)
143-
171+
144172- #if (!defined(EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS)) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
145173- #pragma GCC diagnostic push
146174- #endif
@@ -174,19 +202,129 @@ index ab0c542..8c27b14 100644
174202+ // #pragma GCC diagnostic ignored "-Wattributes"
175203+ // #endif
176204 #endif
177-
205+
178206 #if defined __NVCC__ && defined __CUDACC__
179- diff --git c/inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h i/inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h
180- index 15d7fb2..0ccb566 100644
207+ diff --git c/inst/include/RcppEigenForward.h w/inst/include/RcppEigenForward.h
208+ index ef347e4..a41212c 100644
209+ --- c/inst/include/RcppEigenForward.h
210+ +++ w/inst/include/RcppEigenForward.h
211+ @@ -54,10 +54,10 @@ namespace Rcpp {
212+ template<typename T> class Exporter< Eigen::Array<T, Eigen::Dynamic, 1> >;
213+ template<typename T> class Exporter< Eigen::Array<T, 1, Eigen::Dynamic> >;
214+ template<typename T> class Exporter< Eigen::Map<Eigen::SparseMatrix<T> > >;
215+ - template<typename T> class Exporter< Eigen::MappedSparseMatrix<T> >; // Deprecated
216+ + //template<typename T> class Exporter< Eigen::MappedSparseMatrix<T> >; // Deprecated
217+ template<typename T> class Exporter< Eigen::SparseMatrix<T> >;
218+ template<typename T> class Exporter< Eigen::Map<Eigen::SparseMatrix<T, Eigen::RowMajor> > >;
219+ - template<typename T> class Exporter< Eigen::MappedSparseMatrix<T, Eigen::RowMajor> >; // Deprecated
220+ + //template<typename T> class Exporter< Eigen::MappedSparseMatrix<T, Eigen::RowMajor> >; // Deprecated
221+ template<typename T> class Exporter< Eigen::SparseMatrix<T, Eigen::RowMajor> >;
222+
223+ } // namespace traits
224+ diff --git c/inst/include/RcppEigenWrap.h w/inst/include/RcppEigenWrap.h
225+ index 3c0e04e..4750b61 100644
226+ --- c/inst/include/RcppEigenWrap.h
227+ +++ w/inst/include/RcppEigenWrap.h
228+ @@ -310,24 +310,24 @@ namespace Rcpp{
229+ IntegerVector d_dims, d_i, d_p;
230+ Vector<RTYPE> xx ;
231+ };
232+ - // Deprecated
233+ - template<typename T>
234+ - class Exporter<Eigen::MappedSparseMatrix<T> > {
235+ - public:
236+ - const static int RTYPE = ::Rcpp::traits::r_sexptype_traits<T>::rtype ;
237+ - Exporter(SEXP x) : d_x(x), d_dims(d_x.slot("Dim")), d_i(d_x.slot("i")), d_p(d_x.slot("p")), xx( d_x.slot("x") ) {
238+ - if (!d_x.is("dgCMatrix"))
239+ - throw std::invalid_argument("Need S4 class dgCMatrix for a mapped sparse matrix");
240+ - }
241+ - Eigen::MappedSparseMatrix<T> get() {
242+ - return Eigen::MappedSparseMatrix<T>(d_dims[0], d_dims[1], d_p[d_dims[1]],
243+ - d_p.begin(), d_i.begin(), xx.begin() );
244+ - }
245+ - protected:
246+ - S4 d_x;
247+ - IntegerVector d_dims, d_i, d_p;
248+ - Vector<RTYPE> xx ;
249+ - };
250+ + // // Deprecated
251+ + // template<typename T>
252+ + // class Exporter<Eigen::MappedSparseMatrix<T> > {
253+ + // public:
254+ + // const static int RTYPE = ::Rcpp::traits::r_sexptype_traits<T>::rtype ;
255+ + // Exporter(SEXP x) : d_x(x), d_dims(d_x.slot("Dim")), d_i(d_x.slot("i")), d_p(d_x.slot("p")), xx( d_x.slot("x") ) {
256+ + // if (!d_x.is("dgCMatrix"))
257+ + // throw std::invalid_argument("Need S4 class dgCMatrix for a mapped sparse matrix");
258+ + // }
259+ + // Eigen::MappedSparseMatrix<T> get() {
260+ + // return Eigen::MappedSparseMatrix<T>(d_dims[0], d_dims[1], d_p[d_dims[1]],
261+ + // d_p.begin(), d_i.begin(), xx.begin() );
262+ + // }
263+ + // protected:
264+ + // S4 d_x;
265+ + // IntegerVector d_dims, d_i, d_p;
266+ + // Vector<RTYPE> xx ;
267+ + // };
268+
269+ // Starting from Eigen 3.3 MappedSparseMatrix was deprecated.
270+ // The new type is Map<SparseMatrix>.
271+ @@ -348,24 +348,24 @@ namespace Rcpp{
272+ IntegerVector d_dims, d_j, d_p;
273+ Vector<RTYPE> xx ;
274+ };
275+ - // Deprecated
276+ - template<typename T>
277+ - class Exporter<Eigen::MappedSparseMatrix<T, Eigen::RowMajor> > {
278+ - public:
279+ - const static int RTYPE = ::Rcpp::traits::r_sexptype_traits<T>::rtype ;
280+ - Exporter(SEXP x) : d_x(x), d_dims(d_x.slot("Dim")), d_j(d_x.slot("j")), d_p(d_x.slot("p")), xx( d_x.slot("x") ) {
281+ - if (!d_x.is("dgRMatrix"))
282+ - throw std::invalid_argument("Need S4 class dgRMatrix for a mapped sparse matrix");
283+ - }
284+ - Eigen::MappedSparseMatrix<T, Eigen::RowMajor> get() {
285+ - return Eigen::MappedSparseMatrix<T, Eigen::RowMajor>(d_dims[0], d_dims[1], d_p[d_dims[1]],
286+ - d_p.begin(), d_j.begin(), xx.begin() );
287+ - }
288+ - protected:
289+ - S4 d_x;
290+ - IntegerVector d_dims, d_j, d_p;
291+ - Vector<RTYPE> xx ;
292+ - };
293+ + // // Deprecated
294+ + // template<typename T>
295+ + // class Exporter<Eigen::MappedSparseMatrix<T, Eigen::RowMajor> > {
296+ + // public:
297+ + // const static int RTYPE = ::Rcpp::traits::r_sexptype_traits<T>::rtype ;
298+ + // Exporter(SEXP x) : d_x(x), d_dims(d_x.slot("Dim")), d_j(d_x.slot("j")), d_p(d_x.slot("p")), xx( d_x.slot("x") ) {
299+ + // if (!d_x.is("dgRMatrix"))
300+ + // throw std::invalid_argument("Need S4 class dgRMatrix for a mapped sparse matrix");
301+ + // }
302+ + // Eigen::MappedSparseMatrix<T, Eigen::RowMajor> get() {
303+ + // return Eigen::MappedSparseMatrix<T, Eigen::RowMajor>(d_dims[0], d_dims[1], d_p[d_dims[1]],
304+ + // d_p.begin(), d_j.begin(), xx.begin() );
305+ + // }
306+ + // protected:
307+ + // S4 d_x;
308+ + // IntegerVector d_dims, d_j, d_p;
309+ + // Vector<RTYPE> xx ;
310+ + // };
311+
312+ template<typename T>
313+ class Exporter<Eigen::SparseMatrix<T> > {
314+ diff --git c/inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h w/inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h
315+ index 21b62f6..0ccb566 100644
181316--- c/inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h
182- +++ i /inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h
183- @@ -170,7 +170,9 @@ class MatrixMarketIterator {
317+ +++ w /inst/include/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h
318+ @@ -170,10 +170,10 @@ class MatrixMarketIterator {
184319 m_isvalid = false;
185320 std::string curfile;
186321 curfile = m_folder + "/" + m_curs_id->d_name;
187- + #if !(defined(__sun) || defined(_AIX) || defined(__hpux) || defined(__sgi) || defined(__HAIKU__))
188- // Discard if it is a folder
189- + #endif
190- if (m_curs_id->d_type == DT_DIR) continue; // FIXME This may not be available on non BSD systems
322+ - // Discard if it is a folder
323+ #if !(defined(__sun) || defined(_AIX) || defined(__hpux) || defined(__sgi) || defined(__HAIKU__))
324+ - if (m_curs_id->d_type == DT_DIR) continue; // FIXME This may not be available on non BSD systems
325+ + // Discard if it is a folder
326+ #endif
327+ + if (m_curs_id->d_type == DT_DIR) continue; // FIXME This may not be available on non BSD systems
191328 // struct stat st_buf;
192329 // stat (curfile.c_str(), &st_buf);
330+ // if (S_ISDIR(st_buf.st_mode)) continue;
0 commit comments