normalize: Normalization rows or columns of a matrix
Description
Normalization rows or columns of a matrix
Usage
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