How about merely a flag/method on BinaryFunction / UnaryFunction? or DoubleDoubleFunction? (and why do we have DoubleDoubleFunction and BinaryFunction?) This would be simpler and avoid instanceof.
And while we're in the neighborhood, thinking about streamlining, I don't see why it.hasNext() is checked but it.next() is also checked for null. The latter should not happen. On Tue, Mar 2, 2010 at 9:16 AM, Robin Anil <robin.a...@gmail.com> wrote: > if(f.apply(0, y) == 0) { > it = iterateNonZero(); > } else { > it = iterateAll(); > } > > in assign function, this check is reducing the performance by a lot in many > of the algorithms where repeated assign is happening e.g LDA > > What i propose i this. add 4 more types and make it is tested > > SkipZeroBinaryFunction > SkipNoneBinaryFunction > SkipZeroUnaryFunction > SkipNoneUnaryFunction > > > Robin >