File size: 782 Bytes
4c0cf4e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! NuWave Lenia Engine — Rust Core
//!
//! Applies Lenia dynamics to transformer weight matrices.
//! The hot path: 196 weight matrices × (conv2d + growth + conservation) per step.
//! Python/PyTorch: ~65s. Rust target: <5s.
//!
//! The growth function IS the learning rule. No backprop. No loss function.
//! Each weight neighborhood evolves based on its neighbors' states
//! and the activation flow through it.
//!
//! PyO3 bindings: Python calls step() with flat f32 arrays.
//! Rust does the math. Returns delta arrays Python applies to tensors.

mod engine;
mod kernel;

use pyo3::prelude::*;

#[pymodule]
fn nuwave_lenia(m: &Bound<'_, PyModule>) -> PyResult<()> {
    m.add_class::<engine::RustLeniaEngine>()?;
    m.add_class::<engine::LeniaStepResult>()?;
    Ok(())
}