Three surgical import changes. No behavior change. No new semantics.
Backend decides Rust vs pure-Python transparently.
- field/propagate.py: versor_apply <- algebra.backend
- vocab/manifold.py: cga_inner <- algebra.backend
- vault/store.py: recall loop replaced with vault_recall() from
algebra.backend; public result shape preserved ({versor, score,
metadata, index}). null_project stays on algebra.cga (not the
recall hot path). store() and reproject() unchanged.
Rust path for vault_recall uses Rayon parallel scan and releases
the GIL. Python fallback is sequential and behaviorally identical.
No batching introduced; that is Commit 3+.
24 lines
792 B
Python
24 lines
792 B
Python
"""
|
|
Field propagation — the generation heartbeat.
|
|
|
|
Each step: F <- versor_apply(V, F)
|
|
|
|
V is the rotor for the current node's outgoing edge in the vocab manifold.
|
|
No correction. No normalization. No conditional branching. The loop is tight.
|
|
|
|
Hot path routes through algebra.backend, which dispatches to the Rust
|
|
extension (core_rs) when available and falls back to pure Python silently.
|
|
"""
|
|
|
|
from algebra.backend import versor_apply
|
|
from field.state import FieldState
|
|
|
|
|
|
def propagate_step(state: FieldState, V) -> FieldState:
|
|
"""
|
|
Apply one versor transition.
|
|
V is the edge rotor from the current node.
|
|
Returns a new FieldState one step forward on the manifold.
|
|
"""
|
|
new_F = versor_apply(V, state.F)
|
|
return FieldState(F=new_F, node=state.node, step=state.step + 1)
|