• R/O
  • SSH
  • HTTPS

particle-filter: 提交


Commit MetaInfo

修订版21 (tree)
时间2010-05-13 20:59:33
作者(del#42041)

Log Message

started to createing samples

更改概述

差异

--- test/test_filter.cc (revision 20)
+++ test/test_filter.cc (revision 21)
@@ -57,6 +57,11 @@
5757 Filter a(0.0);
5858 a.setNumber(5);
5959 a.setDimension(3);
60+ a.set_state_func(&func1);
61+ a.set_robserve_func(&func2);
62+ a.set_robserve_jacobian_func(&func3);
63+ a.set_robserve_density_func(func4);
64+
6065 a.createInitialParticles();
6166 a.create_system_noise();
6267
@@ -63,13 +68,10 @@
6368 // initial value
6469 cut_assert_equal_string("(0.000000,0.000000,0.000000)(0.000000,0.000000,0.000000)(0.000000,0.000000,0.000000)(0.000000,0.000000,0.000000)(0.000000,0.000000,0.000000)",a.predict_particles_toString().c_str());
6570 cut_assert_equal_string("(1.163078,0.483805,0.299564)(0.153025,-1.168815,1.558071)(-0.545944,-2.355630,0.541440)(2.678507,1.254634,-0.548774)(-0.681064,-0.135316,0.377231)",a.system_noise_toString().c_str());
66- a.set_state_func(&func1);
6771 a.get_next_state();
6872
6973 // initial value+system noise
7074 cut_assert_equal_string("(1.163078,0.483805,0.299564)(0.153025,-1.168815,1.558071)(-0.545944,-2.355630,0.541440)(2.678507,1.254634,-0.548774)(-0.681064,-0.135316,0.377231)",a.predict_particles_toString().c_str());
71- a.set_robserve_func(&func2);
72- a.set_robserve_jacobian_func(&func3);
7375 Particles<double> y(5,3);
7476 Particle<double> x(3);
7577 x[0]=0.1; x[1]=-1.1; x[2]=1.5;
@@ -79,7 +81,6 @@
7981 }
8082 a.set_observed_data(y);
8183 cut_assert_equal_double(-1.06308,1e-4,a.get_observed_noise(0));
82- a.set_robserve_density_func(func4);
8384 cut_assert_equal_double(1.14882e-24,1e-5,a.get_robserved_density_value(-1.06308));
8485 a.compute_likelihood();
8586 a.resampling();
--- sample/step.cc (nonexistent)
+++ sample/step.cc (revision 21)
@@ -0,0 +1,15 @@
1+#include <MersenneTwister.h>
2+#include <filter.h>
3+int main()
4+{
5+ Filter track;
6+ MTRand mtrand;
7+ mtrand.seed(time(NULL));
8+ double y;
9+ for(int i=0;i<100;++i)
10+ {
11+ y = i<25?1:i<50?0:i<75?-1:1;
12+cout<<y<<endl;
13+
14+ }
15+}
\ No newline at end of file
--- sample/Makefile.in (nonexistent)
+++ sample/Makefile.in (revision 21)
@@ -0,0 +1,19 @@
1+CC=@CC@
2+CXX=@CXX@
3+SRCS=step.cc
4+OBJS=$(SRCS:.cc=.o)
5+HEADS=$(SRCS:.cc=.h)
6+TARGETS=$(SRCS:.cc=)
7+AR=@AR@
8+CFLAGS=-I. -g -Wall -I../src
9+LDFLAGS=-L../lib -lparticle
10+all: $(TARGETS)
11+
12+step: $(OBJS)
13+ $(CXX) -o $@ $@.o $(LDFLAGS)
14+
15+.cc.o: $(HEADS) $(SRCS)
16+ $(CXX) $(CFLAGS) -c $<
17+
18+clean:
19+ rm -f *.o *.a *~ *.lo *.la *.so
--- sample/Makefile (nonexistent)
+++ sample/Makefile (revision 21)
@@ -0,0 +1,19 @@
1+CC=gcc
2+CXX=g++
3+SRCS=step.cc
4+OBJS=$(SRCS:.cc=.o)
5+HEADS=$(SRCS:.cc=.h)
6+TARGETS=$(SRCS:.cc=)
7+AR=ar
8+CFLAGS=-I. -g -Wall -I../src
9+LDFLAGS=-L../lib -lparticle
10+all: $(TARGETS)
11+
12+step: $(OBJS)
13+ $(CXX) -o $@ $@.o $(LDFLAGS)
14+
15+.cc.o: $(HEADS) $(SRCS)
16+ $(CXX) $(CFLAGS) -c $<
17+
18+clean:
19+ rm -f *.o *.a *~ *.lo *.la *.so
--- Makefile.in (revision 20)
+++ Makefile.in (revision 21)
@@ -3,7 +3,14 @@
33 all:
44 cd src && $(MAKE)
55
6-.PHONY: test
6+install:
7+ cp src/libparticle.* lib/
8+
9+.PHONY: test sample
10+
11+sample:
12+ cd sample && $(MAKE)
13+
714 test:
815 cd test && $(MAKE)
916
--- configure.in (revision 20)
+++ configure.in (revision 21)
@@ -25,5 +25,5 @@
2525 AC_SUBST(CC)
2626 AC_SUBST(CXX)
2727 AC_SUBST(LDFLAGS)
28-AC_OUTPUT(Makefile src/Makefile test/Makefile)
28+AC_OUTPUT(Makefile src/Makefile test/Makefile sample/Makefile)
2929
Show on old repository browser