Dear GAP forum,
in writing some routines to deal with integer vectors modulo a positive
integer I discovered that the operation vec mod scalar in GAP 3.1 is
not possible:
gap> [1,2,3,4,5,6] mod 2;
Error, operations: remainder of list and integer is not defined
It is possible to replace the statement above by the following
gap> List( [1,2,3,4,5,6], x -> x mod 2 );
but at a cost. The following two statements were executed on a Sparc
station SLC.
gap> Runtime();; List( [1..60000], x -> x*2 );; Runtime()-last2;; 10167 gap> Runtime();; [1..60000]*2;; Runtime()-last2;; 1483
It would be useful to have the operation vec mod scaler available
for those cases where taking the remainder makes sense. For a similar
reason the operation vec mod vec for integer vectors is useful.
The operation would be defined componentwise. In this way one could
easily do computations in finite abelian groups. For example, adding
two vectors in the group C_2 x C_4 x C_12 could be done as follows:
gap> ([1,2,3] + [4,5,6]) mod [2,4,12]; [1,3,9]
With kind regards, Werner Nickel.
----------------------------/|-|--|-|--|------Werner-Nickel------------------- werner@pell.anu.edu.au /_| |\ | | | Mathematics Research Section --------------------------/--|-|-\|-|_/|------Australian-National-University--