Changeset 933

Show
Ignore:
Timestamp:
05/11/10 16:25:24 (14 years ago)
Author:
smidl
Message:

bdmtoolbox updated for new loggers

Files:
11 modified

Legend:

Unmodified
Added
Removed
  • applications/bdmtoolbox/mex/my_isobj.cpp

    r925 r933  
    33 
    44void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { 
    5         printf("%d",mxIsObject(input[0])); 
     5        mxArray * m=(mxArray *)input[0]; 
     6        printf("%d",mxIsObject(m)); 
     7        mexCallMATLAB(0,0,1, &m, "validate"); 
     8         
    69} 
    710#endif 
  • applications/bdmtoolbox/tutorial/estimation/my_pdf.m

    r926 r933  
    88        end 
    99        function validate(p) 
    10             if size(mu,2)>1 
     10            if size(p.mu,2)>1 
    1111                error('mu must be scalar'); 
    1212            end 
  • applications/bdmtoolbox/tutorial/userguide/arx_basic_example.m

    r871 r933  
    1717%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    1818% plot results 
    19 ndat = size(M.DS_u,1); 
     19ndat = size(M.DS_dt_u,1); 
    2020 
    2121subplot(1,2,1); 
     
    2323plotestimates(true_theta, ... 
    2424    M.Est0_apost_mean_theta, ... 
    25     M.Est0_apost_lb_theta, ... 
    26     M.Est0_apost_ub_theta); 
     25    M.Est0_apost_lbound_theta, ... 
     26    M.Est0_apost_ubound_theta); 
    2727set(gca,'YLim',[-1.5,1]); 
    2828 
     
    3131plotestimates(true_R, ... 
    3232    M.Est0_apost_mean_r, ... 
    33     M.Est0_apost_lb_r, ... 
    34     M.Est0_apost_ub_r); 
     33    M.Est0_apost_lbound_r, ... 
     34    M.Est0_apost_ubound_r); 
    3535 
    3636title('Variance parameters r') 
  • applications/bdmtoolbox/tutorial/userguide/arx_ctrl_example.m

    r871 r933  
    3636figure; 
    3737subplot(2,1,1); 
    38 plot(M.DS_y); 
     38plot(M.DS_dt_y); 
    3939subplot(2,1,2); 
    4040hold off  
    41 plot(M.DS_u1); 
     41plot(M.DS_dt_u1); 
    4242hold on 
    43 plot(M.DS_u2); 
     43plot(M.DS_dt_u2); 
  • applications/bdmtoolbox/tutorial/userguide/arx_selection_example.m

    r871 r933  
    3030 
    3131%%%% Process results 
    32 lls = [sum(M.A1_ll_) sum(M.A2_ll_) sum(M.A3_ll_)] 
     32lls = [sum(M.A1_evidence_) sum(M.A2_evidence_) sum(M.A3_evidence_)] 
    3333 
    3434ells=exp(lls-max(lls)); 
  • applications/bdmtoolbox/tutorial/userguide/arx_windsurfer_example.m

    r871 r933  
    3434losses_wind =zeros(1,N); 
    3535 
    36 for i=1:1000 
     36for i=1:10 
    3737    M= controlloop(DS,{C1}); 
    38     losses_plain(i) = (M.DS_y - C1.yreq)'*(M.DS_y - C1.yreq); 
     38    losses_plain(i) = (M.DS_dt_y - C1.yreq)'*(M.DS_dt_y - C1.yreq); 
    3939 
    4040    M= controlloop(DS,{C2}); 
    41     losses_wind(i) = (M.DS_y - C1.yreq)'*(M.DS_y - C1.yreq); 
     41    losses_wind(i) = (M.DS_dt_y - C1.yreq)'*(M.DS_dt_y - C1.yreq); 
    4242    if losses_wind(i)>100 
    4343      %  keyboard; 
  • applications/bdmtoolbox/tutorial/userguide/dist_estim_example.m

    r871 r933  
    2727A1.rv = y; 
    2828A1.rgr = RVtimes([y,u1],[-3,0]) ; % correct structure is {y,y} 
    29 A1.options ='logbounds,logevidence'; 
     29A1.log_level ='logbounds,logevidence'; 
    3030A1.frg = 0.95; 
    3131A1.constant = 0; 
     
    3838%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    3939% plot results 
    40 ndat = size(M.DS_u1,1); 
     40ndat = size(M.DS_dt_u1,1); 
    4141 
    4242true_theta1 = fy.A([1,2]); 
     
    4646figure(1); 
    4747subplot(2,1,1); 
    48 plot(M.DS_y); 
     48plot(M.DS_dt_y); 
    4949title('Output'); 
    5050 
    5151subplot(2,1,2); 
    52 plot(M.DS_u1); 
     52plot(M.DS_dt_u1); 
    5353hold on 
    54 plot(M.DS_u2); 
     54plot(M.DS_dt_u2); 
    5555title('Input'); 
    5656 
     
    6262plotestimates(true_theta1, ... 
    6363    M.Est0_apost_mean_theta, ... 
    64     M.Est0_apost_lb_theta, ... 
    65     M.Est0_apost_ub_theta); 
     64    M.Est0_apost_lbound_theta, ... 
     65    M.Est0_apost_ubound_theta); 
    6666set(gca,'YLim',[-1.5,1]); 
    6767 
     
    7070plotestimates(true_R, ... 
    7171    M.Est0_apost_mean_r, ... 
    72     M.Est0_apost_lb_r, ... 
    73     M.Est0_apost_ub_r); 
     72    M.Est0_apost_lbound_r, ... 
     73    M.Est0_apost_ubound_r); 
    7474 
    7575title('Variance parameters r') 
     
    7979plotestimates(true_theta2, ... 
    8080    M.Est1_apost_mean_theta, ... 
    81     M.Est1_apost_lb_theta, ... 
    82     M.Est1_apost_ub_theta); 
     81    M.Est1_apost_lbound_theta, ... 
     82    M.Est1_apost_ubound_theta); 
    8383set(gca,'YLim',[-1.5,1]); 
    8484 
     
    8787plotestimates(true_R, ... 
    8888    M.Est1_apost_mean_r, ... 
    89     M.Est1_apost_lb_r, ... 
    90     M.Est1_apost_ub_r); 
     89    M.Est1_apost_lbound_r, ... 
     90    M.Est1_apost_ubound_r); 
    9191 
    9292title('Variance parameters r') 
  • applications/bdmtoolbox/tutorial/userguide/epdfds_example.m

    r706 r933  
    1212M=simulator(DS,experiment); 
    1313 
    14 M.DS_a 
     14M.DS_dt_a 
  • applications/bdmtoolbox/tutorial/userguide/particle_ARX.m

    r888 r933  
    4141PF.particle.parameter_pdf = fx; 
    4242PF.particle.observation_pdf = fy; 
    43 PF.log_level ={'bounds','likelihood,'}; 
     43PF.log_level ='logbounds,logevidence'; 
    4444PF.prior.class = 'egauss'; 
    4545PF.prior.mu = 0; 
     
    5454%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    5555% plot results 
    56 ndat = size(M.DS_u,1); 
     56ndat = size(M.DS_dt_u,1); 
    5757 
    58 plotestimates(M.DS_x, ... 
     58plotestimates(M.DS_dt_x, ... 
    5959    M.Est0_apost_mean_x, ... 
    60     M.Est0_apost_lb_x, ... 
    61     M.Est0_apost_ub_x); 
     60    M.Est0_apost_lbound_x, ... 
     61    M.Est0_apost_ubound_x); 
    6262set(gca,'YLim',[-1.5,1]); 
    6363 
  • library/bdm/base/loggers.h

    r907 r933  
    5656                if ( id >= 0 ) { 
    5757                        vectors ( id ).set_row ( ind, v ); 
     58                } 
     59        } 
     60        void log_double ( int id, const double &d ) { 
     61                bdm_assert ( id < vectors.length(), "Logger was not initialized, run init()." ); 
     62                if ( id >= 0 ) { 
     63                        vectors ( id )( ind, 0 )=d; 
    5864                } 
    5965        } 
  • library/bdm/mex/mex_parser.h

    r925 r933  
    9191                                Setting &child = setting.add ( key, Setting::TypeString ); 
    9292                                child = mxArray2string ( value ); 
    93                         } 
     93                                } else { 
    9494                        if ( mxIsLogical ( value ) ) { 
    9595                                Setting &child = setting.add ( key, Setting::TypeBoolean ); 
    9696                                child = ( bool ) mxArray2bin ( value ); 
    97                         } 
     97                        } else { 
    9898                        if ( mxIsStruct ( value ) ) { 
    9999                                Setting &child = setting.add ( key, Setting::TypeGroup ); 
    100100                                fillGroup ( child, value ); 
    101                         } 
     101                        } else { 
    102102                        if ( mxIsCell ( value ) ) { 
    103103                                Setting &child = setting.add ( key, Setting::TypeList ); 
    104104                                fillList ( child, value ); 
    105                         } 
     105                        } else { 
    106106                        if ( mxIsNumeric ( value ) ) { 
    107107                                storeNumeric ( setting, value, ( string ) key ); 
    108                         } 
    109                         if (mxIsObject(value)){ 
     108                        } else { 
     109                        // it is neither of above - treat it as an address 
     110                        // if (mxIsObject(value)){ <== should be tested but it is broken in matlab... 
     111                         
    110112                                Setting &child = setting.add(key, Setting::TypeInt64); 
    111113                                child = (long)value; 
    112114                        } 
     115                        } 
     116                        } 
     117                        } 
     118                                } 
    113119                } 
    114120        }