GithubHelp home page GithubHelp logo

jonas-lj / ruffini Goto Github PK

View Code? Open in Web Editor NEW
6.0 4.0 8.0 6.96 MB

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

License: MIT License

Java 100.00%
math abstract-algebra algebra linear-algebra java polynomials

ruffini's Introduction

Maven Maven Javadoc License: MIT

Ruffini

Computations over algebraic structures in Java made easy.

Table of Contents

  1. About The Project
  2. Built With
  3. Usage
  4. Demos
  5. Contributing
  6. Referencing

About The Project

The Ruffini library is developed to make it easy to write algorithms in Java involving 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 (although incomplete) that there is no general formula to solve quintic (and higher order) equations.

Submodules

The library contains multiple submodules:

  • Common: Definition of most commonly used abstract structures (groups, rings, fields, etc) and generic algorithms used throughout the library.
  • Demos: Example usages of the library. See also the Demos section.
  • Elliptic: Elliptic curves over generic fields and a few concrete constructions (Curve25519 and BLS12-381).
  • Finite-fields: Constructions of finite fields and algebraic field extensions.
  • Integers: Concrete constructions of integers and rational numbers.
  • Parser: Algorithms to parse algebraic expressions from strings and evaluate them.
  • Permutations: Construction and algoritms for permutation groups.
  • Polynomials: Single- and multivariate polynomials over arbitrary rings or fields. Includes common algorithms such as the computation of Lagrange interpolation and Gröbner bases.
  • Reals: Arbitrary precision real numbers using a constructive representation.

Built With

The project may be build using maven,

mvn clean install

and the documentation with

mvn javadoc:aggregate

Usage

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;
  }

  @Override
  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);
      }
      U.add(v);
    }
    return U;
  }

}

The library also contains some concrete instantiations of algebraic structures such as prime fields, finite fields, class groups and certain elliptic curve constructions (Curve25519 and BLS12-381).

Demos

There are a few demo applications showing some capabilities of the library in the demos module.

These include an implementation of the AKS primality testing algorithm, computing the optimal Ate pairing over the BLS12-381 elliptic construction, a demonstration of arbitrary precision arithmetic with real numbers inspired by the work of Hans-J Boehm and an implementation of the Poseidon hash function over BN254.

Contributing

We welcome any help from the community, both if you want to help out developing new features for Ruffini or fix a bug you've stumbled upon. Simply open a pull request with the suggested changes.

Referencing

If you are using the Ruffini library in a research project, please cite it as (setting the date field accordingly):

@software{Ruffini,
  author = {{Jonas Lindstrøm}},
  title = {{Ruffini} - Java library for computations over abstract algebraic structures},
  note = {\url{https://github.com/jonas-lj/Ruffini}},
  date = {},
}

ruffini's People

Contributors

dependabot[bot] avatar jonas-lj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.