added PCA in-place as well as reallocate