This is just a curried version of scala.
Aggregates the counts in the given items.
Aggregates the counts in the given items.
Returns a new empty counter.
Returns a Counter[K1, V]
Returns a Counter[K2, V]
Returns a Counter[K1, V]
Returns a Counter[K1, V]
Returns a Counter[K2, V]
Returns a Counter[K2, V]
Returns the k-norm of this Vector.
Returns the k-norm of this Vector. implicit def canNorm[K1, K2, V:Ring]:CanNorm[Counter2[K1, K2, V]] = new CanNorm[Counter2[K1, K2, V]] { val field = implicitly[Ring[V]] def apply(c: Counter2[K1, K2, V], n: Double): Double = { import c._
if (n == 1) { var sum = 0.0 activeValuesIterator foreach (v => sum += field.norm(v)) sum } else if (n == 2) { var sum = 0.0 activeValuesIterator foreach (v => { val nn = field.norm(v); sum += nn * nn }) math.sqrt(sum) } else if (n == Double.PositiveInfinity) { var max = Double.NegativeInfinity activeValuesIterator foreach (v => { val nn = field.norm(v); if (nn > max) max = nn }) max } else { var sum = 0.0 activeValuesIterator foreach (v => { val nn = field.norm(v); sum += math.pow(nn,n) }) math.pow(sum, 1.0 / n) } } }
Counts the given elements.