-
-
Notifications
You must be signed in to change notification settings - Fork 663
Description
Ticket #12142 implements an interface to PARI's t_FFELT type for finite fields, which is much faster than the one currently used by Sage, in which finite field elements are PARI objects like Mod(Mod(1, 3)*a, Mod(1, 3)*a^17 + Mod(2, 3)*a + Mod(1, 3))
. The attached patch makes the new implementation the default for those finite fields that currently use the slow PARI implementation, namely those of cardinality pn with p > 2 prime, n > 1 and pn > 216.
The actual switch is just a trivial change in the FiniteField
constructor. The only other real addition is construction of Integer
from t_FFELT
; the rest of the patch fixes doctests. Almost all fixes are for doctests that assumed FiniteField_elt_pari
to be the default. One somewhat notable point is that certain finite elements now compare differently (see the changed doctest in polynomial_zz_pex.py
). This is because gcmp_sage
(in sage/libs/pari/misc.h
) compares all non-real PARI types via their string representations. With the new FiniteFieldElement_pari_ffelt
, string comparison gives the same result as lexicographic comparison of polynomials expressing finite field elements in terms of the chosen generator, which is nice.
Apply:
- attachment: trac_14888-switch_to_pari_ffelt.patch
- attachment: 14888_fix_32bit.patch
- attachment: 14888_review.patch
Depends on #12142
Depends on #15124
Depends on #15125
Component: finite rings
Keywords: FiniteField performance
Author: Peter Bruin, Jeroen Demeyer
Reviewer: Jean-Pierre Flori, Jeroen Demeyer, Peter Bruin
Merged: sage-5.13.beta0
Issue created by migration from https://trac.sagemath.org/ticket/14888