Functions and tests to store sparse vectors