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

Coefficient wise operation (addition ) on sparse matrices.

Tags: None
(comma "," separated)
M00nMan
Registered Member
Posts
32
Karma
0
I've to perform an element wise addition on sparse matrices.
Is there equal to dense matrices a way like the conversion with arrays?
I think one way is to do this by iterators?
I can ensure that the matrices have the same dimensions thus iterating over on and implicit parsing the second one should be an option, is it?

Is is possible to use cwise() for an addition?
Like sparseMat1.cwise() += sparseMat2; ???
The result should be equivalent to Matlabs .+ operator.

Does anybody have a hint?

Best
Martin
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
The addition of two matrix is always defined to be element-wise, so you can do: sparseMat1 = sparseMat1 + sparseMat2;
M00nMan
Registered Member
Posts
32
Karma
0
Thanks for the expatiation. :<
My matrices are big and contain a big amount of non-zero entries, hence consume a big amount of memory. ;D
After computing the individual matrices the results were stored by using Market format. The marked files contain up to 22 000 000 000 entries (non zero elements).
It showed up that sometimes it's impossible to store two complete matrices at the same time in memory.
Thus I was looking for an option to add either the second matrix "on the fly" to the first (maybe element wise) or to perform a segmented addition.
Is there a routine available for performing this?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Then you need to by larger memory module ;) or out-of-core storage which is not supported by Eigen. If the sparsity patterns match you can also manually iterate and use the valueRef() member of the iterator to add the just read value.


Bookmarks



Who is online

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