class MoreMath::Permutation

def compose(other)

# => #
p1 * -p1
Or a little nicer to look at:
=> #
p1.compose(p2)
# => #
p2 = p1.invert
# => #
p1 = Permutation.new(5, 42)
Example:

the identity permutation, the permutation with rank 0.
composed with it's inverted permutation yields
a new Permutation. Note that a permutation
Compose this Permutation instance and the other to
def compose(other)
  size == other.size or raise ArgumentError,
    "permutations of unequal sizes cannot be composed!"
  indices = self.value
  composed = other.value.map { |i| indices[i] }
  klon = clone
  klon.rank = rank_indices(composed)
  klon
end