Matrices' outputs in GAP

713 Views Asked by At

Does anyone know whether is a function in GAP via I would be able to change elements of matrices over GF(2) to the form 0 and 1. need to say, in GAP, outputs for elements of matrices defined over GF(2) are in these form: Z(2)^0 and 0*Z(2). Is it possible to change these elements in the last step to 1 and 0 respectively?

1

There are 1 best solutions below

1
On BEST ANSWER

It depends whether do you need this to view the result or to use it in subsequent code.

For viewing, see " Vectors and Matrices" from the GAP tutorial:

"A vector or matrix of integers can also be multiplied with a finite field scalar and vice versa. Such products result in a matrix over the finite field with the integers mapped into the finite field in the obvious way. Finite field matrices are nicer to read when they are Displayed rather than Printed. (Here we write Z(q) to denote a primitive root of the finite field with $q$ elements.)"

For example,

gap> m:= [[1,-1, 1],
>         [2, 0,-1],
>         [1, 1, 1]];
[ [ 1, -1, 1 ], [ 2, 0, -1 ], [ 1, 1, 1 ] ]
gap> Display( m * One( GF(5) ) );
 1 4 1
 2 . 4
 1 1 1
gap> Display( m^2 * Z(2) + m * Z(4) );
z = Z(4)
 z^1 z^1 z^2
   1   1 z^2
 z^1 z^1 z^2

Otherwise, if elm is an element of a finite prime field, then Int(elm) returns the smallest nonnegative integer such that elm = int * One( elm ):

gap> l:=AsList(GF(5));
[ 0*Z(5), Z(5)^0, Z(5), Z(5)^2, Z(5)^3 ]
gap> List(l,Int);
[ 0, 1, 2, 4, 3 ]

and IntVecFFE may be used to perform the conversion on rows. See ?IntFFE in GAP for more details about InfFFE and IntVecFFE.