When calculating Hamming weights in different points throughout the repo, the command get_nnz is called. Typically this is fine, but if the csr arrays used have undergone operations, they potentially contain extra entries, which will be overcounted.
eg:
from scipy.sparse import csr_matrix
a = csr_matrix([1, 1])
b = csr_matrix([0, 1])
c = a + b
c.data%= 2
print("getnnz weight:", b.getnnz())
print("Hamming weight:", (c != 0).sum())
returns:
getnnz weight: 2
Hamming weight: 1
When calculating Hamming weights in different points throughout the repo, the command
get_nnzis called. Typically this is fine, but if the csr arrays used have undergone operations, they potentially contain extra entries, which will be overcounted.eg:
returns: