Registered Member
|
Hi all,
perhaps somebody can help with my litte porblem. I am trying to asing a csr matrix to Eigen sparseMatrix. I have 3 pointers of 1D array with row_ptr, col_index and values. I want to asign or copy to a SparseMatrix. I tried some things but nothing works. Would be great if somebody can help me. Thanks! |
Moderator
|
you can use the MappedSparseMatrix class for that, here is an example:
SparseMatrix<douvle,RowMajor> mat = MappedSparseMatrix<double,RowMajor>(rows, cols, nnz, row_ptr, col_index, values); Note that you can avoid a copy and directly use the MappedSparseMatrix object into Eigen's expression, e.g.: MappedSparseMatrix<double,RowMajor> mat(rows, cols, nnz, row_ptr, col_index, values); v2 = mat * v1; |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora