Defined in: packages/scalar-sketch/src/hyperloglog.ts:118
A HyperLogLog specialized for exact unsigned 64-bit bigints.
Extends
Section titled “Extends”Properties
Section titled “Properties”
readonlykind:"hyperloglog"
Defined in: packages/scalar-sketch/src/hyperloglog.ts:13
Inherited from
Section titled “Inherited from”precision
Section titled “precision”
readonlyprecision:number
Defined in: packages/scalar-sketch/src/hyperloglog.ts:16
Effective register precision. The register count is 2 ** precision.
Inherited from
Section titled “Inherited from”registerCount
Section titled “registerCount”
readonlyregisterCount:number
Defined in: packages/scalar-sketch/src/hyperloglog.ts:18
Number of one-byte maximum-rank registers.
Inherited from
Section titled “Inherited from”HyperLogLogMetadata.registerCount
stateByteLength
Section titled “stateByteLength”
readonlystateByteLength:number
Defined in: packages/scalar-sketch/src/hyperloglog.ts:20
Bytes occupied by the mutable register state, excluding object overhead.
Inherited from
Section titled “Inherited from”HyperLogLogMetadata.stateByteLength
estimator
Section titled “estimator”
readonlyestimator:"ertl-improved-raw"
Defined in: packages/scalar-sketch/src/hyperloglog.ts:22
The cardinality estimator applied by estimate.
Inherited from
Section titled “Inherited from”relativeStandardError
Section titled “relativeStandardError”
readonlyrelativeStandardError:number
Defined in: packages/scalar-sketch/src/hyperloglog.ts:24
Approximate one-standard-deviation relative error, 1.04 / sqrt(registerCount).
Inherited from
Section titled “Inherited from”HyperLogLogMetadata.relativeStandardError
readonlyseed:bigint
Defined in: packages/scalar-sketch/src/hyperloglog.ts:26
XXH64 seed that participates in merge compatibility.
Inherited from
Section titled “Inherited from”estimate
Section titled “estimate”estimate: () =>
number
Defined in: packages/scalar-sketch/src/hyperloglog.ts:39
Estimate the number of distinct updates. O(registerCount) after an update or merge that changes a register, O(1) for repeated or no-op reads; does not change the sketch’s registers.
Uses Otmar Ertl’s improved raw estimator without empirical lookup tables. The estimator is monotone, returns exactly zero for an empty sketch, and remains a floating-point query result rather than persisted state. The statistical error is described by relativeStandardError; it is not a hard bound.
Returns
Section titled “Returns”number
New cardinality estimation algorithms for HyperLogLog sketches
Inherited from
Section titled “Inherited from”scalarKind
Section titled “scalarKind”
readonlyscalarKind:"uint64"
Defined in: packages/scalar-sketch/src/hyperloglog.ts:119
Overrides
Section titled “Overrides”HyperLogLogMetadata.scalarKind
update
Section titled “update”update: (
value) =>void
Defined in: packages/scalar-sketch/src/hyperloglog.ts:125
Add one unsigned 64-bit bigint to the distinct-count sketch. O(1); mutates the sketch.
Parameters
Section titled “Parameters”bigint
Returns
Section titled “Returns”void
Throws
Section titled “Throws”From knotkit/hash when the value is outside the unsigned 64-bit domain.
merge: (
other) =>void
Defined in: packages/scalar-sketch/src/hyperloglog.ts:132
Merge a compatible sketch by register maximum. O(registerCount); mutates only this sketch.
Parameters
Section titled “Parameters”Uint64HyperLogLog
Returns
Section titled “Returns”void
Throws
Section titled “Throws”With FOREIGN_STRUCTURE,
WRONG_FAMILY, or INCOMPATIBLE_SKETCH.
reduce
Section titled “reduce”reduce: (
targetPrecision) =>Uint64HyperLogLog
Defined in: packages/scalar-sketch/src/hyperloglog.ts:139
Return an exact reconstructed copy at a precision no larger than this one. O(registerCount). Top digest bits remain the index; discarded index bits become the target rank prefix.
Parameters
Section titled “Parameters”targetPrecision
Section titled “targetPrecision”number
Returns
Section titled “Returns”Uint64HyperLogLog
Throws
Section titled “Throws”With INVALID_REDUCTION for an unsupported target.