Skip to main content

Crate holos_core

Crate holos_core 

Source
Expand description

§HOLOS — a fast, dependency-free Hyperdimensional Computing (HDC / VSA) engine.

HDC represents information as very high-dimensional vectors (~10,000-D) and computes with three cheap algebraic operations plus an associative memory:

  • bind (): associate two hypervectors (XOR) — invertible, result orthogonal to both.
  • bundle (): superpose several (majority) — result similar to all of them.
  • permute (ρ): rotate — encode order / sequences.
  • cleanup: nearest-neighbor search over an ItemMemory to decode a noisy result.

The flagship Hypervector uses the BSC (Binary Spatter Code) model, bit-packed into u64 words so operations become XOR + hardware popcount — very fast and cache-friendly. A bipolar map::MapVector model is also provided for tasks that favor linear bundling.

use holos_core::{Hypervector, Rng};
let mut rng = Rng::new(42);
let d = 10_000;
let role = Hypervector::random(d, &mut rng);
let value = Hypervector::random(d, &mut rng);
let bound = role.bind(&value);                 // associate role↔value
assert!(bound.bind(&role).similarity(&value) > 0.99); // unbind recovers value

Modules§

map
MAP model (Multiply-Add-Permute, Gayler): bipolar {-1, +1} hypervectors.

Structs§

Classifier
Accumulates a signed per-class vote at each bit position and builds prototypes (a prototype bit is 1 wherever the class’s vote is positive).
Hypervector
A binary hypervector (BSC model), bit-packed into 64-bit words.
ItemMemory
A set of named hypervectors with fast nearest-neighbor search.
LevelEncoder
Encodes fixed-length numeric feature vectors into hypervectors.
Rng
A tiny, fast, deterministic pseudo-random number generator (SplitMix64).

Functions§

bundle
Bundling (): bit-wise majority over several hypervectors. The result is similar to every member. Ties resolve to 0.
permute
Permutation (ρ): cyclic rotation of the bits by k positions. Produces a vector quasi-orthogonal to the original; invert with -k.