Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Linear algebra for embedded systems, microcontrollers, and real-time applications.

A hybrid no_std/alloc library. Stack-first by default. Scales to sparse matrices and Krylov subspace solvers when a heap is available.

API Reference · GitHub

Why rustebra exists

Rust currently lacks a linear algebra library that is simultaneously serious about no_std support and complete enough to cover sparse matrices and iterative solvers. Existing options either assume a heap is always available, or only provide a partial set of operations for constrained environments.

rustebra closes that gap.

Design principles

  • No allocator required by default — The core works entirely on the stack using const generics to fix sizes at compile time.
  • Allocation is opt-in — Heap-backed structures and algorithms are available behind the alloc feature flag.
  • Generic over numeric precision — Works across floating-point types, from microcontrollers without double-precision units to desktop systems.
  • Explicit error handling — Recoverable failures are reported through Result, not panics.

rustebra vs. the competition

Feature
rustebra
ndarray
nalgebra
no_std support
Yes
Full
Partial
Optional
Partial
Optional
Stack-only (no heap required)
Yes
Default
No
No
Yes
For fixed-size
Sparse matrices
Yes
v0.3.0+ (COO, CSR, CSC)
No
Separate crate
Partial
Limited
Krylov solvers
Yes
v0.4.0+ (power iteration)
Partial
Via ndarray-linalg
No
Not in core
3D math/graphics
No
Not focused
No
Not provided
Yes
Excellent
BLAS/LAPACK integration
No
No
Yes
Excellent
No
Pure Rust
Maturity
Early
v0.4.0
Yes
Mature
Yes
Mature
Embedded systems
Yes
Best choice
No
Poor fit
Partial
For fixed-size only

When to use rustebra

Use rustebra if:

  • You need linear algebra without dynamic allocation (embedded, real-time, microcontroller)
  • You’re working with sparse matrices in an embedded context
  • You want no_std + optional alloc (best of both worlds)
  • You need predictable stack-only memory

Use ndarray if:

  • You need production BLAS/LAPACK routines (scientific computing, data science)
  • You’re comfortable with heap allocation and want optimal performance
  • You need large matrices with sophisticated solvers
  • Building NumPy-like workflows in Rust

Use nalgebra if:

  • You need 3D graphics, robotics, or game engine math (Points, Isometries, Rotations)
  • You want optional no_std support with fixed-size matrices
  • Building low-level geometric transformations

Getting started

[dependencies]
rustebra = "0.4.0"

# Optional: heap-backed structures and Krylov solvers
rustebra = { version = "0.4.0", features = ["alloc"] }
# no_std build (default)
cargo build
cargo test

# with alloc feature
cargo build --features alloc
cargo test --features alloc

Explore the docs

Licensed under the Apache License 2.0.