inverse_permutation

std.seq.inverse_permutation · Level L3

The inverse of a permutation: inv[perm[i]] = i. Each position is scattered to where it came from, then Cast back to integers.

inv[permᵢ] = i

Signature

inverse_permutation(perm: i64[n]) → i64[n]

Structure

The function as NOVA stores it: one box per input, operation and output, and arrows that carry values. A double border marks another library function this one runs — called once, or by Scan once per element; select it to open that function.

permi64[n]Iotapos0.0MultiplyblankScatterAddplacedCastinvinvi64[n]
  • input
  • operation
  • constant
  • call
  • output

Verification

  • Signature proven by NOVA’s shape solver, for every size.
  • Equal to the reference np.argsort(perm) in exact rational arithmetic, on all 40 test cases.
  • All 178 float64 results are exact: the error is zero.
  • Interpreter and NumPy backend return bit-identical results.
Accuracy in detail
correctly rounded (the float64 nearest the exact value)
100%
bit-equal to the NumPy formula in float64
100%
largest error, in units in the last place
0

Identity

Calls
—
Called by
—
sha256:c754fdcea214e333b904f5b11a8183b000e38989146fbc4b9e6dc941fb5e1e61

The semantic hash of the graph. It changes when the program changes, and never when only its documentation does.