Skip to contents

TDA's mpinv: given a permutation p of 1:n, returns q such that q[p[i]] == i – matching base R's order(p).

Usage

tda_mpinv(p, dir = tempfile("tda"))

Arguments

p

an integer permutation of 1:length(p).

dir

working directory.

Value

An integer vector, the inverse permutation.

Examples

tda_mpinv(c(3, 1, 4, 2))   # == order(c(3, 1, 4, 2))
#> [1] 2 4 1 3