Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

random(GaloisField) not functioning property with user-defined GaloisField #3150

Open
moorewf opened this issue Mar 3, 2024 · 1 comment

Comments

@moorewf
Copy link
Contributor

moorewf commented Mar 3, 2024

If one creates a GaloisField with a user-defined polynomial, then random(GaloisField) seems to choose a random power of the variable used to define the extension at random, rather than an actual random element of the GaloisField. This is not an issue if one creates a GaloisField without providing the polynomial.

i1 : kk = ZZ/32003

o1 = kk

o1 : QuotientRing

i2 : R = kk[q]

o2 = R

o2 : PolynomialRing

i3 : f = q^2 + q + 1

      2
o3 = q  + q + 1

o3 : R

i4 : ll = R/(f)

o4 = ll

o4 : QuotientRing

i5 : LL = GF(ll)

o5 = LL

o5 : GaloisField

i6 : tally apply(100, i -> random LL)

o6 = Tally{- q - 1 => 33}
           1 => 34
           q => 33

o6 : Tally

i7 : MM = GF(32003^2)

o7 = MM

o7 : GaloisField

i8 : random MM

o8 = 546a + 11354

o8 : MM
@moorewf
Copy link
Contributor Author

moorewf commented Mar 3, 2024

Upon looking at the code for random, it does precisely that:

random GaloisField := opts -> F -> (
           i := random F.order;
           if i === 0 then 0_F else F_0^i
           )

Would anything be wrong/slower with just taking F_0 and the degree of the extension over the prime field K, and adding (random K)*F_0^i the appropriate number of times here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant