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

Matrix with a mask

Tags: None
(comma "," separated)
lyh03259
Registered Member
Posts
5
Karma
0

Matrix with a mask

Thu Dec 29, 2011 10:20 pm
Dear Eigen users and developers,

I have a big VectorXd a. And a "mask" matrix (sparse matrix), with 0 and 1. They are the same sizes. Then I want a new matrix like this:

VectorXd b;
b = nonzero_coeff(a.array()*mask.array())

That is to say when the element in mask is not zero then pick the correspond coefficient in vector a and put it into vector b. (It seems there is no array element in sparsematrix, right?)

Of course it can be by a loop but I just wondering if eigen provide a easy way to do it?

Thanks.
abachrac
Registered Member
Posts
8
Karma
0
OS

Re: Matrix with a mask

Fri Dec 30, 2011 12:02 am
Gael indicated that this feature will be implemented.

viewtopic.php?f=74&t=97652

I'm hoping it happens soon as well
lyh03259
Registered Member
Posts
5
Karma
0

Re: Matrix with a mask

Fri Dec 30, 2011 5:04 pm
Thanks for letting me know.
It is a good news.

And, I have to say: thanks ggael.


Bookmarks



Who is online

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