fixes

all of the code should work now. I fixed k-means by experiment and the
errors in PCA by residue