Mathpaqs is a collection of mathematical, 100% portable, packages in the Ada programming language.


Download Mathpaqs from the SourceForge project page.



Mathpaqs topics


The list of packages below is sorted by topics.

In the Mathpaqs archive, each topic has a subdirectory.

Of course there are many possible interactions, like between Multi-precision numbers and Algebra (see Euclidean_Ring_Tools) - it is like combining mathematics fields...




Euclidean_Ring_Tools: Generic package: given a type with the properties of an Euclidean ring (like integers or polynomials, with 0,1,+,* and integral division), it gives the Greatest Common Divisor and the Bezout factors.


Frac: Generic package: given a type with the properties of a ring, it gives the fractions of it, with operators.


Frac.Order: Supplement of generic package 'Frac': provides an order relation from one of the ring.


Frac_Euclid: Generic package: given a type with the properties of an Euclidean ring (with division), it gives the fractions field of it, with operators and reduction.


Frac_Euclid.Order: Supplement of generic package 'Frac_Euclid': provides an order relation from one of the ring.


Polynomials: Generic package, creates polynomials on a field.


Examples of instantiation:

         Float_Polynomials: = Polynomials( float, 0.0,1.0, "-",... );

         Rationals.Polynomials: = Polynomials( rational, frac_0, frac_1, "-",... );


Rationals: Package for manipulation of rational numbers. One-liner package: Frac_Euclid( integer, 0,1, "-","+","-","*","/"); !

       Rationals_Order: = Rationals.Order("<");


Linear algebra


G_Matrices: Generic simple matrix package, with matrix-matrix, matrix-vector, vector operations.
NB: For Ada 2005+ and real numbers implemented as floating-point numbers, it is better to use Ada.Numerics.Generic_Real_Arrays instead.


Generic_Real_Linear_Equations: by Jon Squire. Inversion, Cholesky decomposition, LU decomposition, QR decomposition, SV decomposition.


ConjGrad: Fast (Bi)Conjugate Gradient iterative methods for solving Ax=b. Generic -> applies to the matrix storage of your choice (e.g. sparse) !





G_FEK: Parts of the Finite Element Kernel from M. Bercovier (original in FORTRAN);

Computes values and derivatives of elementary functions given the element's geometry.

Available so far:

1D: L2 (linear)

2D: Q4 (linear), Q9 (quadratic)

3D: B27 (quadratic)

Generic -> can be instantiated for any precision!


Beta_Function [NEW]: The Beta function: B(a,b), B(x,a,b), I_x(a,b).

Gamma_Function: The Gamma function: Γ(x) and Log(Γ(x)).

Phi_Function [NEW]: Gauss' Phi function: Φ(x) and inverse.


Multi-precision integers


Multi_precision_integers: Multiple-precision integers package.


Multi_precision_integers_IO: Text_IO, for multi-precision integers.


(Pseudo-) Random number generation, probability models, statistics


Generic_Random_Functions: Functions facilitating computations with various standard random distributions, discrete and continuous: Beta, Normal, Poisson, Pareto.


Discrete_Random_Simulation: Random generation on any empirical discrete distribution.


Finite_distributed_random: Random generation on any enumerated type.


U_Rand: Standalone random generator (Pure Ada 95, replaces seamlessly the generator of an Ada implementation (Ada.Numerics.Float_Random) if the latter seems too slow).


Copulas: An object-oriented multivariate uniform random generator with dependency model of any kind. A few basic copulas are provided.


Samples: A package for building samples of random values, then computing statistics from these samples.


Estimators: Various statistical estimators.


Sparse matrices


Sparse: Sparse matrix package (Pure Ada 83); uses SparseB

SparseB: Low-level vector operations for Sparse package

- Pure Ada 83 [.adb] body, and

- DEC/Compaq/HP [.dec] body mapped to BLAS




Formulas [NEW]: A generic symbolic computation package (expression parser, fast evaluation, formula simplification).

Contours [NEW]: A generic contour plot package.




Project information:

For any news, change logs, support requests, update informations: visit the project on SourceForge!



Gautier de Montmollin, e-mail 

The Get Ada Now site:


Some Ada compilers: