Counter2

Companion:
class
class Object
trait Matchable
class Any

Type members

Classlikes

trait Curried[M[_, _], K]

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.

class Impl[K1, K2, V](val data: Map[K1, Counter[K2, V]])(implicit scalar: Zero[V]) extends Counter2[K1, K2, V] with Serializable

Inherited classlikes

class CanZipMapValuesCounter2[K1, K2, V, RV] extends CanZipMapValues[Counter2[K1, K2, V], V, RV, Counter2[K1, K2, RV]]
Inherited from:
Counter2Ops

Value members

Concrete methods

def apply[K1, K2, V : Zero](): Counter2[K1, K2, V]

Returns a new empty counter.

Returns a new empty counter.

def apply[K1, K2, V : Zero](values: (K1, K2, V)*): Counter2[K1, K2, V]

Aggregates the counts in the given items.

Aggregates the counts in the given items.

def apply[K1, K2, V : Zero](values: IterableOnce[(K1, K2, V)]): Counter2[K1, K2, V]

Aggregates the counts in the given items.

Aggregates the counts in the given items.

def count[K1, K2](values: IterableOnce[(K1, K2)]): Counter2[K1, K2, Int]

Counts the given elements.

Counts the given elements.

Implicits

Implicits

implicit def CanMapValuesCounter[K1, K2, V, RV : Zero]: CanMapValues[Counter2[K1, K2, V], V, RV, Counter2[K1, K2, RV]]
implicit def canIterateValues[K1, K2, V]: CanTraverseValues[Counter2[K1, K2, V], V]
implicit def canMapCols[K1, K2, V, R : Semiring]: CanCollapseAxis[Counter2[K1, K2, V], _1.type, Counter[K2, V], Counter[K2, R], Counter2[K1, K2, R]]

Returns a Counter[K1, V]

Returns a Counter[K1, V]

implicit def canMapRows[K1, K2, V, R : Semiring]: CanCollapseAxis[Counter2[K1, K2, V], _0.type, Counter[K1, V], Counter[K1, R], Counter2[K1, K2, R]]

Returns a Counter[K2, V]

Returns a Counter[K2, V]

implicit def canSliceCol[K1, K2, V]: CanSlice2[Counter2[K1, K2, V], ::, K2, Counter[K1, V]]
implicit def canSliceRow[K1, K2, V]: CanSlice2[Counter2[K1, K2, V], K1, ::, Counter[K2, V]]
implicit def canTraverseKeyValuePairs[K1, K2, V]: CanTraverseKeyValuePairs[Counter2[K1, K2, V], (K1, K2), V]
implicit def handholdCanMapCols[K1, K2, V]: HandHold[Counter2[K1, K2, V], _1.type, Counter[K2, V]]
implicit def handholdCanMapRows[K1, K2, V]: HandHold[Counter2[K1, K2, V], _0.type, Counter[K1, V]]
implicit def scalarOf[K1, K2, V]: ScalarOf[Counter2[K1, K2, V], V]

Inherited implicits

implicit def addIntoVS[K1, K2, V : Semiring]: InPlaceImpl2[Counter2[K1, K2, V], V]
Inherited from:
Counter2Ops
implicit def addIntoVV[K1, K2, V : Semiring]: InPlaceImpl2[Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def addVS[K1, K2, V : Zero]: Impl2[Counter2[K1, K2, V], V, Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def addVV[K1, K2, V : Zero]: Impl2[Counter2[K1, K2, V], Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canAxpy[K1, K2, V : Semiring]: InPlaceImpl3[Counter2[K1, K2, V], V, Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canCollapseCols[K1, K2, V, R : Semiring]: CanCollapseAxis[Counter2[K1, K2, V], _1.type, Counter[K2, V], R, Counter[K1, R]]

Returns a Counter[K1, V]

Returns a Counter[K1, V]

Inherited from:
LowPriorityCounter2
implicit def canCollapseRows[K1, K2, V, R : Semiring]: CanCollapseAxis[Counter2[K1, K2, V], _0.type, Counter[K1, V], R, Counter[K2, R]]

Returns a Counter[K2, V]

Returns a Counter[K2, V]

Inherited from:
LowPriorityCounter2
implicit def canCopy[K1, K2, V : Semiring]: CanCopy[Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canDivIntoVS[K1, K2, V : Field]: InPlaceImpl2[Counter2[K1, K2, V], V]
Inherited from:
Counter2Ops
implicit def canDivIntoVV[K1, K2, V : Field]: InPlaceImpl2[Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canDivVS[K1, K2, V](implicit copy: CanCopy[Counter2[K1, K2, V]], semiring: Field[V]): Impl2[Counter2[K1, K2, V], V, Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canDivVV[K1, K2, V](implicit copy: CanCopy[Counter2[K1, K2, V]], semiring: Field[V]): Impl2[Counter2[K1, K2, V], Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canMulIntoVS[K1, K2, V : Semiring]: InPlaceImpl2[Counter2[K1, K2, V], V]
Inherited from:
Counter2Ops
implicit def canMulIntoVS_M[K1, K2, V : Semiring]: InPlaceImpl2[Counter2[K1, K2, V], V]
Inherited from:
Counter2Ops
implicit def canMulIntoVV[K1, K2, V : Semiring]: InPlaceImpl2[Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canMulVS[K1, K2, V](implicit semiring: Semiring[V]): Impl2[Counter2[K1, K2, V], V, Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canMulVS_M[K1, K2, V](implicit semiring: Semiring[V]): Impl2[Counter2[K1, K2, V], V, Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canMulVV[K1, K2, V](implicit semiring: Semiring[V]): Impl2[Counter2[K1, K2, V], Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canMultiplyC2C1[K1, K2, V](implicit semiring: Semiring[V]): Impl2[Counter2[K1, K2, V], Counter[K2, V], Counter[K1, V]]

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
implicit def canMultiplyC2C2[K1, K2, K3, V](implicit semiring: Semiring[V]): Impl2[Counter2[K1, K2, V], Counter2[K2, K3, V], Counter2[K1, K3, V]]
Inherited from:
Counter2Ops
implicit def canNegate[K1, K2, V](implicit ring: Ring[V]): Impl[Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def canSetIntoVS[K1, K2, V]: InPlaceImpl2[Counter2[K1, K2, V], V]
Inherited from:
Counter2Ops
implicit def canSetIntoVV[K1, K2, V]: InPlaceImpl2[Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def subIntoVS[K1, K2, V : Ring]: InPlaceImpl2[Counter2[K1, K2, V], V]
Inherited from:
Counter2Ops
implicit def subIntoVV[K1, K2, V : Ring]: InPlaceImpl2[Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def subVS[K1, K2, V : Zero]: Impl2[Counter2[K1, K2, V], V, Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def subVV[K1, K2, V : Zero]: Impl2[Counter2[K1, K2, V], Counter2[K1, K2, V], Counter2[K1, K2, V]]
Inherited from:
Counter2Ops
implicit def zipMap[K1, K2, V, R : Semiring]: CanZipMapValuesCounter2[K1, K2, V, R]
Inherited from:
Counter2Ops