pmuens/pybra12

bit_decomp

Opened this issue · 0 comments

I think the bit_decomp should be:

def bit_decomp(vector, q):
    l = ceil(log2(q))
    result = []
    for elem in vector:
        elem = elem % q
        for i in range(l):
            result.append((elem // 2 ** i) % 2)
    return np.array(result)

The old version can be wrong if there is any elem in the vector is larger than the modulus q