Revision 384, 0.7 kB
(checked in by mido, 16 years ago)
|
possibly broken?
|
-
Property svn:eol-style set to
native
|
Rev | Line | |
---|
[262] | 1 | |
---|
[384] | 2 | #include "estim/particles.h" |
---|
| 3 | #include "math/square_mat.h" |
---|
| 4 | #include "stat/exp_family.h" |
---|
[32] | 5 | |
---|
[254] | 6 | using namespace bdm; |
---|
[32] | 7 | |
---|
| 8 | //These lines are needed for use of cout and endl |
---|
| 9 | using std::cout; |
---|
| 10 | using std::endl; |
---|
| 11 | |
---|
| 12 | int main() { |
---|
| 13 | |
---|
| 14 | RV x("1"); |
---|
| 15 | RV xm=x; xm.t(-1);const |
---|
| 16 | RV y("2"); |
---|
| 17 | |
---|
| 18 | mat A = "1"; |
---|
| 19 | vec vR = "1"; |
---|
| 20 | ldmat R(vR); |
---|
| 21 | |
---|
[270] | 22 | eEmp emp; |
---|
| 23 | euni eun; |
---|
[32] | 24 | eun.set_parameters("0","1"); |
---|
[283] | 25 | emp.set_statistics(ones(10),&eun); |
---|
[32] | 26 | vec &v=emp._w(); |
---|
| 27 | Array<vec> &S=emp._samples(); |
---|
| 28 | |
---|
| 29 | for (int i=0;i<10;i++){ v(i) = exp(-0.5*sum(pow(S(i)-1,2.0))*10);} |
---|
| 30 | v/=sum(v); |
---|
| 31 | |
---|
| 32 | cout << "p:" << S << endl; |
---|
| 33 | cout << "w:" << v << endl; |
---|
| 34 | |
---|
| 35 | ivec ind = emp.resample(); |
---|
| 36 | |
---|
| 37 | cout << ind << endl; |
---|
| 38 | |
---|
| 39 | //Exit program: |
---|
| 40 | return 0; |
---|
| 41 | |
---|
| 42 | } |
---|