Changeset 32 for tests/testPF.cpp

Show
Ignore:
Timestamp:
03/03/08 13:00:32 (16 years ago)
Author:
smidl
Message:

test KF : estimation of R in KF is not possible! Likelihood of y_t is growing when R -> 0

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • tests/testPF.cpp

    r19 r32  
    1313 
    1414        RV x("1"); 
    15         RV xm=x; xm.t(-1); 
     15        RV xm=x; xm.t(-1);const 
    1616        RV y("2"); 
    1717         
     
    1919        vec vR = "1"; 
    2020        ldmat R(vR); 
     21                 
     22        eEmp emp(x,10); 
     23        euni eun(x); 
     24        eun.set_parameters("0","1"); 
     25        emp.set_parameters(ones(10),&eun); 
     26        vec &v=emp._w(); 
     27        Array<vec> &S=emp._samples(); 
    2128         
     29        for (int i=0;i<10;i++){ v(i) = exp(-0.5*sum(pow(S(i)-1,2.0))*10);} 
     30        v/=sum(v); 
    2231         
    23         vec ptc = randn(10); 
    24         vec w = exp(-0.5*(pow(ptc,2))/0.2); 
     32        cout << "p:" << S << endl; 
     33        cout << "w:" << v << endl; 
    2534         
    26         cout << "p:" << ptc << endl; 
    27         cout << "w:" << w << endl; 
    28          
    29         PF pf(w); 
    30         ivec ind = pf.resample(); 
     35        ivec ind = emp.resample(); 
    3136         
    3237        cout << ind << endl; 
    33         /* 
    34         mlnorm<ldmat> obs(x,xm,A,R); 
    35         mlnorm<ldmat> par(y,x,A,R); 
    3638         
    37         TrivialPF TPF(obs,par,10); 
    38         */ 
    3939        //Exit program: 
    4040        return 0;