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

How to initialize a sparse vector from a sparse matrix row

Tags: None
(comma "," separated)
efluder
Registered Member
Posts
2
Karma
0
I have not been able to find an example of nor figured out how to efficiently initialize a sparse vector from a sparse matrix row. The sparse matrix is passed in as an argument.
What I have in my code (outline) is:

vector<double> my_function( SparseMatrix<double>& link_type_matrix_new) {
< do things>

SparseVector<double,Dynamic> sparse_v = sparse_mat.row(index);

< do more things>
}
The error is:
error: ‘INVALID_MATRIX_TEMPLATE_PARAMETERS’ is not a member of ‘Eigen::internal::static_assertion<false>
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
The second template parameter of SparseVector is not its size but an option bit-flag to control wether you want a column or row vector.... So pass Dynamic is not allowed.
efluder
Registered Member
Posts
2
Karma
0


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], q.ignora, watchstar