Selecting flagged records by sorting #
Sorting a one-bit flag in decreasing order moves all flagged records to the front while preserving complete records. A requested number of flagged records can therefore be selected by fixed output wires, with no prefix counter. This is the selection primitive for a halving scheduler phase.
First bit of a record; remaining bits are carried as payload.
Equations
- Algebraic.MassProduction.Nonuniform.FlagSelection.flag input record = input (finProdFinEquiv (record, ⟨0, ⋯⟩))
Instances For
Sort by the first bit with flagged records first.
Equations
- Algebraic.MassProduction.Nonuniform.FlagSelection.circuit depth payloadWidth = Algebraic.MassProduction.Sorting.bitonicSortCircuit ⋯ depth false
Instances For
Flag selection is exactly one bitonic sort.
The one-bit key order is the ordinary order on Boolean flags.
The concrete sort puts true flags before false flags.
Sorting preserves the number of flagged records exactly.
In a decreasing Boolean sequence, every position below the count of true entries is true.
Fixed prefix positions select any requested number of available flagged records. The actual complete records are preserved by the sorting network.
Complete records, including request identifiers, survive selection sorting.
If some record is flagged, the first output is a complete flagged input record. Thus a flag sort also selects one successful candidate block.
Flag sorting costs at most forty-eight gates per record bit per squared network depth. Its key width is one even for a large carried payload.