Revision 211, 1.1 kB
(checked in by smidl, 16 years ago)
|
prejmenovani evalpdflog a evalcond
|
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 | RNG_randomize(); |
---|
14 | |
---|
15 | RV x ( "{x }","1" ); |
---|
16 | |
---|
17 | RV z(x); |
---|
18 | |
---|
19 | enorm<fsqmat> f1 ( x ); |
---|
20 | enorm<fsqmat> f2 ( 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 | |
---|
37 | vec l_f2=f2.evallog_m ( x_grid ); |
---|
38 | mat lW(2,Npoints); |
---|
39 | lW.set_row(0, l_f1); |
---|
40 | lW.set_row(1, l_f2 ); |
---|
41 | |
---|
42 | merger M ( A ); |
---|
43 | enorm<fsqmat> g0(x); |
---|
44 | g0.set_parameters(vec("0.0"),mat("100.0")); |
---|
45 | |
---|
46 | M.set_parameters(1.2,200,3); |
---|
47 | M.merge(&g0); |
---|
48 | |
---|
49 | vec m2 = M.lognorm_merge(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 | } |
---|