Parity of a permutation (source code)

= Parity of a permutation
{wiki}

The parity of a permutation records whether it is a product of an even or odd number of transpositions. It is well-defined and equals the sign of the corresponding permutation matrix.