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

no-std nalgebra

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

113 releases

0.33.2 Oct 29, 2024
0.33.0 Jun 23, 2024
0.32.5 Mar 28, 2024
0.32.3 Jul 9, 2023
0.1.0 Nov 22, 2014

#5 in Math

Download history 189920/week @ 2024-08-23 190119/week @ 2024-08-30 196768/week @ 2024-09-06 192485/week @ 2024-09-13 207732/week @ 2024-09-20 200573/week @ 2024-09-27 202159/week @ 2024-10-04 201813/week @ 2024-10-11 210254/week @ 2024-10-18 206823/week @ 2024-10-25 206429/week @ 2024-11-01 186152/week @ 2024-11-08 201036/week @ 2024-11-15 196837/week @ 2024-11-22 201300/week @ 2024-11-29 211255/week @ 2024-12-06

847,606 downloads per month
Used in 2,550 crates (977 directly)

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

~0.8–4MB
~98K SLoC