| Karim Belabas on Sun, 16 Nov 2025 10:08:10 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: PARI/GP vecsort/versearch and Mod() |
* hermann@stamm-wilbrandt.de [2025-11-15 19:12]:
> On 2025-11-15 17:49, Bill Allombert wrote:
[...]
> > F4 = { [[Mod(0,2),Mod(0,2); \\ 0
> > Mod(0,2),Mod(0,2)],
> > [Mod(1,2),Mod(0,2); \\ 1
> > Mod(0,2),Mod(1,2)],
> > [Mod(0,2),Mod(1,2); \\ a
> > Mod(1,2),Mod(1,2)],
> > [Mod(1,2),Mod(1,2); \\ b
> > Mod(1,2),Mod(0,2)]]; }
[...]
For readability, I would write
F4 = { [[0,0; \\ 0
0,0],
[1,0; \\ 1
0,1],
[0,1; \\ a
1,1],
[1,1; \\ b
1,0]] * Mod(1,2); }
or
F4 = { [[0,0; 0,0], \\ 0
[1,0; 0,1], \\ 1
[0,1; 1,1], \\ a
[1,1; 1,0]] \\ b
* Mod(1,2); }
or, in two steps, F4 = ... (over Z) then F4 *= Mod(1, 2). Etc.
Cheers,
K.B.
P.S. The hackish recursive F4 = Mod(F4, 2) also works ... and is marginally
faster than multiplying by Mod(1, 2).
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/