gap-packages / meataxe64

A new implementation of the MeatAxe algorithm
https://gap-packages.github.io/meataxe64/
GNU General Public License v2.0
4 stars 5 forks source link

State of Play and plans #1

Open stevelinton opened 6 years ago

stevelinton commented 6 years ago

What's committed at the moment seems (after a few unstructured tests) to work. You can create, access, set entries in, do arithmetic operations on, and echelize slab-sized matrices.

Design choices:

To dos or concerns:

stevelinton commented 6 years ago

I've added a script etc/asmfix.g which converts assembler for OSX. It appears to work I haven't tried to work out how to get automake to run it, or how to elegantly select which set of assembler to use.

stevelinton commented 6 years ago

Following discussion with Richard, the "choosing which assembler to use at runtime" problem will likely go away. A future version of mtx64 will include all versions and use the CPUID instruction to decide which one to use.

markuspf commented 6 years ago

I tried implementing conversion between bitstrings and blists. Its a bit fiddly to make sure that BIPEB is lined up with uint64_t. Functions for bitstrings seem to be incomplete as well (no function to create a bitstring, number of bits not set (I assume that in a meataxe64 bitstring uint64_t *bs, bs[0] is the number of bits, and bs[1] is the number of bits that are set? in my branch I tried to add some documentation while I go along to make it easier for others to fiddle around if they feel the need.

markuspf commented 6 years ago

I also think we should at some point split up meataxe64.c into parts (one for bitsttrings, one for finite fields, one for matrices at least).

stevelinton commented 6 years ago

@markuspf I think we need to assume that BIPEB is 64. There is no way meataxe64 is ever going to work with any other wordlength. I'd suggest that the package AvailabilityTest just fail if GAPInfo.BytesPerVariable isn't 8. I agree about splitting up meataxe64.c, though. It's getting quite long.

stevelinton commented 6 years ago

I just added row-at-a-time access for GF2 so you can extract a row of a MTX64 matrix as a GF2 compressed vector. After some checking, it's just a memcpy. 8bit is going to be a bit more interesting, although I think I can feel a lookup table coming on...

stevelinton commented 6 years ago

8bit is now in place. That should be all the kernel programming for the conversions, which run very fast. With a few GAP level routines to handle whole matrices, we should be good.

stevelinton commented 6 years ago

I've now got enough conversions etc. to make it convenient to do some benchmarks, which I'm doing now. As one data point, over GF(2) to do a single matrix multiply (squaring a random matrix) it becomes quicker to convert to MTX64, multiply and convert back, rather than use the builtin compressed matrix multiply, at about 500 dimensions. Just the multiply without the conversions crosses over at about 50 dimensions. For GF(3) it's even more dramatic, with crossover at about 100 dimensions and about 100-fold performance difference for 10000 dimensions.

stevelinton commented 6 years ago

A couple of updates:

stevelinton commented 6 years ago

Just FYI. There is now an implementation of a recursive echelize in echelzie.gi which is much more efficient than just using the slab echelize for matrices over a few hundred dimensions. At "slab size" 50K or so, it is not much slower than a multiply, and actually faster if all you want is the rank, for instance. I'm reworking it following experience of writing it the first time and discussion with Richard, but, for instance echelizing a 40Kx40K matrix over GF(157) takes less than 20 minutes on my laptop.