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

Setting a SparseMatrix column to zero

Tags: None
(comma "," separated)
rmoraes
Registered Member
Posts
28
Karma
0
I've been trying to efficientely set a column-major sparse matrix column to zero. Browsing for solutions in the internet I found a solution from ggael in another forum (http://stackoverflow.com/questions/20986305/set-row-column-block-to-0-in-eigen-sparse-matrix). Even though the solution works fine when setting a row to zero, using ggael words,
If you want to remove a column of a column major matrix, then that's overkill...
. In the same topic there was an unanswered question:
@ggael So what is the canonical way of removing column in column major matrix? Or rather setting it zero.
. That is exactly what I am looking for...

So, what is the most efficient way of setting a column-major sparse matrix column to zero?

Any help is very much appreciated!
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
That depends if your matrix is in "compressed" mode or not, and if yes, whether you want to keep it in compressed mode, or turn in in non-compressed mode. In compress mode, the remaining column entries will have to be moved (costly!), whether in non-compressed mode, this can be done in constant time (the columns's entries will be kept as reserved memory for the given column.
rmoraes
Registered Member
Posts
28
Karma
0
I would have to understand better the pros & cons of have my matrix compressed/uncompressed to decide what I want to do. Could you please let me know when I should choose one or another, or perhaps point me to the documentation that can clarify that to me? Thanks!

Also, it would be interesting to know which type of solutions I should have in one situation and another, regardless of what I am going to do, just for the sake of education. At the end of the day, I might face both situations in the future...


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft