In-memory O(n³) Hungarian solver (coreCode and core_exec) #
Assembles alternating-tree phases into coreCode and proves its O(n³) Word-RAM execution bound
core_exec on an unsigned/shifted row-major cost matrix.
Instruction bound for coreCode (O(n³)).
Core O(n³) Hungarian solver on an in-memory n × n unsigned cost matrix C at baseC:
initializes row potentials y, column potentials nz, and mates, runs n augmenting phases, and
writes length n at outBase.
O(n³) Word-RAM execution on an in-memory unsigned/shifted cost matrix. Given BaseRegs
and CostMem for an n × n matrix C : Fin n × Fin n → ℕ bounded by W at bC, coreCode
halts within coreTime n = O(n³) instructions at every word width satisfying
Fits w (bC + n * n + 8 * n + 2 * W + 2), leaving (hungarian fun p => (C p : ℤ))'s potentials
and perfect matching in memory.