[GAP Forum] Coefficients of finite field element

Max Horn max at quendi.de
Sun Sep 30 10:47:19 BST 2018


Hi Ángel,

> Am 30.09.2018 um 11:35 schrieb Ángel del Río <adelrio at um.es>:
> 
> 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).

> 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

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




More information about the Forum mailing list