Skip to content

Instantly share code, notes, and snippets.

@tinybike
Created March 17, 2015 20:23
Show Gist options
  • Save tinybike/c65a3913d57fef428265 to your computer and use it in GitHub Desktop.
Save tinybike/c65a3913d57fef428265 to your computer and use it in GitHub Desktop.
centering matrix
centering(n::Int) = eye(n) - ones(n) * ones(n)' / n
centering{T<:Real}(n::Int, w::Vector{T}) = eye(n) - ones(n) * w'
normalize{T<:Real}(v::Vector{T}) = vec(v) / sum(v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment