normalize function

Normalization rows or columns of a matrix

Normalization rows or columns of a matrix

normalize( X, dim = 1, weights = if (dim == 1) 1/sqrt(rowSums(X^2)) else 1/sqrt(colSums(X^2)) )

Arguments

  • X: matrix with numeric values
  • dim: which dimension to normalize (1 for rows, 2 for columns)
  • weights: vector with normalization weights, by default 2-norm is used
  • Maintainer: Sergey Kucheryavskiy
  • License: MIT + file LICENSE
  • Last published: 2023-08-12