lib/more_math/permutation.rb
# Compose this Permutation instance and the other to
# a new Permutation. Note that a permutation
# composed with it's inverted permutation yields
# the identity permutation, the permutation with rank 0.
#
# <b>Example:</b>
#  p1 = Permutation.new(5, 42)
#  # => #<Permutation:0x75370 @last=119, @rank=42, @size=5>
#  p2 = p1.invert
#  # => #<Permutation:0x653d0 @last=119, @rank=51, @size=5>
#  p1.compose(p2)
#  => #<Permutation:0x639a4 @last=119, @rank=0, @size=5>
# Or a little nicer to look at:
#  p1 * -p1
#  # => #<Permutation:0x62004 @last=119, @rank=0, @size=5>
Compose this Permutation instance and the other to
a new Permutation. Note that a permutation
composed with it's inverted permutation yields
the identity permutation, the permutation with rank 0.


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