Skip to content

Instantly share code, notes, and snippets.

@seaslee
Created December 4, 2012 01:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seaslee/4199822 to your computer and use it in GitHub Desktop.
Save seaslee/4199822 to your computer and use it in GitHub Desktop.
A fast and easy way to normalize the matrix
X = X./( ones(size(X)) * diag(sum(abs(X))) ); %L1-normalization
X = X./( ones(size(X)) * sqrt(diag(diag(X'*X))) ); %L2-normalization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment