root/library/tests/stresssuite/resample_stress.cpp @ 1064

Revision 1064, 0.8 kB (checked in by mido, 14 years ago)

astyle applied all over the library

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