root/library/tests/merger_test.cpp @ 426

Revision 386, 1.1 kB (checked in by mido, 15 years ago)

possibly broken? 4th part

  • Property svn:eol-style set to native
Line 
1
2#include "stat/exp_family.h"
3#include "stat/merger.h"
4
5using namespace bdm;
6
7//These lines are needed for use of cout and endl
8using std::cout;
9using std::endl;
10
11int main() {
12
13        RNG_randomize();
14
15        RV x ( "{x }","1" );
16
17        RV z ( x );
18
19        enorm<fsqmat> f1; f1.set_rv ( x );
20        enorm<fsqmat> f2; f2.set_rv ( x );
21
22        f1.set_parameters ( "-5",mat ( "2" ) );
23        f2.set_parameters ( "5",mat ( "10" ) );
24
25        Array<mpdf* > A ( 2 );
26        mepdf A1 ( &f1 );
27        mepdf A2 ( &f2 );
28        A ( 0 ) =&A1;
29        A ( 1 ) =&A2;
30
31        int Npoints=100;
32        mat x_grid ( 1,Npoints );
33        x_grid.set_row ( 0,linspace ( -10.0, 10.0 ) );
34
35        vec l_f1=f1.evallog_m ( x_grid );
36        vec l_f2=f2.evallog_m ( x_grid );
37        mat lW ( 2,Npoints );
38        lW.set_row ( 0, l_f1 );
39        lW.set_row ( 1, l_f2 );
40
41        merger_base M ( A );
42        enorm<fsqmat> g0; g0.set_rv ( x );
43        g0.set_parameters ( vec ( "0.0" ),mat ( "100.0" ) );
44
45        M.set_method (  LOGNORMAL, 1.2 );
46        M.set_support(g0,200);
47        M.merge ();
48
49        vec m2 = M.merge_points ( lW );
50//      vec mm2 = M.evallog_m ( x_grid );
51
52        it_file it ( "merger_test.it" );
53        it << Name ( "x_grid" ) << x_grid;
54        it << Name ( "lf1" ) << l_f1;
55        it << Name ( "lf2" ) << l_f2;
56        it << Name ( "m2" ) << m2;
57//      it << Name ( "mm2" ) << mm2;
58}
Note: See TracBrowser for help on using the browser.