- Companion:
- class
Type members
Classlikes
This is just a curried version of scala.collection.Map. Used to get around Scala's lack of partially applied types.
This is just a curried version of scala.collection.Map. Used to get around Scala's lack of partially applied types.
Inherited classlikes
- Inherited from:
- Counter2Ops
Value members
Implicits
Implicits
Returns a Counter[K1, V]
Returns a Counter[K1, V]
Returns a Counter[K2, V]
Returns a Counter[K2, V]
Inherited implicits
- Inherited from:
- Counter2Ops
- Inherited from:
- Counter2Ops
Returns a Counter[K1, V]
Returns a Counter[K1, V]
- Inherited from:
- LowPriorityCounter2
Returns a Counter[K2, V]
Returns a Counter[K2, V]
- Inherited from:
- LowPriorityCounter2
- Inherited from:
- Counter2Ops
- Inherited from:
- Counter2Ops
- Inherited from:
- Counter2Ops
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._
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)
}
}
}
- Inherited from:
- Counter2Ops