Skip to main content

Small NumPy runtime helpers for LinOSS-style oscillator dynamics with explicit damping.

Project description

linoss-dynamics

CI License: MIT Python Status

linoss-dynamics is a small NumPy runtime package for LinOSS-style oscillator dynamics with explicit non-negative damping support.

Status: public alpha.

How this differs from the upstream LinOSS reference

The original tk-rusch/linoss is a training-time JAX/Equinox neural-network library that exposes LinOSS as trainable layers (LinOSSLayer, LinOSSBlock, LinOSS) inside a deep-learning model. It is the right choice when you are building or training a sequence model that uses LinOSS as a learnable encoder.

linoss-dynamics is a runtime physics package. Same mathematics, different audience and abstraction:

Dimension Upstream tk-rusch/linoss linoss-dynamics
Use case Training neural networks with LinOSS layers Runtime simulation, control, replay-safe systems
Stack JAX + Equinox NumPy only — zero deep-learning dependencies
Granularity Sequence-level via JAX scan (apply_linoss_im, apply_linoss_imex) Single-step (linoss_step, damped_linoss_step)
Damping Implicit (rolled into A) Explicit, non-negativity validated (G parameter)
Energy diagnostics Not exposed energy, delta_energy, convergence_window
Errors Generic shape errors Typed hierarchy (LinOSSError, InvalidShapeError, InvalidDampingError, UnsupportedModeError)
Determinism contract Best-effort (training-oriented) Replay-safe — pure NumPy, deterministic, no hidden state
Install footprint Heavy (JAX, Equinox, dataset deps) Tiny (NumPy 1.24+)

Who needs linoss-dynamics specifically

  • Replay-safe agentic systems — needed inside deterministic kernels where every step must be byte-reproducible (e.g. consumed by elume at runtime).
  • Simulation and control — robotics, signal processing, vibration analysis, and any context that uses oscillatory dynamics as a runtime model rather than a learnable layer.
  • Reference implementation for porting — a clean NumPy baseline to validate custom JAX/PyTorch ports of LinOSS against.
  • Embedded or minimal-dependency contexts — anywhere a JAX install is too heavy or unavailable.
  • Teaching and pedagogy — a self-contained, well-tested, single-file solver that students can read end-to-end in an afternoon.
  • Energy-based analysis — applications that need to monitor energy drift and detect convergence; these diagnostics are not exposed by the upstream reference.

If you are training a neural network, use the upstream package. If you are running a system that needs LinOSS as a deterministic physics step, use this one.

What It Provides

  • Classic implicit and implicit-explicit LinOSS step helpers.
  • Explicit non-negative damping G for D-LinOSS-style runtime damping.
  • Energy, energy-delta, and convergence-window helpers.
  • A dependency-light package core with NumPy as the only runtime dependency.

Install

From PyPI (recommended):

pip install linoss-dynamics

From GitHub (latest main):

python -m pip install "linoss-dynamics @ git+https://github.com/bionicbutterfly13/linoss-dynamics.git@main"

For local development:

git clone https://github.com/bionicbutterfly13/linoss-dynamics.git
cd linoss-dynamics
python -m pip install -e ".[test]"

Quickstart

Classic LinOSS-style step:

import numpy as np
from linoss_dynamics import linoss_step

y = np.array([0.2])
z = np.array([1.0])
A = np.array([1.0])

y_next, z_next, metrics = linoss_step(y, z, A, dt=0.1, mode="implicit")

print(y_next, z_next, metrics["energy_after"])

Damped step with explicit G:

import numpy as np
from linoss_dynamics import damped_linoss_step

y = np.array([0.2])
z = np.array([1.0])
A = np.array([1.0])
G = np.array([0.5])

y_next, z_next, metrics = damped_linoss_step(y, z, A, G, dt=0.1)

assert metrics["damping_mode"] == "explicit_g"

Numerical Contract

A controls oscillator stiffness/frequency.

G controls damping/forgetting.

The package deliberately keeps those controls separate. Damping is not modeled as hidden A scaling, and negative G values are rejected.

Supported damping shapes:

  • scalar G
  • vector G with the same length as y and z
  • diagonal matrix G

Supported step modes:

  • implicit / IM
  • implicit_explicit / IMEX

Public API

Name Role
linoss_step(y, z, A, dt, mode="implicit", B=None, u=None, damping=None, G=None) Advance one step, optionally dispatching to explicit damping when damping or G is supplied.
damped_linoss_step(y, z, A, G, dt, mode="implicit", B=None, u=None) Advance one step with explicit non-negative damping.
energy(y, z, A) Return diagonal oscillator energy.
delta_energy(previous_energy, next_energy) Return signed energy delta.
convergence_window(deltas, threshold, window) Return true when recent absolute deltas are below a threshold.
linoss_step_impl(...) Backward-compatible alias for callers using the implementation name.

Public errors:

Error Raised when
InvalidShapeError Inputs cannot be broadcast to the oscillator state.
InvalidDampingError Damping is outside the supported stable path, including negative G.
UnsupportedModeError The discretization mode is unsupported.

Scope

The package does not implement JAX training loops, Discretax integrations, active-inference runtimes, metacognitive policy, event buses, graph databases, or web APIs.

Host applications should keep adapters outside this package and depend on linoss-dynamics through the public API above.

Development

Run the full local check set:

python -m ruff check src tests
python -m pytest tests -v --tb=short
python -m compileall -q src tests

See CONTRIBUTING.md, PROVENANCE.md, and CLAIMS.md before changing package behavior or public wording.

Citation

If this package is useful in research or technical writing, cite the package metadata in CITATION.cff and cite the upstream LinOSS and D-LinOSS papers listed below.

Release and publishing steps are tracked in docs/release-checklist.md.

Attribution

This package is not the original LinOSS or D-LinOSS research implementation.

  • LinOSS / Oscillatory State-Space Models: T. Konstantin Rusch and Daniela Rus, Oscillatory State-Space Models, arXiv:2410.03943.
  • D-LinOSS / learned damping: Jared Boyer, T. Konstantin Rusch, and Daniela Rus, Learning to Dissipate Energy in Oscillatory State-Space Models, arXiv:2505.12171.
  • Official LinOSS ecosystem: https://github.com/tk-rusch/linoss.
  • Discretax / former Linax ecosystem: https://github.com/camail-official/discretax.

See PROVENANCE.md and CLAIMS.md before making public claims.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

linoss_dynamics-0.1.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linoss_dynamics-0.1.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file linoss_dynamics-0.1.0.tar.gz.

File metadata

  • Download URL: linoss_dynamics-0.1.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for linoss_dynamics-0.1.0.tar.gz
Algorithm Hash digest
SHA256 26ff9d6fd94a21439940a889f7a31a7be19b7af0d6fa2d3237f7fd2c693d4381
MD5 aff6ffcf1e5b7e634fdc6a56bf4a61d5
BLAKE2b-256 f60b09a3d66efd54f6154bee60e56719a90bfa35c6a9fd776882d98b8a1c36be

See more details on using hashes here.

File details

Details for the file linoss_dynamics-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for linoss_dynamics-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 91d8571888388640c0916c989bef1d356961521f9514ea0068bd8bf43173fc40
MD5 6b852d7982a1c6872174c69c7f8341ab
BLAKE2b-256 7f8c097ee260c88dc4cc40aa93e2c96809449ffd9e63a3446dca36a1dfc71207

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page