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

filtering values in Eigen

Tags: None
(comma "," separated)
luminoctum
Registered Member
Posts
2
Karma
0

filtering values in Eigen

Fri May 17, 2013 8:05 pm
Dear All,

I'm new to Eigen and I'm not sure whether my question has been mentioned yet. Here's my question:

I have a dense matrix with positive and negative numbers. I want to set all the negative numbers to zero and create a sparse matrix based on it. I want to ask what's the best way or the most efficient way to do this? Shall I make two for loops?

Thanks! I really appreciate your help.

Cheng
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: filtering values in Eigen  Topic is solved

Sat May 18, 2013 10:34 am
sparsemat = (mat.array()>0).select(mat,0).sparseView();


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]