Bill Allombert on Wed, 25 Feb 2026 23:42:36 +0100


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

Re: Faster implementation of perm_sign


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.