scalanlp/breeze — pull request #10 by fozziethebeat (2012-07-31 08:19:46+00:00)
Title: Adding two possible implementations of a cached vector

This request includes two alternative implementations for adding Caching to vectors, as noted in [Issue 9][1].

Approach one uses a mixin trait that in theory should work as it's implemented, but doesn't due to the complexity of the type hierarchy for vectors. This has the advantage that other operations on the vectors, like activeIterator and mapActivePairs, don't need to be overridden in any way. The vectors can also retain their original base type.

Approach two uses a simpler decorator to wrap an existing vector. This works as expected, but I'm not sure how to get decorator to locate the correct implicit methods needed to make activeIterator work optimally.

[1]: https://github.com/scalanlp/breeze/issues/9