Row-wise L2 (sphere) normalization
Arguments
- m
Numeric matrix
Examples
m <- matrix(c(3, 4, 0,
0, 0, 0,
1, 1, 1), nrow = 3, byrow = TRUE)
normalize_networks(m) # rows have unit length; the zero row is unchanged
#> [,1] [,2] [,3]
#> [1,] 0.6000000 0.8000000 0.0000000
#> [2,] 0.0000000 0.0000000 0.0000000
#> [3,] 0.5773503 0.5773503 0.5773503