SEMQ TypeScript API
    Preparing search index...

    Class Codec

    An immutable encoder for one CodecConfig. Codec.create is the one asynchronous point of the package: it loads the wasm module on first use. Call Codec.dispose when done; a finalizer frees the native handle otherwise.

    Index
    • get backend(): string

      The kernel the core runs for this operator on this host ("scalar" in wasm).

      Returns string

    • Representatives, n * dim float32, row i for encoding.ids[i]. Not normalized.

      Parameters

      Returns Float32Array

    • Release the native handle. Idempotent; later use raises InvalidInput.

      Returns void

    • Encode n unit-norm float32 rows (vectors.length === n * dim, row-major) under ids. u64 ids are bigint[], utf8 ids string[]; idKind is inferred from the first id and required when n = 0. Row errors carry the input row index.

      Parameters

      • input: {
            idKind?: "u64" | "utf8";
            ids: string[] | bigint[];
            manifest?: Record<string, string>;
            vectors: Float32Array;
        }

      Returns Encoding

    • Symbols, n * unitsPerRow bytes, one per unit.

      Parameters

      Returns Uint8Array

    • A codec for CodecConfig.orbit(dim, scale): one discrete symbol per coordinate. Loads the module if needed.

      Parameters

      • dim: number
      • scale: number = 50

      Returns Promise<Codec>

    • A codec for CodecConfig.phase(dim, sectors): angular sector per coordinate pair. Loads the module if needed.

      Parameters

      • dim: number
      • sectors: number

      Returns Promise<Codec>

    • A codec for CodecConfig.quant(dim, bins): sign and magnitude bin per coordinate. Loads the module if needed.

      Parameters

      • dim: number
      • bins: number

      Returns Promise<Codec>