Revision 177, 1.0 kB
(checked in by smidl, 16 years ago)
|
Simple merger test
|
Line | |
---|
1 | #include <itpp/itbase.h> |
---|
2 | #include <stat/libEF.h> |
---|
3 | #include <estim/merger.h> |
---|
4 | |
---|
5 | using namespace itpp; |
---|
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 | RV x ( "{x }","1" ); |
---|
14 | |
---|
15 | enorm<fsqmat> f1 ( x ); |
---|
16 | enorm<fsqmat> f2 ( x ); |
---|
17 | |
---|
18 | f1.set_parameters ( "-5",mat ( "2" ) ); |
---|
19 | f2.set_parameters ( "5",mat ( "10" ) ); |
---|
20 | |
---|
21 | Array<mpdf* > A ( 2 ); |
---|
22 | A ( 0 ) =&mepdf(f1); |
---|
23 | A ( 1 ) =&mepdf(f2); |
---|
24 | |
---|
25 | int Npoints=100; |
---|
26 | mat x_grid ( 1,Npoints ); |
---|
27 | x_grid.set_row ( 0,linspace ( -10.0, 10.0 ) ); |
---|
28 | |
---|
29 | vec l_f1=f1.evalpdflog_m ( x_grid ); |
---|
30 | |
---|
31 | vec l_f2=f2.evalpdflog_m ( x_grid ); |
---|
32 | mat lW(2,Npoints); |
---|
33 | lW.set_row(0, l_f1); |
---|
34 | lW.set_row(1, l_f2 ); |
---|
35 | |
---|
36 | merger M ( A ); |
---|
37 | vec m2 = M.lognorm_merge(lW); |
---|
38 | M.set_parameters(31.0/30.0,10,100); |
---|
39 | vec m1 = M.lognorm_merge(lW); |
---|
40 | M.set_parameters(3.0,10,100); |
---|
41 | vec m3 = M.lognorm_merge(lW); |
---|
42 | |
---|
43 | |
---|
44 | it_file it("merger_test.it"); |
---|
45 | it << Name("lf1") << l_f1; |
---|
46 | it << Name("lf2") << l_f2; |
---|
47 | it << Name("m1") << m1; |
---|
48 | it << Name("m2") << m2; |
---|
49 | it << Name("m3") << m3; |
---|
50 | } |
---|