Since RcppEigen version 3.3.3.0 the MappedSpareMatrixT
has been deprecated. For some reason when compiling functions with this new type I get errors.
For example (based on this question);
EDIT: with suggestions from coatless - still getting same errors.
#include <RcppEigen.h>
typedef Eigen::Map<Eigen::SparseMatrix<double> > mappedSparseMatrix;
typedef Eigen::Map<Eigen::VectorXd> mappedVector;
// [[Rcpp::depends(RcppEigen)]]
// [[Rcpp::export]]
Eigen::VectorXd cgSparse(const mappedSparseMatrix A, const mappedVector b) {
Eigen::ConjugateGradient< mappedSparseMatrix, Eigen::Lower > cg(A);
return cg.solve(b);
}
I have tried different things, even copied the type from the Rcppeigen unitTests;
typedef Eigen::Map<Eigen::SparseMatrix<double, Eigen::ColMajor> > MapMat;
In both cases I get the following errors;
SessionInfo() here:
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RcppEigen_0.3.3.3.0 RevoUtilsMath_10.0.0
loaded via a namespace (and not attached):
[1] compiler_3.4.0 Matrix_1.2-9 RevoUtils_10.0.4 tools_3.4.0 Rcpp_0.12.10 grid_3.4.0
[7] lattice_0.20-35
With the mentioned changes - how can I map my sparse matrices? For example, in the above function sparseCG
? (NB: I am C++ newbie)