normalize {cwhmath}R Documentation

Normalize vectors

Description

Normalize the columns of a matrix.

Usage

  normalize(x)

Arguments

x the matrix containing the vectors to be normalized as columns.

Value

The matrix containing the normalized vectors as columns. If you want to normalize the rows of a matrix, use t(normalize(t(x)))

Author(s)

Christian W. Hoffmann, christian.hoffmann@wsl.ch,
http://www.wsl.ch/staff/christian.hoffmann

Examples

  x <- matrix(rnorm(30),nrow=6)
  normalize(x)
  t(normalize(t(x)))  # normalize the *rows* of x

[Package cwhmath version 1.0.3 Index]