Charged word-RAM histograms #
A fixed program clears a histogram and inserts the keys of a disjoint input array.
An insertion into a bucket of size c creates 2c ordered collisions. Every address
calculation, load, increment, store and loop test is charged.
Main definitions #
Histogram.count: bucket sizes in an input prefix.Histogram.pairs: ordered collisions accumulated by prefix insertion.Histogram.program: clear the buckets, then insert the input keys.
Main results #
Histogram.exec: histogram construction and collision counting with a linear instruction bound.
References #
The insertion counter counts exactly the ordered pairs of different positions with the same key, including when equal keys occur at different input positions.
Input base.
Instances For
Histogram base.
Instances For
Number of input keys.
Instances For
Number of buckets.
Instances For
Prefix length.
Instances For
Temporary address.
Instances For
Current key.
Instances For
Current bucket count.
Instances For
Number of ordered collisions.
Instances For
Constant one.
Instances For
Constant zero.
Instances For
Clear one histogram cell and advance the cursor.
Instances For
Insert one key and add twice its old bucket count.
Instances For
Clear the histogram, retaining the input and all four parameters.
Instances For
Insert all keys into a cleared histogram.
Instances For
Fixed code, with all bases and lengths supplied in registers.
Instances For
Build a histogram and count ordered collisions within 5M + 11n + 9 native instructions.
The input keys lie in [0,M). The input precedes the output block. Both one-past-end
addresses and the quadratic counter bound must fit. These are explicit local contracts;
constructing the keys and deriving a logarithmic width are separate client obligations.