Skip to main content

Module eml_coherence

Module eml_coherence 

Source
Expand description

O(1) coherence approximation via EML (exp(x) - ln(y)) master formula.

Predicts algebraic connectivity (lambda_2) from graph statistics without running the expensive O(k*m) Lanczos eigenvalue iteration. Based on: Odrzywolel 2026, “All elementary functions from a single operator”

§Two-Tier Coherence Pattern (DEMOCRITUS)

The intended usage follows a two-tier pattern:

  • Every tick: coherence_fast() via the EML model (~0.1 us)
  • When drift exceeds threshold: spectral_analysis() via Lanczos (~500 us), then model.record() to feed the training buffer
  • Every 1000 exact samples: model.train() to refine parameters

This module does NOT modify the cognitive tick loop. Callers are responsible for implementing the two-tier cadence.

§Architecture

Delegates to eml_core::EmlModel for the generic EML machinery. This module provides the WeftOS-specific wrappers:

Structs§

CoherencePrediction
Multi-output coherence prediction.
EmlCoherenceModel
Depth-4 multi-head EML master formula for O(1) coherence prediction.
GraphFeatures
Cheap-to-extract graph statistics used as input features for the EML coherence model.

Enums§

EmlEvent
An event emitted by an EML model during its lifecycle.

Functions§

eml
The EML universal operator: eml(x, y) = exp(x) - ln(y).
eml_safe
Numerically safe EML: clamps exp input to [-20, 20] and ensures a positive ln argument.
softmax3
Softmax over 3 values so that alpha + beta + gamma = 1.