I just released v1.0 of
GaloisFields.jl. For those people not familiar – a Galois field (or ‘finite field’) is a finite set that supports addition and multiplication, both with their inverses subtraction and division. The most well-known examples are the integers modulo a prime number p. This package allows using these sets wherever a
Number is expected.
Commonly, a bottleneck when using Galois fields is the modulo (
mod) operation. An interesting feature of this package is the use of broadcasting to reduce the number of these: whenever there’s a sufficient number of bits in
Int, we postpone computing this reduction until the end. Here’s the performance effect:
julia> using GaloisFields julia> const F = GaloisField(29); julia> x = rand(F, 1000); y = rand(F, 1000); z = rand(F); julia> @btime x .+ z .* y; # fused modulo optimization 2.547 μs (7 allocations: 1.22 KiB) julia> @btime broadcast((x,z,y) -> x + z * y, x, z, y); # same operation, no special optimization 4.998 μs (1 allocation: 1.06 KiB)
@b-reinke contributed bug fixes and @Keno contributed support for
BitIntegers.jl and code to compute primitive roots of unity. For fields of prime power order, we use Frank Lübeck’s database of Conway polynomials.