Word-Parallel Dynamic Programming with Bitsets

Pack subset reachability into words, explain why shifting moves many states at once, and account for boundaries in the representation.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Turn a recurrence into set operations
  2. A word boundary still needs work

Turn a recurrence into set operations

Use bit \(s\) of a bitset \(B\) for reachability of sum \(s\). Including one item of positive weight \(a\) shifts the old set of reachable indices by \(a\). The update is

\[ B_{\mathrm{new}}=B\lor(B\ll a). \]

Truncate indices above the target \(W\). Starting from bit zero and using weights \(3,5\), the successive reachable sets are \(\{0,3\}\) and \(\{0,3,5,8\}\). This computes subset sum with unchanged semantics because the shift refers to the old state.

A word boundary still needs work

For words of \(w\) bits, a non-word-aligned shift combines adjacent source words. The quotient and remainder of \(a\) by \(w\) specify the source word displacement and within-word shift. The all-word pass costs \(O(\lceil(W+1)/w\rceil)\) under the word-RAM model. Read the shifted sources before overwriting them. Padding bits in the final word should be masked so a later population count or witness scan cannot mistake them for legal states.[1][2]

References

  1. Jeff Erickson, Algorithms ↩
  2. MIT OpenCourseWare, Design and Analysis of Algorithms: Lecture Notes ↩