dimforge/nalgebra
60.5
Adequate · 30 September 2026
68.2k
lines of production code
Rust
primary language
2
measurements over time
What this system is
This system is a comprehensive linear algebra library for Rust that provides core matrix and vector operations, geometric transformations, and sparse matrix support. It extends its capabilities through optional modules for GLM-compatible graphics APIs, LAPACK-backed numerical decompositions, and procedural macros for literal construction. The codebase also includes extensive benchmarking infrastructure and property-based testing to ensure the correctness and performance of its numerical routines.
How it got here
2013–2017 — nalgebra v0.25 modernization and LAPACK integration
18 changes.
This period focused on modernizing the nalgebra codebase for the Rust 2024 edition, including structural reorganization and the adoption of the Criterion framework for rigorous performance benchmarking. Significant feature additions included comprehensive geometry types like DualQuaternion and Isometry, alongside new linear algebra capabilities such as matrix balancing and bidiagonalization. The work also heavily expanded the nalgebra-lapack crate with a full suite of LAPACK-backed decompositions and established robust property-based testing infrastructure to ensure numerical correctness.
2018–2024 — sparse matrix support and GLM compatibility
26 changes.
This period focused on expanding the library's capabilities with comprehensive sparse matrix support, including COO, CSR, and CSC formats with Cholesky decomposition and Matrix Market I/O. It also introduced the nalgebra-glm crate to provide a GLM-inspired API for graphics applications, alongside significant refactoring of base matrix storage types and the addition of procedural macros for literal construction.
Features
Add Alga trait implementations for geometry types
The \src/third\_party/alga\ module now provides implementations of the \alga\ library's algebraic and linear traits (such as \Isometry\, \Rotation\, \Transformation\, and \NormedSpace\) for the project's geometry types including \Point\, \Quaternion\, \Matrix\, \Transform\, and \DualQuaternion\. This enables these types to be used directly with generic algorithms and abstractions provided by the \alga\ crate.
_src/third\party/alga · high confidence
Add Matrix Market file parser
Users can now parse Matrix Market format files into sparse matrices using the new \cs\_matrix\_from\_matrix\_market\ and \cs\_matrix\_from\_matrix\_market\_str\ functions. This feature introduces a grammar-based parser (via Pest) that handles Matrix Market headers, dimensions, and sparse entry data, exposing the capability through the \src/io\ module.
src/io · high confidence
Add Matrix Market import and export support
The \io\ module now supports importing and exporting sparse matrices in the Matrix Market format. Users can load data into a \CooMatrix\ using \load\_coo\_from\_matrix\_market\_file\ or \load\_coo\_from\_matrix\_market\_str\, and export matrices using \save\_to\_matrix\_market\_file\ or \save\_to\_matrix\_market\_str\. The implementation uses a Pest grammar for parsing and handles various matrix types (coordinate, array) and data types (real, complex, pattern, integer).
nalgebra-sparse/src/io · high confidence
Add conversion support for mint types
This change introduces new conversion implementations between the library's core types and the \mint\ crate. Specifically, it adds \From\/\Into\ and \AsRef\/\AsMut\ traits for \Matrix\ to \mint::Vector2/3/4\ and \mint::ColumnMatrix2/3/4\, \Point\ to \mint::Point2/3\, \Quaternion\/\UnitQuaternion\ to \mint::Quaternion\, and \Rotation3\ to \mint::EulerAngles\. This allows users to easily interoperate with other crates that use \mint\ for data interchange.
_src/third\party/mint · high confidence
Add conversions between dense and sparse matrix formats
Users can now convert between dense matrices (DMatrix) and sparse formats (CooMatrix, CsrMatrix, CscMatrix) using standard Rust \From\ trait implementations. This location provides the underlying serial conversion routines and the trait bindings that enable seamless interoperability between nalgebra's dense storage and nalgebra-sparse's coordinate, compressed sparse row, and compressed sparse column formats.
nalgebra-sparse/src/convert · high confidence
Add debug utilities for generating random orthogonal and symmetric positive-definite matrices
New tools have been added to the debug module to assist with testing and benchmarking. Users can now generate random orthogonal matrices via \RandomOrthogonal\ and well-conditioned, symmetric positive-definite matrices via \RandomSDP\. These utilities are available when the \arbitrary\ feature is enabled, allowing them to be used with property-based testing frameworks like quickcheck.
src/debug · high confidence
Add proptest support for generating matrices and vectors
Users can now enable the \proptest-support\ feature to use property-based testing with nalgebra types. This new \proptest\ module provides strategies for generating matrices and vectors, including constrained generation via \matrix()\ and \vector()\ functions, as well as \Arbitrary\ implementations for dynamic and static matrix types. This allows users to write property-based tests that automatically handle shrinking of failing test cases.
src/proptest · high confidence
Add support for glam versions 0.30 through 0.33
The library now supports the glam math library versions 0.30, 0.31, 0.32, and 0.33. Users can enable these versions via the \glam030\, \glam031\, \glam032\, and \glam033\ Cargo features. This update provides conversion implementations for vectors, matrices, quaternions, isometries, points, translations, rotations, and similarity transforms between the library's types and the corresponding glam types for each supported version.
_src/third\party/glam · high confidence
Added encase trait implementations for matrix and vector types
The library now supports the \encase\ serialization/deserialization crate by implementing its required traits for internal matrix and vector types (such as \Matrix\, \Vector\, \Point\, and their view/mut variants). This allows users to serialize these mathematical types using \encase\ when the \encase\ feature is enabled, facilitating integration with tools or formats that rely on \encase\ for binary data handling.
_src/third\party · high confidence
Initial release of nalgebra-sparse with COO, CSR, and CSC matrix formats
This change introduces the nalgebra-sparse crate, providing sparse matrix support for nalgebra. It adds implementations for Coordinate (COO), Compressed Sparse Row (CSR), and Compressed Sparse Column (CSC) formats, along with a shared SparsityPattern abstraction. Users can construct matrices via triplets or raw data arrays, convert between formats, and perform arithmetic operations. The crate also includes optional features for serialization (serde), property-based testing (proptest), and matrix comparison (matrixcompare).
nalgebra-sparse/src · high confidence
Initial sparse Cholesky factorization for CSC matrices
Users can now perform sparse Cholesky factorization on Compressed Sparse Column (CSC) matrices via the new \CscCholesky\ and \CscSymbolicCholesky\ types. This feature allows computing the symbolic sparsity pattern of the Cholesky factor \L\ separately from the numerical decomposition, enabling efficient re-factorization when matrix values change but the structure remains constant. The implementation supports solving linear systems through the exposed \factor\, \factor\_numerical\, and \refactor\ methods, though it currently lacks fill-in reduction and is not recommended for production use.
nalgebra-sparse/src/factorization · high confidence
Introduce sparse matrix support with Cholesky decomposition and triangular solves
Users can now work with sparse matrices via the new \CsMatrix\ type (compressed sparse column storage) and \CsCholesky\ solver. This addition provides a Cholesky decomposition for sparse matrices, along with methods to solve lower-triangular systems against both dense and sparse right-hand sides, and supports sparse matrix multiplication and conversion between sparse and dense formats.
src/sparse · high confidence
New DualQuaternion and Isometry types with comprehensive operations
The geometry module introduces \DualQuaternion\ and \UnitDualQuaternion\ types to represent rigid-body transformations, including construction from rotation and translation parts, normalization, conjugation, inversion, and arithmetic operators. It also adds an \AbstractRotation\ trait that standardizes rotation behavior across \Rotation\, \UnitQuaternion\, and \UnitComplex\, enabling generic \Isometry\ implementations. The \Isometry\ type is now generic over the rotation type, with aliases for 2D and 3D cases, and includes interpolation methods like \lerp\_slerp\ for smooth animation between transformations.
src/geometry · high confidence
New GLM-compatible extension functions in nalgebra-glm
The \nalgebra-glm\ crate now exposes a comprehensive set of experimental (GTX) utility functions that mirror the OpenGL Mathematics library. This release adds component-wise operations (\comp\_add\, \comp\_max\, \comp\_min\, \comp\_mul\), 2D cross products, handedness checks, and matrix cross-product builders. It also introduces a full suite of diagonal matrix constructors, vector norm and distance calculations (L1, L2, squared magnitude), and triangle normal computation. Furthermore, users gain access to quaternion utilities (rotation, interpolation, conversion to/from matrices), various rotation and transformation helpers (axis-angle, 2D/3D/4D rotations, scaling, translation), and advanced matrix transformations including projection, reflection, scaling-bias, and shearing. Vector query functions for collinearity, orthogonality, and normalization checks are also included.
nalgebra-glm/src/gtx · high confidence
New GLM-compatible math extensions for matrices, vectors, and quaternions
The \nalgebra-glm\ crate now exposes a comprehensive set of GLM-style mathematical functions in the \ext\ module, providing users with familiar API patterns for 3D graphics. This includes matrix clip-space utilities (such as \perspective\, \ortho\, and their left/right-handed variants), projection helpers (\project\, \unproject\, \pick\_matrix\), and transformation functions (\look\_at\, \rotate\, \scale\, \translate\). It also adds quaternion operations (including \quat\_lerp\, \quat\_slerp\, and \quat\_rotate\), vector and scalar min/max comparisons, and relational functions for approximate equality checks, all re-exported for convenient access.
nalgebra-glm/src/ext · high confidence
New GTC module with math constants, matrix access, and quaternion utilities
The \nalgebra-glm\ crate now exposes a \gtc\ (GLM Recommended Extensions) module providing a suite of additional mathematical utilities. Users can access mathematical constants such as \pi\, \e\, and \golden\_ratio\ via the \constants\ submodule. The \matrix\_access\ submodule adds functions to retrieve and set individual rows and columns of matrices, while \matrix\_inverse\ provides \affine\_inverse\ and \inverse\_transpose\ for efficient matrix operations. Additionally, the \quaternion\ submodule introduces quaternion-specific functions including Euler angle extraction (\quat\_euler\_angles\), component-wise comparisons, and look-at quaternion generation (\quat\_look\_at\). Other GTC extensions like bitfield operations, packing/unpacking, and rounding are scaffolded in the module but remain unimplemented.
nalgebra-glm/src/gtc · high confidence
New LAPACK-backed linear algebra decompositions and solvers
The \nalgebra-lapack\ crate now provides a comprehensive suite of LAPACK-backed linear algebra operations, including Cholesky, column-pivoted QR, eigenvalue, generalized eigenvalue, Hessenberg, and LU decompositions. Users can now perform symmetric positive-definite system solving via Cholesky, handle rank-deficient systems with column-pivoted QR (featuring configurable rank-determination algorithms), and compute eigenvalues and eigenvectors for both standard and generalized matrix pairs. These additions expand the library's capabilities for advanced numerical linear algebra tasks directly through the LAPACK interface.
nalgebra-lapack/src · high confidence
New examples added for matrix operations, transformations, and genericity
Added a comprehensive set of new examples in the \examples/\ directory demonstrating key nalgebra capabilities. These include \dimensional\_genericity.rs\ and \scalar\_genericity.rs\ for writing dimension- and type-agnostic code, \matrix\_construction.rs\ for various matrix creation methods, \linear\_system\_resolution.rs\ for solving linear systems via LU decomposition, and \reshaping.rs\ for in-place matrix reshaping. Transformation examples cover \mvp.rs\ (model-view-projection matrices), \transform\_matrix4.rs\ (Matrix4 operations), \transform\_conversion.rs\ (Isometry/Similarity conversions), and \transform\_vector\_point.rs\ (vector vs point transformation). Additional examples demonstrate \homogeneous\_coordinates.rs\, \point\_construction.rs\, \matrixcompare.rs\ (matrix comparison utilities), \screen\_to\_view\_coords.rs\ (unprojection), \raw\_pointer.rs\ and \transformation\_pointer.rs\ (raw data access for graphics APIs), and \unit\_wrapper.rs\ (using the Unit type).
examples · high confidence
New matrix and vector benchmarks added
Added new benchmark suites for core matrix and vector operations, including binary/unary operations, matrix multiplication, inversion, and vector dot/cross products, using the Criterion framework.
benches/core · high confidence
New matrix balancing and bidiagonalization capabilities
The linear algebra module now includes functions for matrix balancing and bidiagonalization. The new \balance\_parlett\_reinsch\ function applies in-place modified Parlett and Reinsch matrix balancing with 2-norm to improve numerical stability, while the \Bidiagonal\ struct and \bidiagonalize\ method provide bidiagonal decomposition using Householder reflections, which serves as a foundational step for Singular Value Decomposition (SVD).
src/linalg · high confidence
New procedural macros for constructing matrices, vectors, points, and block matrices
The \nalgebra-macros\ crate now provides a set of procedural macros (\matrix!\, \dmatrix!\, \vector!\, \dvector!\, \point!\, and \stack!\) that allow users to construct linear algebra objects directly from literal data in source code. These macros generate efficient code for creating fixed-size stack-allocated structures (\SMatrix\, \SVector\, \Point\) as well as dynamic heap-allocated structures (\DMatrix\, \DVector\). The \stack!\ macro specifically enables the creation of block matrices by combining existing matrix blocks, supporting implicit zero blocks and compile-time dimension checking. These macros are re-exported by the main \nalgebra\ crate when the \macros\ feature is enabled.
nalgebra-macros/src · high confidence
New serial sparse matrix arithmetic operations for CSR and CSC formats
The \nalgebra-sparse/src/ops/serial\ module now provides a comprehensive set of single-threaded operations for Compressed Sparse Row (CSR) and Compressed Sparse Column (CSC) matrices. Users can perform sparse-sparse matrix multiplication (\spmm\) and sparse-sparse addition (\spadd\) with pre-allocated output patterns, as well as sparse-dense matrix multiplication (\spmm\_dense\). The module also includes utilities for constructing sparsity patterns for these operations (\spadd\_pattern\, \spmm\_csr\_pattern\, \spmm\_csc\_pattern\) and implements lower triangular solving for CSC matrices (\spsolve\_csc\_lower\_triangular\). These operations support transposition via an \Op\ wrapper and return detailed \OperationError\ types for issues like invalid patterns or singular matrices.
nalgebra-sparse/src/ops/serial · high confidence
Standard arithmetic operators for sparse matrices
Users can now use standard Rust operators (\+\, \-\, \\\, \/\, \neg\) directly on \CsrMatrix\ and \CscMatrix\ instances. This includes binary operations between two sparse matrices of the same format (addition, subtraction, and multiplication), multiplication with scalars (both \Matrix \ Scalar\ and \Scalar \* Matrix\ for common types), and unary negation. These operations support all combinations of owned and reference matrices, allowing for more idiomatic and readable sparse linear algebra code.
nalgebra-sparse/src/ops · high confidence
nalgebra-glm: Initial release of GLM-like interface for nalgebra
This change introduces the \nalgebra-glm\ crate, providing a GLM-inspired API for the nalgebra linear algebra library. It exposes a comprehensive set of functions for vector and matrix construction, arithmetic, geometric operations (dot/cross products, normalization), trigonometric and exponential calculations, and matrix transformations (perspective, orthographic, rotation, translation). The library defines type aliases like \TMat\, \TVec\, and specific types (\Vec2\, \Mat4\, etc.) that wrap nalgebra's types, ensuring seamless interoperability while offering a simpler, more direct interface for graphics applications.
nalgebra-glm/src · high confidence
Behavioural changes
Benchmarks migrated to Criterion for standardized performance measurement
The benchmarking infrastructure has been replaced with the Criterion framework, providing more rigorous and statistically significant performance measurements. This change introduces a new \benches/lib.rs\ entry point that registers specific benchmarks for matrix and vector operations, quaternion geometry, and various linear algebra decompositions (including bidiagonalization, Cholesky, LU, QR, SVD, and others). Users can now run these standardized benchmarks to get reliable performance data for the library's core computational capabilities.
benches · high confidence
Refactored matrix storage and view types with new type aliases
The base module has been restructured to introduce a unified \Matrix\ type backed by explicit storage traits, replacing the previous \MatrixRef\ and \MatrixSlice\ naming conventions. New type aliases have been added: \OMatrix\ and \SMatrix\ for owned matrices (static and dynamic), and \MatrixView\ / \MatrixViewMut\ for non-owning views, while the old \MatrixSlice\ and \MatrixSliceMut\ aliases are now deprecated. Storage implementations have been renamed for clarity, with \MatrixVec\ becoming \VecStorage\ and \MatrixArray\ becoming \ArrayStorage\. The \Allocator\ trait has been updated to use Generic Associated Types (GATs) to remove the scalar type \T\ from the trait definition, and a new \allocate\_from\_row\_iterator\ method has been added to support row-major initialization.
src/base · high confidence
Sparse matrix serialization moved to dedicated modules
The serialization and deserialization logic for sparse matrix types (COO, CSC, CSR) and sparsity patterns has been extracted into separate source files. This refactoring introduces intermediate data structures to produce a more human-readable format using explicit field names (such as \row\_indices\, \col\_indices\, and \values\) rather than exposing internal layout details. The change ensures that the serialization format remains stable even if the internal memory layout of the matrices changes, and it optimizes performance by using slices during serialization to avoid unnecessary data copies.
(repo-wide) · high confidence
nalgebra v0.25.0 release with Rust 2024 edition and structural reorganization
This release updates the library to the Rust 2024 edition and introduces several API and structural changes. The \core\ module has been renamed to \base\ to avoid conflicts with the Rust \core\ crate, with the old name retained as a deprecated alias. The library now relies on \simba\ for scalar traits (replacing \alga\) and \num\_traits\ for basic numeric traits. Feature flags have been standardized with a \-no-std\ suffix (e.g., \rand-no-std\, \serde-serialize-no-std\) to better reflect their behavior in \no\_std\ environments. Additionally, the \macros\ feature now re-exports matrix and point construction macros from \nalgebra-macros\, and the \debug\ module is conditionally compiled.
src · high confidence
Test coverage
Added benchmarks for LU, QR, and Hessenberg decompositions; Added comprehensive property-based tests for geometry types; Added comprehensive test coverage for core linear algebra and geometry operations; Added comprehensive tests for matrix, vector, point, and stack macros; Added integration test harness with feature-gated modules; Added property-based tests for linear algebra decompositions; Added proptest strategies and sanity tests for nalgebra types; Added quaternion benchmark suite; Added serialization and unit tests for sparse matrix types; Added test harness for nalgebra-lapack using proptest; Added tests for orthographic and perspective matrix consistency; Added tests for sparse matrix operations and solvers; Comprehensive unit and property-based tests for nalgebra-sparse; Expanded test coverage for linear algebra decompositions and operations; New benchmarking macros for binary and unary operations; Port linear algebra benchmarks to Criterion.
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 69 → 60 (-8.4)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 87 → 87 (+0.0)
- Architecture 94 → 94 (+0.1)
- Maturity 48 → 48 (+0.0)
- Readiness 82 → 52 (-29.4)
- Security 95 → 97 (+1.7)
- Performance 85 (new)
Resolved (3)
- Boundary-crossing change coupling: array_storage.rs ↔ similarity.rs (src/base/array_storage.rs)
- Change coupling: array_storage.rs ↔ unit.rs (src/base/array_storage.rs)
- Change coupling: dual_quaternion.rs ↔ orthographic.rs (src/geometry/dual_quaternion.rs)
New (14)
- Dependency hygiene PARTLY measured — Cargo dependencies read, no committed lock to grade for currency
- Documentation: no installation or build instructions (nalgebra-lapack/README.md)
- Documentation: no usage examples (nalgebra-lapack/README.md)
- Duplicate operation: Same as above, CsrMatrix also exposes both get_entry and index_entry with identical signatures and likely identical behavior.
- Duplicate operation: get_col and col provide identical access to a column view. col is the more idiomatic Rust accessor name.
- Duplicate operation: get_entry and index_entry appear to provide identical access to sparse matrix elements. The distinction between 'get' and 'index' is not semantically clear in this context.
- Duplicate operation: get_row and row provide identical access to a row view. row is the more idiomatic Rust accessor name.
- Duplicate operation: lerp (linear interpolation) and mix perform the same linear interpolation operation. While mix is the GLM name and lerp is common in other math libraries, exposing both without deprecation creates confusion.
- Duplicate operation: magnitude and length perform the same vector norm calculation. In GLM/Rust math libraries, length is the standard name; magnitude is a redundant alias.
- Inverted test pyramid
- Low cohesion: DualQuaternion (LCOM4 4) (src/geometry/dual_quaternion.rs)
- Low cohesion: Vector (LCOM4 6) (nalgebra-macros/src/matrix_vector_impl.rs)
- Off the main sequence: nalgebra-glm
- Projects may be oversized for their cohesion
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
dimforge/nalgebra was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 30 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 3320ecca21dc08f7a93c9595f6b257f05ba21273 — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-cb25ca4feafa.