Registered Member
|
I think this is a silly question, but is there a way to read-access sparse matricies where I can do
mySparse.someFunc(row,col) and if there is a coeff, it will return the value, and if its empty, it will return a 0? I ask because nothing here (http://eigen.tuxfamily.org/dox-devel/cl ... mbers.html) appears to solve this problem To provide a little background, I have some lookup tables that are 20-40% sparse and I wanted to index into them for the interpolation functions in a reasonably logical way and in this case we would benefit by saving the memory at the expense of extra cycles on the lookup. thanks |
Registered Member
|
In order to keep things in one thread, my current (sub-optimal) solution crashes the vs2010 compiler itself.
My current solution is to allocate a dense vector, setZero, then insert the non-zero coeffs from the sparse into the dense. I'm trying to compile my code using VS2010 x64 target with optimization off and the compiler itself crashes with this error. 1>c:\users\USERNAME\desktop\local_code\branches\onlinecarving\thirdparty\eigen\eigen\src/Sparse/SparseTranspose.h(48): fatal error C1001: An internal error has occurred in the compiler. 1> (compiler file 'msc1.cpp', line 1420) 1> To work around this problem, try simplifying or changing the program near the locations listed above. 1> Please choose the Technical Support command on the Visual C++ 1> Help menu, or open the Technical Support help file for more information 1> c:\users\USERNAME\desktop\local_code\branches\onlinecarving\thirdparty\eigen\eigen\src/Sparse/SparseTranspose.h(53) : see reference to class template instantiation 'Eigen::TransposeImpl<MatrixType,Eigen::Sparse>::InnerIterator' being compiled ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== Something like....
.......... Thoughts? |
Moderator
|
for the first question there is a .coeff(i,j) method that does exactly that.
|
Registered Member
|
Well I feel stupid. Shouldn't that show up on that documentation page, or is my link above to a page which doesn't list all the members? |
Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]