Skip to contents

This function assumes that if the CRPs are supplied in a 2D matrix, each row corresponds to a device and each column corresponds to a CRP.

Usage

uniformity(crps)

Arguments

crps

A bit vector or a 2D CRP matrix

Value

If crps is a vector, the normalized Hamming weight. If crps is a matrix, the normalized Hamming weight of each row.

Details

Uniformity measures the distribution of 1s and 0s across all CRPs for each device. To calculate uniformity, margin should be 1.

$$Uniformity(d) = \frac{1}{\#C} \sum_{r \in R_d} r$$

See also

Examples

## Uniformity of a vector
uniformity(rbits(50))
#> [1] 0.4

## Uniformity of a matrix
uniformity(rbits(c(10, 50)))
#>  [1] 0.52 0.60 0.40 0.50 0.40 0.48 0.52 0.56 0.60 0.62