Skip to content

bit_decomp  #1

@kcsmta

Description

@kcsmta

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions