Karim Belabas on Sat, 26 Nov 2022 12:19:38 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: 3^k performance


* Bill Allombert [2022-11-26 09:47]:
[...]
> The simplest approach would be to use powers(3,10^5), with to caveat:
[...]
> - the powers function has a bug and is very slow for integers.
[...]

Here's a temporary workaround.

\\ slow
(12:16) gp > v=powers(3,10^5);
time = 2,191 ms.
\\ reasonably fast
(12:16) gp > w=powers(3,10^5,1);
time = 345 ms.

(12:16) gp > v==w
%3 = 1 \\ identical

Will investigate later.

Cheers,

    K.B.
--
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/
`