global
def inverse_vector(a, vector)
Enumerable, compute the inverse of +vector+ that maps this Enumerable
If +vector+ maps the matching elements of another collection onto this
def inverse_vector(a, vector) inverse = a.dup (0...vector.size).each do |i| inverse[vector[i]] = i unless vector[i].nil? end inverse end