Dense and square 0/1-matrix to CSR conversion for word-RAM Hopcroft–Karp #
Converts a row-major m × r 0/1 adjacency matrix in word-RAM memory into exact compressed sparse
row (CSR) neighbour arrays (exactBipAdj) and initializes the BaseRegs workspace pointers in
O(m + m r) instructions. Shared by dense Hopcroft–Karp
(CslibFrontier.Algorithms.WordRAM.HopcroftKarp) and Dilworth minimum chain cover / maximum
antichain (CslibFrontier.Algorithms.WordRAM.ChainCover).
Main definitions #
Cslib.Algorithms.WordRAM.HopcroftKarp.buildCSRCode: scans a row-majorm × r0/1matrix atmatBaseinto CSR arrays atbOffRegand sets upBaseRegs.Cslib.Algorithms.WordRAM.HopcroftKarp.matrixSetupCode: reads header dimensions ([m, r]or square[n]), setsbOffReg, and runsbuildCSRCode.
Main results #
Cslib.Algorithms.WordRAM.HopcroftKarp.exec_buildCSRCode:O(m + m r)matrix-to-CSR conversion.Cslib.Algorithms.WordRAM.HopcroftKarp.exec_matrixSetupCode: shared dense and square poset setup.
Convert a row-major m × r 0/1 adjacency matrix stored starting at matBase into exact
CSR arrays starting at bOffReg, then initialize all BaseRegs workspace pointers.
Exact O(m + m r) matrix-to-CSR conversion and BaseRegs setup (buildCSRCode).
Read header dimensions (m, and r if isSquare = false else r = m) from input memory,
compute bOffReg := matBase + m * r (with matBase = 2 if isSquare else 3), and convert
the row-major m × r 0/1 adjacency matrix starting at matBase into exact CSR arrays.
Shared header-read and matrix-to-CSR conversion for dense (isSquare = false, header [m, r])
and square poset (isSquare = true, header [n]) encodings.