Registered Member
|
Hi,
How do I delete a row or a column from a sparse matrix? I can construct a new matrix by concatenating two sub matrices, but I think it would be costly: viewtopic.php?f=74&t=106944 |
Moderator
|
Do you really need to have it before suppressing it? Perhaps it's better to not insert it or if you want to remove several ones, maybe a using a permutation matrix would do a better job?
If your matrix is column major you can still remove columns efficiently by first pruning the entries with SparseMatrix::prune(...), then play with the internal structure to copy the outer pointers of the remaining columns from j+1 to j (see the outerIndexPtr() function), and finally call conservative resize to remove the last empty one. |
Registered Member
|
I'll consider these options; thanks.
|
Registered users: Baidu [Spider], Bing [Bot], Google [Bot]