#include #include #include using namespace itpp; //These lines are needed for use of cout and endl using std::cout; using std::endl; int main() { RNG_randomize(); RV x ( "{x }","1" ); RV y ( "{y }","1" ); RV xy=x; xy.add(y); enorm f1 ( xy ); enorm f2 ( xy ); enorm f3(y); f1.set_parameters ( "4 3",mat ( "0.4 0.3; 0.3 0.4" ) ); f2.set_parameters ( "1 3",mat ( "0.3 -0.2; -0.2 0.3" ) ); f3.set_parameters ( "2",mat("0.4") ); Array A ( 3 ); mepdf A1(f1); mepdf A2(f2); mepdf A3(f3); A ( 0 ) =&A1; A ( 1 ) =&A2; A ( 2 ) =&A3; int Npoints=100; mat x_grid(1,Npoints); x_grid.set_row(0,linspace ( -2.0, 4.0, Npoints )); mat y_grid(1,Npoints); y_grid.set_row(0,linspace ( -2.0, 4.0, Npoints )); mat Grid (2,Npoints*Npoints); Grid.set_submatrix ( 0,0, kron(x_grid,ones(1,Npoints)) ); Grid.set_submatrix ( 1,0, kron(ones(1,Npoints), y_grid) ); merger M ( A ); enorm g0(xy); g0.set_parameters(vec("4 4"),mat("1 0; 0 1")); M.set_parameters(1.2,400,5); M.merge(&g0); MixEF &MM = M._Mix(); epdf* MP = MM.predictor(xy); vec Res1 = M.evalpdflog_m(Grid); mat Res2 = ((emix*)MP)->evalpdflog_M(Grid); it_file it("merger_iter_test.it"); it << Name("Npoints") << Npoints; it << Name("Grid") << Grid; it << Name("Res1") << Res1; it << Name("Res2") << Res2; }