sparsity calculations