修订版 | 20 (tree) |
---|---|
时间 | 2010-05-12 20:47:03 |
作者 | (del#42041) |
implemented test codes more
@@ -84,6 +84,25 @@ | ||
84 | 84 | a.compute_likelihood(); |
85 | 85 | a.resampling(); |
86 | 86 | cut_assert_equal_string("(0.153025,-1.168815,1.558071)(0.153025,-1.168815,1.558071)(0.153025,-1.168815,1.558071)(0.153025,-1.168815,1.558071)(0.153025,-1.168815,1.558071)",a.predict_particles_toString().c_str()); |
87 | + | |
88 | + // step 2 | |
89 | + | |
90 | + a.create_system_noise(); | |
91 | + a.get_next_state(); | |
92 | + cut_assert_equal_string("(0.563190,-0.597547,-1.199891)(1.229306,-1.782948,3.388836)(-0.993781,-1.114977,-0.949410)(-0.438624,-0.310210,1.330129)(0.354340,-0.818760,2.094123)",a.predict_particles_toString().c_str()); | |
93 | + x[0]=0.2; x[1]=-1.0; x[2]=1.5; | |
94 | + for(int i=0;i<y.size();++i) | |
95 | + { | |
96 | + y[i] = x; | |
97 | + } | |
98 | + a.set_observed_data(y); | |
99 | + cut_assert_equal_double(-0.36319,1e-4,a.get_observed_noise(0)); | |
100 | + a.set_robserve_density_func(func4); | |
101 | + cut_assert_equal_double(1.14882e-24,1e-5,a.get_robserved_density_value(-1.06308)); | |
102 | + a.compute_likelihood(); | |
103 | + a.resampling(); | |
104 | + cut_assert_equal_string("(0.563190,-0.597547,-1.199891)(0.563190,-0.597547,-1.199891)(0.563190,-0.597547,-1.199891)(0.563190,-0.597547,-1.199891)(0.563190,-0.597547,-1.199891)",a.predict_particles_toString().c_str()); | |
105 | + | |
87 | 106 | } |
88 | 107 | } |
89 | 108 | int main() |