class MoreMath::Permutation

def self.from_cycles(cycles, max = 0)

call to the Permutation#cycles method .
cycles. This is for example the result of a
Creates a new Permutation instance from the Array of Arrays
def self.from_cycles(cycles, max = 0)
  indices = Array.new(max)
  cycles.each do |cycle|
    cycle.empty? and next
    for i in 0...cycle.size
      indices[ cycle[i - 1] ] = cycle[i]
    end
  end
  indices.each_with_index { |r, i| r or indices[i] = i }
  from_value(indices)
end