Let's move that function to utils/sparse.hpp