hi every one.I want to calculate the sparsity of data by HTM spatial pooler algorithm (I mean, I want to calculate the input sparsity rate as well as the output sparsity rate of the algorithm and then get the input sparsity ratio to output). For this purpose, I used the number of non-zero sparsity. I also found that the Gini index is also suitable for calculating sparsity, So I decided to use this index to calculate the sparsity of the spatial pooler algorithm. in the Gini index , we have to arrange the vector input / output numbers in order from small to large according to the following formula

But we know that the output of the spatial pooler algorithm is a vector of 0 and 1.How do I calculate the Gini index?Is this possible?

Please introduce another suitable information theory index for calculating sparsity