JuliaLang/julia — pull request #4421 by dmbates (2013-10-02 19:51:13+00:00)
Title: isperm without determining the inverse permutation

Stefan and I had written `isperm` by checking that the inverse permutation exists. To do that we needed to extract the guts of `invperm` into `_invperm`. Here I modify `isperm` to use a `BitVector` that records the values that have been seen while iterating over the elements of the argument. On very large vectors it can be a bit faster than evaluating the inverse permutation, and it requires less storage.

The second commit folds the `_invperm` code back into `invperm` and adds some tests.