PCA originally formulated to use eigendecomposition, but we can use SVD instead.
a = rand(4, 3);
a = a - mean(a);
[U, S, V_svd] = svd(a);
[V_eig, D, W ]= eig(a * a');
% a == U * S * V_svd'% a * a' == U * S * V_svd' * V_svd * S' * U'% V_eig == W% S.^2 == D (subject to the different ordering of eigenvalues)
public/the_equivalence_of_svd_and_eigendecomposition.txt · Last modified: 2019/06/04 12:39 by fangfufu