if false $: << File.expand_path("../..",__FILE__) require 'pca.rb' describe "PCA" do it "should compress/decompress without failure if element is in training-set" do i=PCA::Input.new i<<[1,1,0] i<<[0,1,1] i<<[0,1,2] i<<[9,1,1] i<<[0,1,0] base=PCA::Base.new(i) ref=[1,1,0] c=base.compress(ref) r=base.decompress(c) (r-Linalg::DMatrix[ref]).norm.should < 0.1 end end end