Defined in: packages/scalar-sketch/src/minhash.ts:81
A MinHash signature specialized for byte arrays.
Extends
Section titled “Extends”MinHashMetadataMinHashOperations<Uint8Array,BytesMinHash>
Properties
Section titled “Properties”
readonlykind:"minhash"
Defined in: packages/scalar-sketch/src/minhash.ts:15
Inherited from
Section titled “Inherited from”signatureSize
Section titled “signatureSize”
readonlysignatureSize:number
Defined in: packages/scalar-sketch/src/minhash.ts:18
Number of ordered 64-bit coordinate minima.
Inherited from
Section titled “Inherited from”stateByteLength
Section titled “stateByteLength”
readonlystateByteLength:number
Defined in: packages/scalar-sketch/src/minhash.ts:20
Bytes occupied by paired low/high coordinate words, excluding object and hash-instance overhead.
Inherited from
Section titled “Inherited from”MinHashMetadata.stateByteLength
maximumStandardError
Section titled “maximumStandardError”
readonlymaximumStandardError:number
Defined in: packages/scalar-sketch/src/minhash.ts:22
Worst-case standard error of the Jaccard estimate, 1 / (2 * sqrt(signatureSize)).
Inherited from
Section titled “Inherited from”MinHashMetadata.maximumStandardError
readonlyseed:bigint
Defined in: packages/scalar-sketch/src/minhash.ts:24
XXH64 base seed that participates in comparison and merge compatibility.
Inherited from
Section titled “Inherited from”seedSchedule
Section titled “seedSchedule”
readonlyseedSchedule:SeedScheduleIdentity
Defined in: packages/scalar-sketch/src/minhash.ts:26
Prefix-stable coordinate-seed schedule that participates in comparison and merge compatibility.
Inherited from
Section titled “Inherited from”snapshot
Section titled “snapshot”
readonlysnapshot: () =>Uint32Array
Defined in: packages/scalar-sketch/src/minhash.ts:37
Return a fresh copy of the signature in O(signatureSize).
The array holds two Uint32 words per coordinate, low word first, in the
same order as the serialized signature. Every word is 0xffff_ffff when
the sketch is empty. Mutating the copy leaves the sketch unchanged.
Returns
Section titled “Returns”Uint32Array
Inherited from
Section titled “Inherited from”MinHashOperations.snapshot
update
Section titled “update”update: (
value) =>void
Defined in: packages/scalar-sketch/src/minhash.ts:43
Add one value to the set summary. Repeated values are idempotent. O(signatureSize).
Parameters
Section titled “Parameters”Uint8Array
Returns
Section titled “Returns”void
Throws
Section titled “Throws”From knotkit/hash for an invalid scalar value.
Inherited from
Section titled “Inherited from”MinHashOperations.update
similarity
Section titled “similarity”similarity: (
other) =>number
Defined in: packages/scalar-sketch/src/minhash.ts:57
Estimate Jaccard similarity as the fraction of equal ordered coordinates. O(signatureSize).
Two empty signatures compare as 1; exactly one empty signature compares as 0.
Otherwise, under the model assumption that domain-separated seeded XXH64
coordinates behave as independent min-wise hashes, the estimate has standard
error sqrt(J * (1 - J) / signatureSize) and worst-case error metadata in
MinHashMetadata.maximumStandardError.
Parameters
Section titled “Parameters”BytesMinHash
Returns
Section titled “Returns”number
Min-wise independent permutations
Throws
Section titled “Throws”With FOREIGN_STRUCTURE,
WRONG_FAMILY, or INCOMPATIBLE_SKETCH for a non-comparable signature.
Inherited from
Section titled “Inherited from”MinHashOperations.similarity
merge: (
other) =>void
Defined in: packages/scalar-sketch/src/minhash.ts:65
Summarize the set union by taking each compatible coordinate minimum. O(signatureSize).
Self-merge is idempotent and the source is never mutated.
Parameters
Section titled “Parameters”BytesMinHash
Returns
Section titled “Returns”void
Throws
Section titled “Throws”With FOREIGN_STRUCTURE,
WRONG_FAMILY, or INCOMPATIBLE_SKETCH.
Inherited from
Section titled “Inherited from”MinHashOperations.merge
reduce
Section titled “reduce”reduce: (
targetSignatureSize) =>BytesMinHash
Defined in: packages/scalar-sketch/src/minhash.ts:72
Return a new signature containing an ordered coordinate prefix. O(targetSignatureSize).
The target must be a supported power of two no larger than the current size.
Parameters
Section titled “Parameters”targetSignatureSize
Section titled “targetSignatureSize”number
Returns
Section titled “Returns”BytesMinHash
Throws
Section titled “Throws”With INVALID_REDUCTION for an unsupported target.
Inherited from
Section titled “Inherited from”MinHashOperations.reduce
scalarKind
Section titled “scalarKind”
readonlyscalarKind:"bytes"
Defined in: packages/scalar-sketch/src/minhash.ts:82