Registered Member
|
In my code it would be incredibly useful if I could just alter the arrays of the SparseMatrix class, to do so I use valuePtr, innerIndexPtr and outerIndexPtr. Let's say I remove a row or column from the matrix, or complete change the pattern. How can I let the SparseMatrix class update itself such that all member variables are set correctly and all member functions (rows, cols, etc.) return correct results? I don't mind changing the header files here and there if that's absolutely necessary.
My best alternative is to use the MappedSparseMatrix class, but I'd rather have Eigen handle the associated memory. |
Moderator
|
use .resizeNonZeros() to resize the values and innerIndex arrays, then you can use these *Ptr() functions to adjust the content of these arrays, and at the end you can call .conservativeResize() to set the final rows and cols values without loosing your modifications. Make sure it is in compressed mode before starting such cooking, or also consider updating the content of innerSizePtr() in uncompressed mode.
|
Registered Member
|
I am trying to initialize a Eigen::SparseMatrix A by using malloc like this
but I get the error
for both statements. Can anyone help me with this? |
Moderator
|
answered on SO: http://stackoverflow.com/questions/3564 ... arsematrix
|
Registered Member
|
Yep, I was the one who asked that, thanks. I used MappedSparseMatrix ultimately, and managed to get it to work; I'm quite happy with the results.
|
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], ourcraft