#algebra #ring #field #group #lattice


Abstract algebraic structures for Rust

7 releases

0.1.6 Jul 27, 2022
0.1.5 Feb 24, 2021
0.1.4 Oct 29, 2020
0.1.2 Sep 28, 2020

#535 in Math

MIT license


Abstract Algebra for Rust

Build Status Crate Documentation GitHub

This is a crate for doing abstract algebraic calculations in Rust. Unlike other implementations, the elements do not know to which algebraic structure they belong to, so all operations are performed through algebraic objects. For example, calculating within the ring of modular arithmetic modulo 6 the elements are still primitive i32 values, and only the quotient ring stores the value 6. This allows putting many such elements into polynomials or matrices efficiently, since this common value need to be stored only once in the algebra. Another benefit is that matrices are stored as simple vectors, and only the matrix algebra needs to know the shape of the matrix.

All prime-element fields can be constructed from the ring of integers by taking the quotient ring by a prime number, or using the 2-element field on the set of bool values directly. All finite fields can be constructed by forming the ring of polynomials over their prime field and then taking the quotient ring by an irreducible polynomial. All finite boolean algebras can be constructed as the direct power of the 2-element boolean algebra. The divisibility order (on the set of association classes) with distributive lattice operations can be constructed for Euclidean domains, such as the ring of integers and the ring of polynomials over a field. The ring of rectangular matrices can be formed over a field. The linear group of invertible matrices, and the special linear group of matrices of unit determinant can be formed over any field.