On Mon, Mar 11, 2013 at 4:21 PM, Ted Dunning <[email protected]> wrote:
> It is part of math now since we had zero pull for it separate from math. > I see the code templates living in math, yes, but how to build it? > What did you need? > Iterators. The way we use OpenIntDoubleHashMap in our primary sparse vector impl is to use forEachPair() to fill a secondary structure with the keys and values, and then iterate over this. In addition to being wasteful in the usual case of iterating over all values (both for CPU and memory), it's super wasteful if your iteration terminates early: you've already done the full O(n) walk, but the "second pass" might terminate after a few values: you want to know whether the vector has any values > 1.0. You might find out that the first one does, but instead of being an O(1) operation, it's O(n). For raw OpenIntDoubleHashMap, you can use forEachXYZ methods, but exposing these in the Vector interface is a bit heavy-handed. What would be better would be to just properly implement the iterateAllNonZero() method to properly delegate to an efficient iterater() method on OpenIntDoubleHashMap. It's not hard to write (it's basically what we have in RandomAccessSparseVector), it just needs to be implemented in the templates. > > On Mon, Mar 11, 2013 at 1:43 PM, Jake Mannix <[email protected]> > wrote: > > > Question which I ought to know the answer to, but don't: if we want to > make > > changes to mahout-collections, what's the build process / maven target to > > do this? > > > > -- > > > > -jake > > > -- -jake
