Home/Packages/Phasor

Phasor · foundation

Encode numbers and symbols as phasor faces. Compose them with one algebra.

Phasor is a Vector Symbolic Architecture (VSA) codec for .NET. Tokens — numbers and text — become bundles of unit complex numbers called phasors. Bind, unbind, bundle, and correlate form the complete algebra: arithmetic is encoding, not calculation. It's the base package the rest of the Evaluated Applications stack (AlgFormer, HoloDb, HoloVoxel) is built on.

v1.0.3 net8.0+ zero dependencies AOT & trim-safe free to use
dotnet add package EvaluatedApplications.Phasor

The problem it solves

numbers and symbols, one algebra

Symbolic and numeric data are usually kept separate: numbers flow through arithmetic circuits, symbols through lookup tables. Phasor bridges them. Bind two numbers on the linear band and you add them; bind on the log band and you multiply them. A symbol encodes to a fixed random phasor. Now both live in the same algebra — you can store them together, mix them, and read values back by correlation. This is the substrate for exact storage (no floating-point error in bundle/delete), similarity search at scale, and models that reason over both values and symbols with the same composition operators.

How it works

two operations

Encode

A number becomes a face with its value encoded as phase — value in, phase out, deterministic. A symbol gets a salted hash-based random signature.

Compose

Bind (complex multiply per component) builds relationships; bundle (sum) collects sets or superpositions; unbind (conjugate) extracts parts exactly; readout by correlation gives a dot-product score. On the linear band, bind is addition; on the log band, it's multiplication — there is no separate calculator, arithmetic is the composition.

Two profiles

pick the one that matches your workload

PhasorCodec

Fixed-width (256 reals) with a frozen identity prefix and a learned orbital tail. Built for neural models: the frozen part keeps values exact while the tail learns meaning downstream.

HoloCodec

Configurable width, SIMD (Vector<double>), a planar layout (reals, then imags) with a memoized number cache. Built for holographic storage and similarity search at scale.

Do not mix faces between the two profiles — they use different layouts and are not interchangeable inputs to the same op.

Key features

what you get

One algebra, no special cases

Bind, unbind, bundle and readout work the same way on numbers and symbols.

Exact composition

Bundle and unbind are exact; subtraction removes a contribution with no floating-point error.

No dependencies

Only .NET System and System.Numerics — no external libraries.

AOT and trim compatible

Works with ahead-of-time compilation and tree-shaking, no reflection tricks.

Deterministic hashing

Symbols encode to repeatable, salted phasor signatures — reproducible, not cryptographic.

Memoized decode cache

HoloCodec caches number faces to speed up repeated decodes.

Get started

minimal example

using Phasor; // Encode a number and a symbol double[] five = PhasorCodec.Encode("5"); double[] greeting = PhasorCodec.Encode("hello"); // Bind two numbers: adds them on the linear band double[] fivePlusThree = PhasorCodec.Bind(five, PhasorCodec.Encode("3")); int sum = PhasorCodec.DecodeSum(fivePlusThree, max: 10); // sum == 8 // Bundle (superpose) items to build a set, then unbind to extract one double[] pair = PhasorCodec.Bundle(greeting, five); double[] extracted = PhasorCodec.Unbind(pair, greeting); // extracted ~= five

For larger workloads or similarity search, use HoloCodec (SIMD, configurable width):

using Phasor; var codec = new HoloCodec(dim: 1024); // 1024-dimensional, ~256 in the number band double[] encoded = codec.Encode("hello"); double similarity = codec.Dot(encoded, another);

Compatibility: .NET 8.0+, Windows/Linux/macOS, no platform-specific code, no dependency to bring your own model or storage layer. License: proprietary — every capability is free to use today; a license key is reserved for possible future advanced features, none gated currently.

Where Phasor shows up

It's the base package: AlgFormer's frozen input/output codec, HoloDb's row holograms, and HoloVoxel's chunk storage all build directly on it.