pub fn finalize_permutation(ws: &mut Workspace) -> Vec<i32>Expand description
Consume the post-elimination state and produce the final permutation.
On entry ws must have completed run_elimination. Performs,
in order:
- Un-flip
peandelen(faeramd.rs:567-572) sope[i]holds the parent pivot andelen[i]holds the frontal size. - Path compression (
amd.rs:573-590): each absorbed supervariablei(nv[i] == 0) has itspechain walked until a pivot is found, then all intermediates are rewritten to point at that pivot directly. Inert in Slice A — becomes active once supervariable detection (Slice B) lands. - Assembly-tree postorder with big-child-last heuristic
(
amd.rs:5-49,amd.rs:51-124,amd.rs:593-599). Reuseshead/next/lastas child/sibling/stack scratch; writes the postorder index intow. - Invert
wintohead[k] = pivot at postorder k(amd.rs:600-606). - Assign starting positions to each pivot’s block
(
amd.rs:607-615):next[e] = nel, thennel += nv[e]. - Expand absorbed supervariables + place dense-deferred variables
at the tail (
amd.rs:617-629). - Emit
perm:perm[next[i]] = ifor everyi(amd.rs:631-633).
Returns a permutation perm of length n where perm[k] is the
column of the original matrix to be eliminated at step k.