Skip to content

std.compute.vector Phase 1/2

Janus now ships std.compute.vector as the Phase 1 scalar/reference layer for future sovereign vector search.

The module is deliberately small and useful now: scalar metrics, normalization, seeded rotation/unrotation, b2/b4 bit packing, fixed Lloyd-Max quantization, a caller-owned top-k heap, positional TurboIndex v0 for in-memory search over retained packed codes, and stable-ID IdMapIndex v0 with allowlist-before-heap search. It also includes fixed-header encode/decode for .jvi and .jvim, plus byte-buffer save/load for positional .jvi packed-code payloads and stable-ID .jvim packed-code payloads with u64 ID sidecars. Save computes BLAKE3 payload CIDs; load verifies them and returns cid_mismatch on corruption. Retained index storage is allocated through the explicit std.mem.page_allocator parent supplied in IndexConfig.

use std.compute.vector
let a = [_]f32{1.0, 2.0, 3.0}
let b = [_]f32{4.0, 5.0, 6.0}
let score = vector.dot(a, b, 3)

The proof gate is:

Terminal window
./scripts/zb test-vector

./scripts/zb test also depends on the same vector smoke harness.

This is not the full vector database surface yet. File I/O wrappers and SIMD backends remain open SPEC-237 work. The value of this release is the scalar oracle plus working positional and stable-ID in-memory indexes, with the .jvi and .jvim persistence paths now concrete enough to reject corrupt payloads, reopen payloads, and reproduce search.