calculating sparseness