thread-safe sparse matrix data structure