pca copied from hmatrix example