Skip to content

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:83

A Count-Min sketch specialized for byte arrays.

readonly kind: "count-min-sketch"

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:17

CountMinSketchMetadata.kind


readonly width: number

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:20

Effective power-of-two column count.

CountMinSketchMetadata.width


readonly depth: number

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:22

Effective prefix-stable row count, from 1 through 32.

CountMinSketchMetadata.depth


readonly epsilon: number

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:24

Model-based additive error factor e / width.

CountMinSketchMetadata.epsilon


readonly confidence: number

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:26

Model-based per-query confidence lower bound 1 - exp(-depth).

CountMinSketchMetadata.confidence


readonly counterBits: 32

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:28

Counter width, fixed at 32 bits.

CountMinSketchMetadata.counterBits


readonly totalWeight: number

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:30

Accepted sum of update weights, capped at 2^32 - 1.

CountMinSketchMetadata.totalWeight


readonly stateByteLength: number

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:32

Bytes occupied by row-major counters, excluding object and hash-instance overhead.

CountMinSketchMetadata.stateByteLength


readonly seed: bigint

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:34

XXH64 base seed that participates in merge compatibility.

CountMinSketchMetadata.seed


readonly seedSchedule: SeedScheduleIdentity

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:36

Prefix-stable row-seed schedule that participates in merge compatibility.

CountMinSketchMetadata.seedSchedule


update: (value, weight?) => void

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:48

Add a non-negative unsigned 32-bit weight. Weight zero is a hash-free no-op.

All destination counters and the accepted total are checked before mutation.

Uint8Array

number

void

From knotkit/hash for an invalid scalar value.

With INVALID_WEIGHT, CAPACITY_EXCEEDED, or COUNTER_OVERFLOW.

CountMinSketchOperations.update


estimate: (value) => number

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:58

Return the minimum counter selected across all rows. Does not mutate the sketch.

For accepted non-negative streams the result never underestimates the exact frequency. The epsilon and confidence metadata are the classical model bounds, assuming the domain-separated seeded XXH64 rows behave independently.

Uint8Array

number

An improved data stream summary: the Count-Min sketch

From knotkit/hash for an invalid scalar value.

CountMinSketchOperations.estimate


merge: (other) => void

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:66

Add every counter and total from a compatible sketch into this sketch.

Self-merge uses the same additive semantics. Every overflow is rejected before mutation.

BytesCountMinSketch

void

With FOREIGN_STRUCTURE, WRONG_FAMILY, INCOMPATIBLE_SKETCH, CAPACITY_EXCEEDED, or COUNTER_OVERFLOW.

CountMinSketchOperations.merge


reduce: (targetWidth, targetDepth) => BytesCountMinSketch

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:73

Return a new sketch with congruent columns summed and a deterministic row prefix retained.

The target width must divide the current width and both dimensions may only decrease.

number

number

BytesCountMinSketch

With INVALID_REDUCTION for an unsound target.

CountMinSketchOperations.reduce


readonly scalarKind: "bytes"

Defined in: packages/scalar-sketch/src/count-min-sketch.ts:85

CountMinSketchMetadata.scalarKind