root/library/tests/stresssuite/particle_stress.cpp @ 742

Revision 722, 0.8 kB (checked in by mido, 15 years ago)

astyler run over all test sources
general_suite added
cleanup of \test directory finished

Line 
1#include <estim/particles.h>
2#include <math/square_mat.h>
3#include "stat/exp_family.h"
4#include "../mat_checks.h"
5
6using namespace bdm;
7
8//These lines are needed for use of cout and endl
9using std::cout;
10using std::endl;
11
12TEST ( particle_stress ) {
13        RV x ( "1" );
14        RV xm = x;
15        xm.t_plus ( -1 );
16        const
17        RV y ( "2" );
18
19        mat A = "1";
20        vec vR = "1";
21        ldmat R ( vR );
22
23        eEmp emp;
24        euni eun;
25        eun.set_parameters ( "0", "1" );
26        emp.set_statistics ( ones ( 10 ), eun );
27        vec &v = emp._w();
28        Array<vec> &S = emp._samples();
29
30        for ( int i = 0; i < 10; i++ ) {
31                v ( i ) = exp ( -0.5 * sum ( pow ( S ( i ) - 1, 2.0 ) ) * 10 );
32        }
33        v /= sum ( v );
34
35        cout << "p:" << S << endl;
36        cout << "w:" << v << endl;
37
38        ivec ind;
39        emp.resample ( ind );
40
41        cout << ind << endl;
42}
Note: See TracBrowser for help on using the browser.