quick.norm: normalization function

Description Usage Arguments Value Author(s) Examples

View source: R/quick.norm.R

Description

it is normalizing each row to have L2 norm as 1 or sum as 1

Usage

1
quick.norm(A, mod = 2)

Arguments

A

Input matrix, n by p

mod

1: make each row has L2 norm as 1 2: make each row has sum as 1

Value

A normalized n by p matrix will be returned

Author(s)

Jungsuk Kwac

Examples

1
2
quick.norm(matrix(rnorm(9),3,3))
quick.norm(matrix(rnorm(9),3,3),mod=1)

Example output

          [,1]       [,2]       [,3]
[1,] 0.3758979  0.5839980 0.04010409
[2,] 0.1057080 -0.2582882 1.15258025
[3,] 1.5126032 -0.9210039 0.40840067
            [,1]       [,2]        [,3]
[1,] -0.09738523  0.9922044  0.07775985
[2,] -0.04305002 -0.9435034 -0.32855441
[3,] -0.14657480  0.3770570 -0.91451838

akmeans documentation built on May 2, 2019, 2:40 a.m.