#vector #vector-math #linear-algebra #matrix #algebra #linear #vector-matrix

no-std nalgebra-randv09

General-purpose linear algebra library with transformations and statically-sized or dynamically-sized matrices

1 unstable release

new 0.33.2 May 1, 2025

#782 in Math

Download history 204/week @ 2025-04-26

204 downloads per month
Used in 2 crates

Apache-2.0

2MB
36K SLoC

crates.io

crates.io

Users guide | Documentation


Linear algebra library for the Rust programming language.



lib.rs:

nalgebra

nalgebra is a linear algebra library written for Rust targeting:

  • General-purpose linear algebra (still lacks a lot of features…)
  • Real-time computer graphics.
  • Real-time computer physics.

Using nalgebra

You will need the last stable build of the rust compiler and the official package manager: cargo.

Simply add the following to your Cargo.toml file:

[dependencies]
// TODO: replace the * by the latest version.
nalgebra = "*"

Most useful functionalities of nalgebra are grouped in the root module nalgebra::.

However, the recommended way to use nalgebra is to import types and traits explicitly, and call free-functions using the na:: prefix:

#[macro_use]
extern crate approx; // For the macro assert_relative_eq!
extern crate nalgebra as na;
use na::{Vector3, Rotation3};

fn main() {
let axis  = Vector3::x_axis();
let angle = 1.57;
let b     = Rotation3::from_axis_angle(&axis, angle);

assert_relative_eq!(b.axis().unwrap(), axis);
assert_relative_eq!(b.angle(), angle);
}

Features

nalgebra is meant to be a general-purpose, low-dimensional, linear algebra library, with an optimized set of tools for computer graphics and physics. Those features include:

Dependencies

~1–5MB
~112K SLoC