![]() Registered Member ![]()
|
Currently, I am initializing a sparse matrix as follows:
My question is that would this actually allocate the full memory (i.e. pixels * pixels * 9 elements)? Now I have a scenario where I know before hand how many non-zero elements would be in the sparse matrix. In this case, should I be using `reserve` rather than `resize`? Second, I am currently using `setFromTriplets` to fill the matrix as a batch but this also seems to be very memory intensive. if I want to reduce memory footprint, would using `insert(i,j)` after calling `reserve` or `resize` be a better idea? |
![]() Registered Member ![]()
|
Typically constructing the matrix from triplets is best.
From my reading of https://gitlab.com/libeigen/eigen/-/blo ... seMatrix.h your code does not allocate the whole matrix but just the column or row index (according to storage order) array. |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]