Re: Faster implementation of perm_sign

Bill Allombert <[email protected]> Wed, 25 Feb 2026 23:42:32 +0100
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <aZ962Mt8m7Hw2L3F@seventeen>
On Tue, Feb 24, 2026 at 09:44:16AM +0100, Peter Bruin wrote:
> Bonjour,
> 
> Preparing a lecture about permutations made me realise that perm_sign
> (which I contributed in 2017) could be improved by successively
> composing with transpositions instead of computing the cycle
> decomposition.  This does require keeping track of the inverse
> permutation.  I am attaching a patch.  Empirically, this seems to be at
> least 35% faster than the old implementation:

Indeed! Applied, thanks!
Bill.