Given a permutation of the integers from 1 to \(n\), this
function calculates its parity (+1 or -1), i.e. the number
of swapping that take the permutation back to the natural
ordering \(1,2,\dots,n\).
Usage
oddity(x)
Value
A real number equal to +1 or -1, indicating the
parity of the given permutation.
Arguments
x
A vector containing a permutation of the first
\(n\) integers, \(1,2,\dots,n\).