Skip to content

Commit fcd383b

Browse files
authored
Merge pull request #1 from jaganmn/Eigen3.4.0
port #131, adapted to Eigen 3.4.0
2 parents 6d87938 + fd53b8e commit fcd383b

File tree

10 files changed

+77
-1723
lines changed

10 files changed

+77
-1723
lines changed

Diff for: DESCRIPTION

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Description: R and 'Eigen' integration using 'Rcpp'.
2323
License: GPL (>= 2) | file LICENSE
2424
LazyLoad: yes
2525
LinkingTo: Rcpp
26-
Imports: Matrix (>= 1.1-0), Rcpp (>= 0.11.0), stats, utils
27-
Suggests: inline, tinytest, pkgKitten, microbenchmark
26+
Imports: Rcpp (>= 0.11.0), stats, utils
27+
Suggests: Matrix, inline, tinytest, pkgKitten, microbenchmark
2828
URL: https://github.com/RcppCore/RcppEigen, https://dirk.eddelbuettel.com/code/rcpp.eigen.html
2929
BugReports: https://github.com/RcppCore/RcppEigen/issues

Diff for: NAMESPACE

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
useDynLib("RcppEigen", .registration=TRUE)
22

3-
importClassesFrom("Matrix", "dgCMatrix", "dgeMatrix", "dsCMatrix", "dtCMatrix")
43
importFrom("Rcpp", "evalCpp")
54
importFrom("utils", "packageDescription", "package.skeleton")
65
importFrom("stats", "model.frame", "model.matrix", "model.response", "fitted", "coef", "printCoefmat", "pt")

Diff for: inst/include/Eigen/CholmodSupport

-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212

1313
#include "src/Core/util/DisableStupidWarnings.h"
1414

15-
extern "C" {
16-
#include <RcppEigenCholmod.h>
17-
}
18-
1915
/** \ingroup Support_modules
2016
* \defgroup CholmodSupport_Module CholmodSupport module
2117
*

Diff for: inst/include/Eigen/src/CholmodSupport/CholmodSupport.h

+16-12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
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+
1317
namespace Eigen {
1418

1519
namespace 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

175179
EIGEN_CHOLMOD_SPECIALIZE0(int, start)
176180
EIGEN_CHOLMOD_SPECIALIZE0(int, finish)
@@ -181,16 +185,16 @@ EIGEN_CHOLMOD_SPECIALIZE1(int, free_sparse, cholmod_sparse*, A)
181185

182186
EIGEN_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

190194
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); }
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

Comments
 (0)