In the Mahout matrix classes, it turned out very important to keep some notion of sparsity in the abstract matrix and vector classes. This allows default implementations to make use of sparsity at a pretty non-specific level which actually substantially decreases the amount of type reflection that is needed.
If, for instance, somebody adds a banded matrix, they will need to implement an isSparse method and a forAllNonZero iteration construct and all other matrices will make use of that sparsity by default. On Sun, Aug 14, 2011 at 3:52 PM, Gilles Sadowski < gil...@harfang.homelinux.org> wrote: > Following the suggestion there, I wonder whether we should perform some > cleanup of the "RealVector" hierarchy, such as moving methods that are > sparseness-related over to the "SparseRealVector" interface, and removing > anything sparseness-related from "AbstractRealVector" and > "ArrayRealVector". > > However I don't have any idea of the implications of this refactoring. The > documentation is not very explicit about why the sparseness was introduced > in "RealVector" and the Javadoc for "sparseIterator()" adds to the > confusion: >