class MoreMath::Permutation
def signum
transpositions (cycles of length 2), or even if it can be represented of
A permutation is odd if it can be represented by an odd number of
an even permutation.
It's -1 if this permutation is odd and 1 if it's
Returns the signum of this Permutation instance.
def signum s = 1 cycles.each do |c| c.size % 2 == 0 and s *= -1 end s end