summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-11-11 16:30:58 +0100
committerAndreas Maunz <andreas@maunz.de>2011-11-11 16:30:58 +0100
commitadc053d9e5592039d7b53b08477b781419356750 (patch)
tree0666366a51261d33d9406a44dd8b728480f443d9
parent894f4d1cd146d37587040268550a481d5dea59b0 (diff)
Added PCR test
-rw-r--r--algorithm.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/algorithm.rb b/algorithm.rb
index 0e4ba50..fdc311c 100644
--- a/algorithm.rb
+++ b/algorithm.rb
@@ -105,6 +105,38 @@ class AlgorithmTest < Test::Unit::TestCase
assert_in_delta res1, 1.4958008960423, 10E-06
assert_equal res1, res2
end
+
+ def test_pcr
+ n_prop = [ [ -2.0, -2.0 ],
+ [ -1.0, -1.0 ],
+ [ 0.0, 0.0 ],
+ [ 1.0, 1.0 ],
+ [ 2.0, 2.0 ] ]
+
+ q_prop = [ 1.0, 1.0 ]
+
+ #acts = [ -2.0,
+ # -1.0,
+ # 0.0,
+ # 1.0,
+ # 2.0 ]
+
+ acts = [ 0.0,
+ 0.5,
+ 1.0,
+ 1.5,
+ 2.0 ]
+
+ maxcols = 2
+ res1 = OpenTox::Algorithm::Neighbors::pcr(:n_prop => n_prop, :q_prop => q_prop, :acts => acts, :maxcols => maxcols)
+ #puts res1
+ #maxcols = 1
+ #res2 = OpenTox::Algorithm::Neighbors::pcr(:n_prop => n_prop, :q_prop => q_prop, :acts => acts, :maxcols => maxcols)
+ #puts res2
+ assert_in_delta res1, 1.51255020120858, 10E-06
+ #assert_equal res1, res2
+ end
+
=begin