M4RI - Linear Algebra over $\mathbb{F}_2$

Peformance

This page contains some benchmarking results for M4RI, MAGMA 2.14 , GAP 4.4 and NTL 5.4.2. It will be expanded in the future to contain more data on more operations. If you think that any result presented here is wrong and/or misleading, please let us know so that we can fix it.

Matrix Multiplication

Multiplying two random square matrices of the given dimension. GAP implements the M4RM algorithm, Magma implements Strassen-Winograd (on top of M4RM?) and M4RI implements Strassen-Winograd on top of M4RM.

64-bit Debian/GNU Linux, 2.33Ghz Core2Duo (Macbook Pro, 2nd Gen.)
Matrix
Dimension
Magma 2.14-17
(64-bit)
GAP 4.4.10
(64-bit)
M4RI-20080821
(64-bit)
10,000 x 10,0001.8926.1301.504
16,384 x 16,3847.72025.0486.074
20,000 x 20,00013.209-10.721
32,000 x 32,00053.668-43.197

64-bit Debian/GNU Linux, 1.8Ghz Opteron (sage.math)
Matrix
Dimension
Magma 2.13-5
(64-bit)
GAP 4.4.10
(64-bit)
M4RI-20080817
(64-bit)
10,000 x 10,0003.87521.4213.845
16,384 x 16,38414.99991.20216.541
20,000 x 20,00027.203-26.584
32,000 x 32,000101.677-103.885

64-bit Suse Linux, 2.4Ghz Opteron
Matrix
Dimension
Magma 2.13-5
(64-bit)
GAP 4.4.10
(64-bit)
M4RI-20080521
(64-bit)
10,000 x 10,0002.940-2.250
16,384 x 16,3849.250-8.800
20,000 x 20,00016.570-15.480
32,000 x 32,00059.100-57.800

RHEL 5, 1.6Ghz Itanium
Matrix
Dimension
Magma 2.14-16
(64-bit)
GAP 4.4.10
(64-bit)
M4RI-20080909
(64-bit)
10,000 x 10,0007.941-4.200
16,384 x 16,38431.046-16.430
20,000 x 20,00055.654-28.830
32,000 x 32,000209.483-109.414

Reduced Row Echelon Form

Computing the reduced row echelon form for random square matrices. Since these algorithms and implementations are sensitive to the structure of the input matrices (e.g. rank sensitive), benchmarks for random square matrices hold very little meaning (see for example this blog post) except maybe peak performance. We provide some more pratical examples below.

Note that the M4RI algorithm has worse theoretical time complexity when compared to the assymptotically fast matrix elimination implemented in Magma. However, the M4RI algorithm needs less memory: the 64,000 x 64,000 example below takes more than 2GB of memory in Magma but ~ 1GB with M4RI.

64-bit Debian/GNU Linux, 2.33Ghz Core2Duo (Macbook Pro, 2nd Gen.)
Matrix
Dimension
Magma
2.14-17
NTL*
5.4.2
M4RI/M4RI
20090105
M4RI/PLUQ
20091101
10,000 x 10,000 2.474 14.14 1.532 0.864
16,384 x 16,384 7.957 67.52 6.597 3.602
20,000 x 20,000 13.151 123.70 12.031 6.138
32,000 x 32,000 39.653 462.32 40.768 25.290
64,000 x 64,000251.3462511.54241.017139.320

64-bit Debian/GNU Linux, 2.6Ghz Opteron (VMWare Virtualised)
Matrix
Dimension
Magma
2.14-13
NTL*
5.4.2
M4RI/M4RI
20090105
M4RI/PLUQ
20091101
10,000 x 10,000 3.351 18.45 2.430 1.548
16,384 x 16,384 11.289 72.89 10.822 7.385
20,000 x 20,000 16.734 130.46 19.978 11.453
32,000 x 32,000 57.567 479.07 83.575 52.239
64,000 x 64,000373.9062747.41537.900306.02

RHEL 5, 1.6Ghz Itanium
Matrix
Dimension
Magma
2.14-16
GAP
4.4.10
M4RI/M4RI
20080909
M4RI/PLUQ
20090617
10,000 x 10,000 8.069- 3.418 2.410
16,384 x 16,384 25.828- 19.987 12.720
20,000 x 20,000 43.256- 30.829 15.800
32,000 x 32,000157.134-118.121 65.550
64,000 x 64,000892.481-874.609342.680

(*) For GAP we call SemiEchelonMat which only returns the row echelon form not the reduced row echelon form. For NTL we call gauss which also doesn't return the reduced row echelon form.

The following timings are for matrices as they appear during a Gröbner basis computation for the HFE cryptosystem. These examples were provided by Michael Brickenstein. In input matrices are linked from the table below. To visualise the structure of the problem a scaled down version of the smallest input matrix follows:

scaled down version of hfe_25_5.png

64-bit Debian/GNU Linux, 2.6Ghz Opteron (VMWare Virtualised)
HFE (Filesize) Matrix
Dimension
Magma
2.14-13
M4RI/M4RI
20091101
M4RI/PLUQ
20091101
25 (5.6 MB)12,307 x 13,5084.793.614.408
30 (16 MB)19,907 x 29,32333.2125.17726.682
35 (40 MB)29,969 x 55,800278.58144.389162.110

The following timings are for matrices as they appear during a MutantXL computation. These examples were provided by Wael Said.

64-bit Debian/GNU Linux, 2.6Ghz Opteron (VMWare Virtualised)
Filesize Matrix
Dimension
Magma
2.15-12
M4RI/M4RI
20091101
M4RI/PLUQ
20091101
39 MB26,407 x 26,07579.73024.10119.093