normalize: Normalize

Description Usage Arguments See Also Examples

Description

Normalizes a vector by its euclidean norm

Usage

1

Arguments

x

numeric vector (or one-dimension matrix)

See Also

vnorm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# vector
v = rep(1, 5)

# normalize of v
normalize(v)

# test it (norm = 1)
vnorm(normalize(v))

# matrix
m = matrix(rnorm(12), 4, 3)
apply(m, 2, normalize)

gastonstat/matrixkit documentation built on May 16, 2019, 5:45 p.m.