calculateSparsity function

Calculate sparsity across the feature mode of a multi-way array.