On Sat, Dec 12, 2009 at 5:34 PM, Ted Dunning <[email protected]> wrote:

> This is a key problem.
>
> Looks like we really need to think about versions of assign that only scan
> non-zero elements.  Something like assignFromNonZero.
>

This is easier than the rest of the stuff we are talking about here.
Whenever
you have a UnaryFunction f such that f.apply(0) == 0, or you have a
BinaryFunction b such that b.appy(x, 0) == x or b.apply(0, x) == x, then
assign
should take advantage of this and iterateNonZero() on the vector which can
be skipped over.  In Colt, they actually special-case out functions like
Plus
or Minus to take care of this.

In our case, a particular, PlusWithScale is a very very common function
for Vectors to do, and could be special cased itself, in AbstractVector.

  -jake

Reply via email to