Expand description
Shared quotient-graph machinery for AMD-family bottom-up orderings.
This module hosts the workspace, elimination loop, and assembly-
tree postorder used by feral-amd and (planned) feral-amf.
Both orderings share the quotient-graph data structures
(PE / IW / LEN / NV / ELEN), the standard / aggressive element
absorption logic, the mass-elimination fast path, the
supervariable hash bucket detection, and the inline garbage
collector. They differ only in the selection metric —
approximate degree (AMD) vs approximate fill (AMF) — which is
abstracted behind the Metric trait. Phase A shipped the trait
plus the AMD-specialised MinDegree impl; Phase B.2 added
MinFill driving the parallel run_elimination_amf /
create_element_amf / select_pivot_amf / finalize_step_amf
family in algo.rs. The duplicated inner loops trade LoC for a
zero-risk AMD bit-parity contract.
Reference: Amestoy, Davis, Duff (1996) “An approximate minimum degree ordering algorithm,” SIAM J. Matrix Analysis 17:886-905; Amestoy (1999) habilitation thesis (AMF metric).
Structs§
- MinDegree
- Minimum-degree metric — the AMD selection rule of Amestoy, Davis, Duff (1996).
- MinFill
- Approximate Minimum Fill metric (HAMF4) — Amestoy 1999 thesis.
- Order
Diagnostics - Diagnostic counters extracted from a completed
Workspace. - Step
Flops - Flop-counter deltas produced by a single elimination step.
Matches faer’s
amd.rs:547-557accounting soAmdStatscan accumulate consistentndiv/nms_ldl/nms_lutotals. - Workspace
- In-memory workspace for one AMD run.
- Workspace
Options - Tunable parameters for the shared quotient-graph workspace.
Constants§
- NONE
- Sentinel for “no index” in the
i32arrays.
Traits§
- Metric
- Selection metric for an AMD-family bottom-up ordering.
Functions§
- clear_
flag - Reset the generation counter
wflgwithout visitingiw. - create_
element - Build the new element
meby merging the (variable) tail ofme’s list with every elementealready inme’s list. - create_
element_ amf - AMF analogue of
create_element. Identical structure; differs only in the bucket-index used when unlinking absorbed neighbours from their degree lists. AMD readsdegree[i](which doubles as the bucket index because AMD’s bucket is identity); AMF computesamf_bucket_of(wf[i], n)because the AMF score and running degree are stored in distinct fields (wfvsdegree). - finalize_
permutation - Consume the post-elimination state and produce the final permutation.
- finalize_
step - Finish the elimination step whose create-element phase produced
(pme1, pme2_excl, nvpiv, degme)and leftnv[me] = -nvpivandnv[i] = -nv[i]for every variablei ∈ iw[pme1..pme2_excl]. - finalize_
step_ amf - AMF analogue of
finalize_step. The Pass-1 element seeding, hash-bucket detection, and supervariable-merge structure mirror AMD; the per-iteration accumulator carries the AMF triple(deg, wf3, wf4)(Amestoy 1999 thesis), and the re-insertion computes the quantized RMF score and inserts athead[amf_bucket_of(wf[i], n)]. - flip
- Sentinel encoding used by the quotient graph:
flip(x) = -2 - x. Used to mark absorbed elements (pe[e] < 0⇒flip(parent)) and as a tag onelenfor freshly eliminated zero-degree variables. - order
- Run a metric-driven AMD-family ordering on a full-symmetric pattern, returning the permutation plus diagnostic counters.
- run_
elimination - Run the main AMD elimination loop until every live supervariable has been either pivoted or dense-deferred. Returns the accumulated flop counts.
- run_
elimination_ amf - AMF analogue of
run_elimination. - select_
pivot - Scan
headfromws.mindegupward and return the first non-empty degree-list head. Unlink the chosen variable. ReturnsNoneif no bucket in[ws.mindeg, ws.n)is non-empty (i.e. all remaining supervariables have been dense-deferred and the main loop should stop). - select_
pivot_ amf - AMF analogue of
select_pivot. Linear-scans coarse buckets (idx > n) for the entry with the smallest exact score; takes the head for fine buckets.