gap-system / gap

Main development repository for GAP - Groups, Algorithms, Programming, a System for Computational Discrete Algebra
https://www.gap-system.org
GNU General Public License v2.0
813 stars 161 forks source link

Bad printing for finite fields in IsCoeffsModConwayPolRep #4380

Open fingolfin opened 3 years ago

fingolfin commented 3 years ago

Inspired by issue #4376:

gap> g:=GO(-1,2,257);
GO(-1,2,257)
gap> M:=InvariantQuadraticForm(g).matrix;
[ [ z0, z0 ], [ 0z, z0 ] ]
gap> g.1;
[ [ 126, 15 ], [ 242, 141 ] ]
gap> e:=g.1[1,1]^0;
z0
gap> IsCoeffsModConwayPolRep(e);
true

The entries of these matrices are all finite field elements, but in IsCoeffsModConwayPolRep (why that is so is another question, see issue #4376, but not relevant here).

I think this way of printing those elements is very bad. In the first matrices, they look like gibberish, in the second they look like integers. Note that the second generator at this time is weird in the usual internal FFE rep, and printed quite differently:

gap> g.2;
[ [ Z(257)^128, 0*Z(257) ], [ Z(257)^128, Z(257)^0 ] ]

We should either print the IsCoeffsModConwayPolRep elements like that; or if we deem this undesirable for some reason (e.g. it's too slow, or we want them to look different), then we could perhaps at least print them like this:

gap> M:=InvariantQuadraticForm(g).matrix;
[ [ z^0, z^0 ], [ 0*z, z^0 ] ]
gap> g.1;
[ [ 126*z^0, 15*z^0 ], [ 242*z^0, 141*z^0 ] ]
ThomasBreuer commented 3 years ago

(@fingolfin I had just written a comment for #4376 when you opened this issue.)

I think in the situation of #4376, one knows that the matrix entries lie in GF(q), thus they should better be represented w.r.t. IsInternalRep when q is small. (The construction happens in GF(q^2).)

In the general situation where the IsCoeffsModConwayPolRep elements have to appear, I would prefer the variant where elements of the prime field are printed as multiples of z^0.

fingolfin commented 3 years ago

Yeah, in the example I used above, ideally we'd use IsInternalRep everywhere. But here I really wanted to discuss the printing for IsCoeffsModConwayPolRep, and I was simply too lazy to figure out how to produce such elements independently ;-).