Revision 477, 1.2 kB
(checked in by mido, 15 years ago)
|
panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc
|
-
Property svn:eol-style set to
native
|
Rev | Line | |
---|
[262] | 1 | |
---|
[386] | 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 | |
---|
[477] | 15 | RV x ( "{x }", "1" ); |
---|
[163] | 16 | |
---|
[270] | 17 | RV z ( x ); |
---|
[163] | 18 | |
---|
[477] | 19 | enorm<fsqmat> f1; |
---|
| 20 | f1.set_rv ( x ); |
---|
| 21 | enorm<fsqmat> f2; |
---|
| 22 | f2.set_rv ( x ); |
---|
[270] | 23 | |
---|
[477] | 24 | f1.set_parameters ( "-5", mat ( "2" ) ); |
---|
| 25 | f2.set_parameters ( "5", mat ( "10" ) ); |
---|
[163] | 26 | |
---|
[176] | 27 | Array<mpdf* > A ( 2 ); |
---|
[270] | 28 | mepdf A1 ( &f1 ); |
---|
| 29 | mepdf A2 ( &f2 ); |
---|
[477] | 30 | A ( 0 ) = &A1; |
---|
| 31 | A ( 1 ) = &A2; |
---|
[270] | 32 | |
---|
[477] | 33 | int Npoints = 100; |
---|
| 34 | mat x_grid ( 1, Npoints ); |
---|
| 35 | x_grid.set_row ( 0, linspace ( -10.0, 10.0 ) ); |
---|
[176] | 36 | |
---|
[477] | 37 | vec l_f1 = f1.evallog_m ( x_grid ); |
---|
| 38 | vec l_f2 = f2.evallog_m ( x_grid ); |
---|
| 39 | mat lW ( 2, Npoints ); |
---|
[270] | 40 | lW.set_row ( 0, l_f1 ); |
---|
| 41 | lW.set_row ( 1, l_f2 ); |
---|
[176] | 42 | |
---|
[386] | 43 | merger_base M ( A ); |
---|
[477] | 44 | enorm<fsqmat> g0; |
---|
| 45 | g0.set_rv ( x ); |
---|
| 46 | g0.set_parameters ( vec ( "0.0" ), mat ( "100.0" ) ); |
---|
[270] | 47 | |
---|
[477] | 48 | M.set_method ( LOGNORMAL, 1.2 ); |
---|
| 49 | M.set_support ( g0, 200 ); |
---|
[386] | 50 | M.merge (); |
---|
[270] | 51 | |
---|
[386] | 52 | vec m2 = M.merge_points ( lW ); |
---|
| 53 | // vec mm2 = M.evallog_m ( x_grid ); |
---|
[270] | 54 | |
---|
| 55 | it_file it ( "merger_test.it" ); |
---|
| 56 | it << Name ( "x_grid" ) << x_grid; |
---|
| 57 | it << Name ( "lf1" ) << l_f1; |
---|
| 58 | it << Name ( "lf2" ) << l_f2; |
---|
| 59 | it << Name ( "m2" ) << m2; |
---|
[386] | 60 | // it << Name ( "mm2" ) << mm2; |
---|
[163] | 61 | } |
---|