Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bit_decomp #1

Open
kcsmta opened this issue Feb 18, 2021 · 0 comments
Open

bit_decomp #1

kcsmta opened this issue Feb 18, 2021 · 0 comments

Comments

@kcsmta
Copy link

kcsmta commented Feb 18, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant