normalize: normalize

View source: R/utils.R

normalizeR Documentation

normalize

Description

Normalize a vector or a matrix (by columns), using euclidian norm

Usage

normalize(x)

Arguments

x

Vector or matrix to be normalized

Value

The normalized matrix (1 column if x is a vector)

Examples

x <- matrix(c(1,2,-1,3), ncol=2)
normalize(x) #column 1 is 1/sqrt(5) (1 2),
             #and column 2 is 1/sqrt(10) (-1, 3)

morpheus documentation built on Feb. 16, 2023, 10:01 p.m.