Skip to main content
. Author manuscript; available in PMC: 2018 May 11.
Published in final edited form as: Proc ExploreDB17 (2017). 2017 May;2017:6. doi: 10.1145/3077331.3077336

Algorithm 1: Quantization

Input: BSI A, int p
Output: BSI S
1 BitSlice penalty = (A[A.size – 2] XOR A.sign);
2 for (i = A.size – 2;i >= 0;i − −) do
3 penalty = (penalty OR (A[sSize] XOR A.sign));
4 if penalty.count() >= np then
5   sSize = i;
6   break;
7 end
8 end
9 BSI S = new BSI(sSize);
10 for (i = 0; i < sSize; i++) do
11 S[i] = (A[i] XOR A.sign);
12 end
13 S.addSlice(penalty);
14 return S