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

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

astyle applied all over the library

RevLine 
[717]1#include <estim/particles.h>
2#include <math/square_mat.h>
3#include "stat/exp_family.h"
[721]4#include "../mat_checks.h"
[717]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 ( particle_stress ) {
[1064]13    RV x ( "1" );
14    RV xm = x;
15    xm.t_plus ( -1 );
16    const
17    RV y ( "2" );
[717]18
[1064]19    mat A = "1";
20    vec vR = "1";
21    ldmat R ( vR );
[717]22
[1064]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();
[717]29
[1064]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 );
[717]34
[1064]35    cout << "p:" << S << endl;
36    cout << "w:" << v << endl;
[717]37
[1064]38    ivec ind;
39    resample ( v, ind );
[717]40
[1064]41    cout << ind << endl;
[717]42}
Note: See TracBrowser for help on using the browser.