Skip to content

yansu67/SINDY-RUST

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sindy-rust

License: MIT Rust

sindy-rs is a high-performance Rust port of the popular PySINDy library. It brings the power of Sparse Identification of Nonlinear Dynamical Systems (SINDy) to the Rust ecosystem, offering significant performance improvements and memory safety.


Why sindy-rs?

  • Performance: Up to 50x faster than Python for iterative optimizers and complex feature libraries.
  • Concurrency: Native support for multithreading (via Rayon) without GIL bottlenecks.
  • Type Safety: Leverage Rust's strict type system to catch numerical errors at compile time.
  • Zero Dependencies (Python): Compiled to a single binary. No need for Python, NumPy, or scikit-learn in production.
  • Memory Efficient: Direct control over memory allocation, ideal for massive PDE datasets.

Features

Core Capabilities

  • SINDy Model: Full fit, predict, score, and simulate functionality.
  • SINDYc: Support for control inputs and exogenous variables.
  • DiscreteSINDy: Discovery of discrete mapping systems (e.g., Logistic Map).
  • Multi-Trajectory: Support for non-continuous/disjoint experimental data.

Feature Libraries

  • Polynomial: Efficient polynomial combinations.
  • Fourier: Spectral basis functions (sin/cos).
  • Custom: Flexible user-defined math functions.
  • Generalized: Tensor products and mapping of multiple libraries.
  • PDE / WeakPDE: Discovery of partial differential equations from spatial data.

Advanced Optimizers

  • STLSQ: Sequentially Thresholded Least Squares.
  • SR3: Sparse Relaxed Regularized Regression (with QR unbiasing).
  • FROLS / SSR: Greedy forward and backward feature selection.
  • EvidenceGreedy: Bayesian informed optimization.
  • ConstrainedSR3: Support for linear equality and inequality constraints via clarabel.

Installation

Add this to your Cargo.toml:

[dependencies]
sindy-rs = "0.1.0"
ndarray = "0.16"

Quick Start

use sindy_rs::{SINDy, STLSQ, PolynomialLibrary};
use ndarray::array;

fn main() {
    // 1. Prepare data (e.g., linear system x' = -2x)
    let x = array![[0.0], [1.0], [2.0], [3.0]];
    let y = array![[0.0], [2.0], [4.0], [6.0]];

    // 2. Initialize SINDy model
    let mut model = SINDy::new(
        Box::new(PolynomialLibrary::new(2)),
        Box::new(STLSQ::default())
    );

    // 3. Fit and Inspect
    model.fit(&x, &y).unwrap();
    println!("Identified Equations: {:?}", model.equations());
}

Performance Benchmarks

In comparison to the original PySINDy (Python):

  • SSR/FROLS: 10x - 50x faster.
  • Large PDE Datasets: Significantly reduced memory usage and 5x speedup in feature generation.

Roadmap

  • Phase 12: Advanced Differentiation (Savitzky-Golay, Spectral).
  • Phase 12: Standard ODE Examples (Lorenz, Rossler, etc.).

📄 License

Distributed under the MIT License. See LICENSE for more information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages