$ cnpm install invert-permutation
Computes the inverse of a permutation
console.log( require("invert-permutation")([1,3,0,2]) )
//Prints:
// [ 2, 1, 3, 0 ]
npm install invert-permutation
Inverts a permutation
perm
is the permutation to invertresult
is an optional array that gets the result of inverting the permutationReturns result
or a newly allocated array if nothing is specified
(c) 2013 Mikola Lysenko. MIT License
Copyright 2013 - present © cnpmjs.org