non/spire — pull request #310 by non (2014-10-18 05:43:35+00:00)
Title: Use Seq#aggregate in more places.

The aggregate method is optimized for parallel collections,
and possibly also some other structures. If users are using
Seq[A] then they are presumably less worried about boxing
and indirection and more likely to want to get the kinds of
benefits aggregate may provide.

This commit also introduces qmeanWith and qnormWith, which
take a mapping from the element type to a different type
which has a Field defined. This makes it possible to take
the average of an array of integers without allocating a
new collection, or trying to use iterators/views.

For example:

val ints: Array[Int] = ...
val avg: Double = ints.qmeanWith(_.toDouble)