0

I have a collection of $N$ linearly independent vectors $\mathbf{v}_i$ over the field $\mathbb{Z}_2$. So the entries of the vectors are in {0,1}. I want to find a set of vectors which span the same space as $\mathbf{v}_i$, but have as few nonzero elements as possible. For example, if the vectors are (1,1,0) and (0,1,0), the desired result would be (1,0,0) and (0,1,0). What is a method to accomplish this, and will the resulting set be unique? In other words, can there be more than one solution?

I first thought of Gram-Schmidt, but it appears that inner products are not defined over finite fields: Inner Product Spaces over Finite Fields

I have an approach, but will it always find the minimal set? How would I prove it? Is there a better/faster approach? Does this type of problem have a name?

v = the list of N linearly independent vectors, and v[i] is the ith vector

for i in 1,2,3,...N:

CONTINUE_SEARCH=True
while CONTINUE_SEARCH:
    u = vector in {v excluding v[i]} such that u + v[i] would have the 
    fewest nonzero elements and would also lower the number of nonzero 
    elements compared to v[i]. If there is more than one answer for u, 
    choose the first.

    if u exists:
        v[i] = v[i] + u, (elementwise addition mod 2)
    else:
        CONTINUE_SEARCH=FALSE

  • 1
    I very much doubt there is an efficient algorithm for this. Coding theorists have proved, for example, that the problem of deciding whether the subspace spanned by your $N$ vectors has any vectors with at most $d$ non-zero elements, is NP-hard (or some such nasty complexity category). – Jyrki Lahtonen Jul 10 '23 at 04:13
  • 1
    And it is easy to cook up examples where there are many solutions. For example the extended Hamming code is a 4-dimensional subspace of $\Bbb{F}_2^8$. With the exception of $(1,1,1,1,1,1,1,1)$ all the other non-zero vectors have exactly four ones. So any basis avoiding that all ones -vector is a solution. – Jyrki Lahtonen Jul 10 '23 at 04:16

1 Answers1

1

your approach seems reasonable but it doesn't guarantee finding the minimal set in every scenario. Depending on the order of vectors and choices, you may end up with a set that has more nonzero elements than the minimal set. I think a more efficient method would be to row reduce sparse matrices. It's quite doable in c++