Skip to content

Core Modules

Xinyu edited this page Jan 12, 2026 · 1 revision

Core Modules

The rssn library is organized into a collection of modules, each responsible for a distinct set of functionalities. This modular design, governed by feature flags, allows users to compile only the parts of the library they need.

Home

Module Overview

Below is a description of the primary modules found in the src directory.

symbolic

This is the heart of rssn. It contains the entire Computer Algebra System (CAS), including the core data structures for symbolic computation.

  • symbolic::core: Defines the fundamental Expr (AST) and DagNode (DAG) structures, and the DagManager that canonicalizes expressions.
  • symbolic::calculus: Provides functions for symbolic differentiation, integration, limits, and series expansions.
  • symbolic::simplify_dag: Contains the iterative, bottom-up simplification engine that operates on the DAG.
  • symbolic::polynomial: Implements polynomial-specific operations, including the computation of Gröbner bases.

numerical

This module provides a suite of algorithms for numerical computing, built to be generic and flexible using Rust's trait system.

  • numerical::ode: Solvers for Ordinary Differential Equations.
  • numerical::integration: Algorithms for numerical integration (quadrature).
  • numerical::optimization: Tools for finding minima or maxima of functions.
  • numerical::linalg: Wrappers and utilities for linear algebra operations, often relying on backends like nalgebra or faer.

physics

A high-level module for building scientific simulations. It provides frameworks and utilities for common simulation patterns.

  • Examples include templates or helpers for Finite Element Method (FEM), Finite Difference Method (FDM), and Finite Volume Method (FVM) solvers.
  • The architecture is data-oriented and designed with future parallelism in mind.

compute

This module acts as a high-level computation engine, orchestrating the symbolic and numerical components to perform complex calculations.

ffi_apis & ffi_blindings

These modules work together to create the Foreign Function Interface (FFI), allowing rssn to be used from other languages.

  • ffi_apis: Exposes the C-compatible functions that form the public-facing API for external languages.
  • ffi_blindings: Implements the handle-based "blinding" system, which safely manages references to Rust objects by handing out opaque integer handles instead of raw pointers.

jit

The Just-In-Time (JIT) compilation module. It can compile symbolic expressions into native machine code at runtime for a significant performance boost, often using a backend like cranelift.

output

Responsible for rendering Expr objects into different formats. It is decoupled from the core engine and supports:

  • Pretty-printing to the console.
  • LaTeX for inclusion in scientific documents.
  • Typst as a modern alternative to LaTeX.

input

This module handles parsing of expressions from string formats into the internal Expr representation.

plugins

A system designed for extensibility, allowing third-party libraries to register new functions, simplification rules, or even new types with the rssn core.

prelude

This module re-exports the most commonly used types, traits, and functions, making it easier for users to get started with the library.

Clone this wiki locally