Show
Ignore:
Timestamp:
08/05/09 14:40:03 (15 years ago)
Author:
mido
Message:

panove, vite, jak jsem peclivej na upravu kodu.. snad se vam bude libit:) konfigurace je v souboru /system/astylerc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/merger_2d_test.cpp

    r386 r477  
    1414 
    1515        RNG_randomize(); 
    16          
    17         RV x ( "{x }","1" ); 
    18         RV y ( "{y }","1" ); 
    1916 
    20         RV xy=x; xy.add(y); 
    21          
    22         enorm<fsqmat> f1; f1.set_rv ( xy ); 
    23         enorm<fsqmat> f2; f1.set_rv ( xy ); 
    24                  
     17        RV x ( "{x }", "1" ); 
     18        RV y ( "{y }", "1" ); 
     19 
     20        RV xy = x; 
     21        xy.add ( y ); 
     22 
     23        enorm<fsqmat> f1; 
     24        f1.set_rv ( xy ); 
     25        enorm<fsqmat> f2; 
     26        f1.set_rv ( xy ); 
     27 
    2528        mat R1 ( "0.5 0.48; 0.48 0.5" ); 
    2629        mat R2 ( "0.5 0; 0 0.1" ); 
    27         f1.set_parameters ( "1 1", R1); 
    28         f2.set_parameters ( "1 1",mat ( "0.5 0; 0 0.1" ) ); 
    29          
     30        f1.set_parameters ( "1 1", R1 ); 
     31        f2.set_parameters ( "1 1", mat ( "0.5 0; 0 0.1" ) ); 
     32 
    3033        Array<mpdf* > A ( 2 ); 
    31         mepdf A1(&f1); 
    32         mepdf A2(&f2); 
    33         A ( 0 ) =&A1; 
    34         A ( 1 ) =&A2; 
    35          
    36         int Npoints=100; 
    37         mat x_grid(1,Npoints); 
    38         x_grid.set_row(0,linspace ( -2.0, 4.0, Npoints )); 
    39         mat y_grid(1,Npoints); 
    40         y_grid.set_row(0,linspace ( -2.0, 4.0, Npoints )); 
    41          
    42         mat Grid (2,Npoints*Npoints); 
    43         Grid.set_submatrix ( 0,0, kron(x_grid,ones(1,Npoints)) ); 
    44         Grid.set_submatrix ( 1,0, kron(ones(1,Npoints), y_grid) ); 
    45          
     34        mepdf A1 ( &f1 ); 
     35        mepdf A2 ( &f2 ); 
     36        A ( 0 ) = &A1; 
     37        A ( 1 ) = &A2; 
     38 
     39        int Npoints = 100; 
     40        mat x_grid ( 1, Npoints ); 
     41        x_grid.set_row ( 0, linspace ( -2.0, 4.0, Npoints ) ); 
     42        mat y_grid ( 1, Npoints ); 
     43        y_grid.set_row ( 0, linspace ( -2.0, 4.0, Npoints ) ); 
     44 
     45        mat Grid ( 2, Npoints*Npoints ); 
     46        Grid.set_submatrix ( 0, 0, kron ( x_grid, ones ( 1, Npoints ) ) ); 
     47        Grid.set_submatrix ( 1, 0, kron ( ones ( 1, Npoints ), y_grid ) ); 
     48 
    4649        merger_mix M ( A ); 
    47         enorm<fsqmat> g0; g0.set_rv(xy); 
    48         g0.set_parameters(vec("1 1"),mat("10 0; 0 10")); 
    49          
    50         M.set_parameters(1); 
    51         M.set_method(LOGNORMAL,1e8); 
    52         M.set_support(g0,400); 
     50        enorm<fsqmat> g0; 
     51        g0.set_rv ( xy ); 
     52        g0.set_parameters ( vec ( "1 1" ), mat ( "10 0; 0 10" ) ); 
     53 
     54        M.set_parameters ( 1 ); 
     55        M.set_method ( LOGNORMAL, 1e8 ); 
     56        M.set_support ( g0, 400 ); 
    5357        M.merge(); 
    54          
     58 
    5559        MixEF &MM = M._Mix(); 
    5660        emix* MP = MM.epredictor(); //xy 
    57          
    58         vec Res1 = M.evallog_m(Grid); 
    59         mat Res2 = (MP)->evallog_M(Grid); 
    60          
    61         it_file it("merger_2d_test.it"); 
    62         it << Name("Npoints") << Npoints; 
    63         it << Name("Grid") << Grid; 
    64         it << Name("Res1") << Res1; 
    65         it << Name("Res2") << Res2; 
    66         it << Name("S1") << f1.evallog_m(Grid); 
    67         it << Name("S2") << f2.evallog_m(Grid); 
    68         cout << ((enorm<ldmat>*)(MP->_Coms(0)))->_R().to_mat() << endl; 
     61 
     62        vec Res1 = M.evallog_m ( Grid ); 
     63        mat Res2 = ( MP )->evallog_M ( Grid ); 
     64 
     65        it_file it ( "merger_2d_test.it" ); 
     66        it << Name ( "Npoints" ) << Npoints; 
     67        it << Name ( "Grid" ) << Grid; 
     68        it << Name ( "Res1" ) << Res1; 
     69        it << Name ( "Res2" ) << Res2; 
     70        it << Name ( "S1" ) << f1.evallog_m ( Grid ); 
     71        it << Name ( "S2" ) << f2.evallog_m ( Grid ); 
     72        cout << ( ( enorm<ldmat>* ) ( MP->_Coms ( 0 ) ) )->_R().to_mat() << endl; 
    6973}