Revision 384, 1.1 kB
(checked in by mido, 16 years ago)
|
possibly broken?
|
-
Property svn:eol-style set to
native
|
Rev | Line | |
---|
[262] | 1 | |
---|
[384] | 2 | #include "stat/exp_family.h" |
---|
| 3 | #include "stat/merger.h" |
---|
[163] | 4 | |
---|
[254] | 5 | using namespace bdm; |
---|
[163] | 6 | |
---|
| 7 | //These lines are needed for use of cout and endl |
---|
| 8 | using std::cout; |
---|
| 9 | using std::endl; |
---|
| 10 | |
---|
| 11 | int main() { |
---|
| 12 | |
---|
[198] | 13 | RNG_randomize(); |
---|
[270] | 14 | |
---|
[176] | 15 | RV x ( "{x }","1" ); |
---|
[163] | 16 | |
---|
[270] | 17 | RV z ( x ); |
---|
[163] | 18 | |
---|
[270] | 19 | enorm<fsqmat> f1; f1.set_rv ( x ); |
---|
| 20 | enorm<fsqmat> f2; f2.set_rv ( x ); |
---|
| 21 | |
---|
[176] | 22 | f1.set_parameters ( "-5",mat ( "2" ) ); |
---|
| 23 | f2.set_parameters ( "5",mat ( "10" ) ); |
---|
[163] | 24 | |
---|
[176] | 25 | Array<mpdf* > A ( 2 ); |
---|
[270] | 26 | mepdf A1 ( &f1 ); |
---|
| 27 | mepdf A2 ( &f2 ); |
---|
[180] | 28 | A ( 0 ) =&A1; |
---|
| 29 | A ( 1 ) =&A2; |
---|
[270] | 30 | |
---|
[176] | 31 | int Npoints=100; |
---|
| 32 | mat x_grid ( 1,Npoints ); |
---|
| 33 | x_grid.set_row ( 0,linspace ( -10.0, 10.0 ) ); |
---|
| 34 | |
---|
[211] | 35 | vec l_f1=f1.evallog_m ( x_grid ); |
---|
| 36 | vec l_f2=f2.evallog_m ( x_grid ); |
---|
[270] | 37 | mat lW ( 2,Npoints ); |
---|
| 38 | lW.set_row ( 0, l_f1 ); |
---|
| 39 | lW.set_row ( 1, l_f2 ); |
---|
[176] | 40 | |
---|
[384] | 41 | merger_base M ( A ); |
---|
[270] | 42 | enorm<fsqmat> g0; g0.set_rv ( x ); |
---|
| 43 | g0.set_parameters ( vec ( "0.0" ),mat ( "100.0" ) ); |
---|
| 44 | |
---|
[384] | 45 | M.set_method ( LOGNORMAL, 1.2 ); |
---|
| 46 | M.set_support(g0,200); |
---|
| 47 | M.merge (); |
---|
[270] | 48 | |
---|
[384] | 49 | vec m2 = M.merge_points ( lW ); |
---|
| 50 | // vec mm2 = M.evallog_m ( x_grid ); |
---|
[270] | 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; |
---|
[384] | 57 | // it << Name ( "mm2" ) << mm2; |
---|
[163] | 58 | } |
---|