This forum has been archived. All content is frozen. Please use KDE Discuss instead.

MappedSparseMatrix time Vector in Eigen 3.1.0-alpha2

Tags: None
(comma "," separated)
dmbates
Registered Member
Posts
24
Karma
0
OS
In my application I use Mapped matrices and Mapped sparse matrices extensively. With Eigen 3.0 I was able to multiply a MappedSparseMatrix<double> by a VectorXd or MatrixXd but when I started using Eigen 3.1 alpha I get errors. An attempt to compile the following code (the "as" template and the "wrap" function are part of the R/Eigen interface)
Code: Select all
typedef Eigen::MappedSparseMatrix<double>  MSpMatrixd;
typedef Eigen::VectorXd                           Vec;
typedef Eigen::Map<Vec>                          MVec;

MSpMatrixd  A(as<MSpMatrixd>(A_));
MVec        x(as<MVec>(x_));
if (A.cols() != x.size()) throw std::invalid_argument("dimension mismatch");
Vec         p = A * x;
return   wrap(p);

results in errors like
/home/bates/R/x86_64-pc-linux-gnu-library/2.16/RcppEigen/include/Eigen/src/SparseCore/SparseDenseProduct.h:154:47: error: 'IsRowMajor' is a protected member of 'Eigen::MappedSparseMatrix<double, 0, int>'
int LhsStorageOrder = SparseLhsType::IsRowMajor?RowMajor:ColMajor,
^
/home/bates/R/x86_64-pc-linux-gnu-library/2.16/RcppEigen/include/Eigen/src/SparseCore/SparseDenseProduct.h:245:3: note: in instantiation of default argument for 'sparse_time_dense_product_impl<Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >, Eigen::Matrix<double, -1, 1, 0, -1, 1> >' required here
sparse_time_dense_product_impl<SparseLhsType,DenseRhsType,DenseResType>::run(lhs, rhs, res, alpha);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/bates/R/x86_64-pc-linux-gnu-library/2.16/RcppEigen/include/Eigen/src/SparseCore/SparseDenseProduct.h:262:7: note: in instantiation of function template specialization 'Eigen::internal::sparse_time_dense_product<Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> >, Eigen::Matrix<double, -1, 1, 0, -1, 1>, double>' requested here
internal::sparse_time_dense_product(m_lhs, m_rhs, dest, alpha);
^
/home/bates/R/x86_64-pc-linux-gnu-library/2.16/RcppEigen/include/Eigen/src/Core/ProductBase.h:124:73: note: in instantiation of function template specialization 'Eigen::SparseTimeDenseProduct<Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::scaleAndAddTo<Eigen::Matrix<double, -1, 1, 0, -1, 1> >' requested here
inline void scaleAndAddTo(Dest& dst,Scalar alpha) const { derived().scaleAndAddTo(dst,alpha); }
^
/home/bates/R/x86_64-pc-linux-gnu-library/2.16/RcppEigen/include/Eigen/src/Core/ProductBase.h:115:58: note: in instantiation of function template specialization 'Eigen::ProductBase<Eigen::SparseTimeDenseProduct<Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::scaleAndAddTo<Eigen::Matrix<double, -1, 1, 0, -1, 1> >' requested here
inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst,Scalar(1)); }
^
/home/bates/R/x86_64-pc-linux-gnu-library/2.16/RcppEigen/include/Eigen/src/Core/ProductBase.h:133:17: note: in instantiation of function template specialization 'Eigen::ProductBase<Eigen::SparseTimeDenseProduct<Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::evalTo<Eigen::Matrix<double, -1, 1, 0, -1, 1> >' requested here
derived().evalTo(m_result);
^
file26112d951cf0.cpp:39:17: note: in instantiation of member function 'Eigen::ProductBase<Eigen::SparseTimeDenseProduct<Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >, Eigen::MappedSparseMatrix<double, 0, int>, Eigen::Map<Eigen::Matrix<double, -1, 1, 0, -1, 1>, 0, Eigen::Stride<0, 0> > >::operator const class Eigen::Matrix<double, -1, 1, 0, -1, 1> &' requested here
Vec p = A * x;
^
/home/bates/R/x86_64-pc-linux-gnu-library/2.16/RcppEigen/include/Eigen/src/SparseCore/MappedSparseMatrix.h:51:12: note: declared protected here
enum { IsRowMajor = Base::IsRowMajor };
^
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
right, this is fixed now (in the devel branch)


Bookmarks



Who is online

Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell, Yahoo [Bot]