PCA.jl 195 Bytes
Newer Older
1
2
""" Performs PCA   PCA(W)"""
function PCA(W)
Fredrik Bagge Carlson's avatar
Fredrik Bagge Carlson committed
3
4
5
6
7
8
    W0 = mean(W,1);
    W = W-repmat(W0,size(W,1),1);
    (score,latent,C) = svd(W)
    score = score*diagm(latent)
    C,score,latent,W0
end