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

Resize conservative a sparse matrix

Tags: None
(comma "," separated)
zoharl
Registered Member
Posts
55
Karma
0
OS

Resize conservative a sparse matrix

Mon Jul 16, 2012 9:41 am
Hi,

Is there a way to resize a sparse matrix while preserving its values?

I think that similar to .setFromTriplets(), there should be a method .saveToTriplets() that would assist in copying from one matrix to another.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Indeed, there should be a conservativeResize. Fell free to add a bug report (http://eigen.tuxfamily.org/bz) so that we don't forget, or even better you could try to come up with a patch ;)
jitseniesen
Registered Member
Posts
204
Karma
2
Actually, there is already a patch there: http://eigen.tuxfamily.org/bz/show_bug.cgi?id=449 .

Gaël, to me it looks pretty good, but I did not look at it in detail because I don't know much about sparse matrices in Eigen.

Zoharl, perhaps you can try the patch, see whether it does what you wants, and let us know.
zoharl
Registered Member
Posts
55
Karma
0
OS
I'm not familiar with the library architecture to confirm if the patch cover all the cases.
I do think though that creating a new matrix through triplets for example should be safe enough.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
patch applied.


Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], Google [Bot]