Discussion:
[GAP Forum] Coefficients of finite field element
Ángel del Río
2018-09-30 09:35:27 UTC
Permalink
Hi,

How can I get the coefficients of an element of a finite field in a basis?
For example, I would like to obtain the coefficients of z^189 in the
canonical basis of GF(2^32) with z a primitive element of F. The
following calculation shows that GAP knows them and I could manually
read it but I would like to have an automatic way to obtain the
coefficients.

gap> F:=GF(2^32);
GF(2^32)
gap> CB:=CanonicalBasis(F);
CanonicalBasis( GF(2^32) )
gap> Elements(CB);
[ z0, z31, z30, z29, z28, z27, z26, z25, z24, z23, z22, z21, z20, z19, z18,
  z17, z16, z15, z14, z13, z12, z11, z10, z9, z8, z7, z6, z5, z4, z3,
z2, z ]
gap> z := PrimitiveElement(F);
z
gap> z^189;
1+z3+z5+z11+z12+z13+z14+z15+z17+z22+z23+z24+z25+z28+z30

Thanks,

Ángel
--
Ángel del Río Mateos
Dep. Matemáticas
Universidad de Murcia
30100 Murcia, Spain
***@um.es
Phone: +34 868 88 3537
Fax: +34 868 88 4182
Max Horn
2018-09-30 09:47:19 UTC
Permalink
Hi Ángel,
Post by Ángel del Río
Hi,
How can I get the coefficients of an element of a finite field in a basis?
Just like with any vector space: by using Coefficients(basis, vector).
Post by Ángel del Río
For example, I would like to obtain the coefficients of z^189 in the canonical basis of GF(2^32) with z a primitive element of F. The following calculation shows that GAP knows them and I could manually read it but I would like to have an automatic way to obtain the coefficients.
gap> F:=GF(2^32);
GF(2^32)
gap> CB:=CanonicalBasis(F);
CanonicalBasis( GF(2^32) )
gap> Elements(CB);
[ z0, z31, z30, z29, z28, z27, z26, z25, z24, z23, z22, z21, z20, z19, z18,
z17, z16, z15, z14, z13, z12, z11, z10, z9, z8, z7, z6, z5, z4, z3, z2, z ]
gap> z := PrimitiveElement(F);
z
gap> z^189;
1+z3+z5+z11+z12+z13+z14+z15+z17+z22+z23+z24+z25+z28+z30
gap> v:=Coefficients(CB, z^189);
<an immutable GF2 vector of length 32>
gap> AsPlist(v);
[ Z(2)^0, 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2),
0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, Z(2)^0,
Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2),
0*Z(2), Z(2)^0, Z(2)^0, Z(2)^0, Z(2)^0, 0*Z(2), 0*Z(2),
Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2) ]

Cheers,
Max
Post by Ángel del Río
Thanks,
Ángel
--
Ángel del Río Mateos
Dep. Matemáticas
Universidad de Murcia
30100 Murcia, Spain
Phone: +34 868 88 3537
Fax: +34 868 88 4182
_______________________________________________
Forum mailing list
https://mail.gap-system.org/mailman/listinfo/forum
Loading...