Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Computations over algebraic structures in Java made easy.

Table of Contents

  1. About The Project
  2. Built With
  3. Usage
  4. Contributing
  5. License

About The Project

The Ruffini library is developed to make it easy to implement algorithms in Java involving various algebraic structures such as finite fields, polynomial rings, field extensions etc. The library includes an extensive library of already implemented algorithms such as the Euclidean algorithm, polynomial division etc. to make implementation even easier.

The project is named after the italian mathematician Paolo Ruffini (1765-1822) who, among other things, contributed to group theory and was the first to give a proof (incomplete) that there is no general formula to solve quintic (and higher order) equations.

Built With

The project may be build using maven,

mvn clean install

and the documentation with

mvn javadoc:javadoc


The Ruffini library is organized analogous of how abstract algebra is presented in mathematics. The base of the library are a number of interfaces representing abstract algebraic structures. They are organized in an inheritance hierachy as seen in figure below. Note that E is a generic class, representing the element of the given structure.

Inheritance diagram for abstract algebraic structures

As in abstract algebra, an algorithm may be defined for an abstract structure and then be used with any concrete structure satisfying the definition of the abstract structure. As an example, consider the implementation of the Gram-Schmidt process definded over vectors of type V and scalars of type S. Now, this code may be used with any concrete implementations of a vector space over a field.

public class GramSchmidt<V, S, F extends Field<S>> implements Function<List<V>, List<V>> {

  private final VectorSpace<V, S, F> vectorSpace;
  private final BiFunction<V, V, S> innerProduct;

  public GramSchmidt(VectorSpace<V, S, F> V,
      BiFunction<V, V, S> innerProduct) {
    this.vectorSpace = V;
    this.innerProduct = innerProduct;

  public List<V> apply(List<V> vectors) {
    List<V> U = new ArrayList<>();

    Projection<V, S, F> proj = new Projection<>(vectorSpace, innerProduct);

    for (V v : vectors) {
      for (V u : U) {
        V p = proj.apply(v, u);
        v = vectorSpace.subtract(v, p);
    return U;


There are a few demo applications showing some capabilities of the library. They are found in src/main/java/dk/jonaslindstrom/math/demo.


If you want to help out developing new features for Ruffini or fix a bug you've stumbled upon, it may be done as follows:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/MyFeature)
  3. Commit your Changes (git commit -m 'Add MyFeature')
  4. Push to the Branch (git push origin feature/MyFeature)
  5. Open a Pull Request


Distributed under the MIT License. See LICENSE for more information.


Library for computations over abstract algebraic structures such as finite fields and polynomial rings.








No releases published


No packages published