#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 166714/week @ 2024-08-04 199483/week @ 2024-08-11 172074/week @ 2024-08-18 194030/week @ 2024-08-25 192444/week @ 2024-09-01 199087/week @ 2024-09-08 185355/week @ 2024-09-15 218155/week @ 2024-09-22 195418/week @ 2024-09-29 197236/week @ 2024-10-06 200089/week @ 2024-10-13 219886/week @ 2024-10-20 196622/week @ 2024-10-27 210936/week @ 2024-11-03 188581/week @ 2024-11-10 199345/week @ 2024-11-17

805,585 downloads per month
Used in 2,517 crates (954 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–4.5MB
~101K SLoC