I see 2 implementations of sparse matrix in this package.
- OpenMapRealMatrix
- SparseFieldMatrix
Both are documented as "Sparse matrix implementation based on an open addressed map".
Do you know what are the diffrences between the two? als开发者_开发技巧o, what's the best way to iterate over all entries in a fast way (which means, iterating over the non zero elements).
Thanks!
SparseFieldMatrix is simply an interface that is implemented by the class OpenMapRealMatrix.
To walk the entries most efficiently see walkInOptimizedOrder overloads, depending on what you need to do on the iteration. You need to give these methods a Visitor instance which then handles the iteration. See this example when you require read-only access to each element.
It's not clear to me from this documentation how the iteration works for the sparse matrix you wish to use. It says that you would visit all entries but whether that means only the non-zero ones or not, I cannot be sure.
精彩评论