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
|
Line | |
---|
1 | |
---|
2 | #include "stat/exp_family.h" |
---|
3 | #include "stat/merger.h" |
---|
4 | |
---|
5 | using namespace bdm; |
---|
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 | |
---|
13 | RNG_randomize(); |
---|
14 | |
---|
15 | RV x ( "{x }", "1" ); |
---|
16 | |
---|
17 | RV z ( x ); |
---|
18 | |
---|
19 | enorm<fsqmat> f1; |
---|
20 | f1.set_rv ( x ); |
---|
21 | enorm<fsqmat> f2; |
---|
22 | f2.set_rv ( x ); |
---|
23 | |
---|
24 | f1.set_parameters ( "-5", mat ( "2" ) ); |
---|
25 | f2.set_parameters ( "5", mat ( "10" ) ); |
---|
26 | |
---|
27 | Array<mpdf* > A ( 2 ); |
---|
28 | mepdf A1 ( &f1 ); |
---|
29 | mepdf A2 ( &f2 ); |
---|
30 | A ( 0 ) = &A1; |
---|
31 | A ( 1 ) = &A2; |
---|
32 | |
---|
33 | int Npoints = 100; |
---|
34 | mat x_grid ( 1, Npoints ); |
---|
35 | x_grid.set_row ( 0, linspace ( -10.0, 10.0 ) ); |
---|
36 | |
---|
37 | vec l_f1 = f1.evallog_m ( x_grid ); |
---|
38 | vec l_f2 = f2.evallog_m ( x_grid ); |
---|
39 | mat lW ( 2, Npoints ); |
---|
40 | lW.set_row ( 0, l_f1 ); |
---|
41 | lW.set_row ( 1, l_f2 ); |
---|
42 | |
---|
43 | merger_base M ( A ); |
---|
44 | enorm<fsqmat> g0; |
---|
45 | g0.set_rv ( x ); |
---|
46 | g0.set_parameters ( vec ( "0.0" ), mat ( "100.0" ) ); |
---|
47 | |
---|
48 | M.set_method ( LOGNORMAL, 1.2 ); |
---|
49 | M.set_support ( g0, 200 ); |
---|
50 | M.merge (); |
---|
51 | |
---|
52 | vec m2 = M.merge_points ( lW ); |
---|
53 | // vec mm2 = M.evallog_m ( x_grid ); |
---|
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; |
---|
60 | // it << Name ( "mm2" ) << mm2; |
---|
61 | } |
---|