On Thu, Feb 18, 2010 at 6:40 PM, Ted Dunning <ted.dunn...@gmail.com> wrote:
> Can't remember. I suppose I should look at the code. :-) > Do these do it for you? (we could add the boolean "doSparsely" too). Vector.java : /** * Examples speak louder than words: aggregate(plus, pow(2)) is another way to say * getLengthSquared(), aggregate(max, abs) is norm(Double.POSITIVE_INFINITY). To sum all of the postive values, * aggregate(plus, max(0)). * @param aggregator used to combine the current value of the aggregation with the result of map.apply(nextValue) * @param map a function to apply to each element of the vector in turn before passing to the aggregator * @return the final aggregation */ double aggregate(BinaryFunction aggregator, UnaryFunction map); /** * <p>Generalized inner product - take two vectors, iterate over them both, using the combiner to combine together * (and possibly map in some way) each pair of values, which are then aggregated with the previous accumulated * value in the combiner.</p> * <p> * Example: dot(other) could be expressed as aggregate(other, Plus, Times), and kernelized inner products (which * are symmetric on the indices) work similarly. * @param other a vector to aggregate in combination with * @param aggregator * @param combiner * @return the final aggregation */ double aggregate(Vector other, BinaryFunction aggregator, BinaryFunction combiner); > > On Thu, Feb 18, 2010 at 6:19 PM, Jake Mannix <jake.man...@gmail.com> > wrote: > > > Don't we already have generalized scalar aggregation? > > > > > -- > Ted Dunning, CTO > DeepDyve >