def test_pca(): """ Test of the multi-dimensional scaling algorithm """ X = randn(10,3) P = PCA(X, rdim=2) u = P.train() x = X[:2] a = P.test(x) eps = 1.e-12 test = np.sum(a-u[:2])**2<eps print a, u[:2] assert test