Strict packed sketch ranks #
The zero-bit branch of arbitrary-query correction requires a strict rank. Subtracting the number of sketches at least the query from the node occupancy handles equality and zero queries directly.
Main definitions #
LowerRankProgram.query,LowerRankProgram.node,LowerRankProgram.copies,LowerRankProgram.guards,LowerRankProgram.bits,LowerRankProgram.middle,LowerRankProgram.base,LowerRankProgram.count,LowerRankProgram.temp,LowerRankProgram.out: register indices for strict sketch rank.LowerRankProgram.code,LowerRankProgram.result: eight standard instructions for strict sketch rank and the resulting machine state.
Main results #
LowerRankProgram.exec: checked execution returning the number of sketches below the query.
References #
The input register layout agrees with RankProgram, except register seven is occupancy
and register one contains the original sketches rather than their complements.
Packed guarded sketches.
Replication multiplier.
Mask of field guards.
Payload width.
Middle digit divisor.
Field radix.
Number of stored sketches.
Scratch for the replicated query.
Final strict rank.
Count guards for q ≤ sᵢ, then subtract the count from the occupancy.
Exact state after all eight instructions.
Eight checked instructions return the strict rank, including zero and equality queries. The node parameters and memory are preserved; query compression and constant loading are separate. The full guard-count product fits under the stated packed-width bound.