https://issues.apache.org/jira/browse/MAHOUT-303 Ticket. All aboard the test train!.
Robin On Sun, Feb 21, 2010 at 12:33 AM, Jake Mannix <jake.man...@gmail.com> wrote: > Ah, you mean SequentialAccessVector.assign(RandomAccessVector, > BinaryFunction map), etc? > > Yes, we do need to make sure all combinations are properly checked for that > in the unit tests. > > We need a Jira ticket for this too! :) > > -jake > > On Sat, Feb 20, 2010 at 8:05 AM, Robin Anil <robin.a...@gmail.com> wrote: > > > Adding to that current tests dont cover all cases and at all levels of > > sparseness and across multiple implementations > > Seq.fn(Rand) > > Rand.fn(Dense) and so on, so need to add a framework which does that > > > > Robin > > > > On Sat, Feb 20, 2010 at 9:10 PM, Jake Mannix <jake.man...@gmail.com> > > wrote: > > > > > On Sat, Feb 20, 2010 at 7:27 AM, Robin Anil <robin.a...@gmail.com> > > wrote: > > > > > > > > > And we do have v1.plus() vs. v1.plusMutable() - the latter is > > addTo(). > > > > > > > > > What about other things like minus, divide etc etc > > > > > > > > > > > Those methods all return copies, and the mutable versions are simply > > > generalizations of the fact that > > > > > > v.addTo(w) is just shorthand for w.assign(v, Functions.plus); > > > > > > Vector.assign(Vector v, BinaryFunctin map), with map chosen to be > > > Functions.minus, Functions.div, etc, does what you want. > > > > > > The only trick here is we need another flag to the assign method saying > > > whether iteration should be sparse or not, because unlike for > > > UnaryFunction, > > > which you can tell should be sparse or not by checking apply(0) == 0, > > > there's no canonical way to tell whether BinaryFunction.apply(x,0) = 0 > > > for all x. So either we need BinaryFunction itself to have some way of > > > notifying this ( like say a marker interface: > > ZeroPreservingBinaryFunction > > > ) > > > or we need an optional boolean flag in this method, otherwise this > method > > > has to use dense iteration. > > > > > > -jake > > > > > >