Revision 1002, 1.3 kB
(checked in by smidl, 14 years ago)
|
new mexes + cleanup
|
Line | |
---|
1 | /*! |
---|
2 | \file |
---|
3 | \brief wrapper function for BM.epredictor() |
---|
4 | |
---|
5 | |
---|
6 | */ |
---|
7 | |
---|
8 | #include <stat/emix.h> |
---|
9 | |
---|
10 | using namespace bdm; |
---|
11 | |
---|
12 | #ifdef MEX |
---|
13 | #include <estim/arx_ext.h> |
---|
14 | #include <estim/kalman.h> |
---|
15 | #include <estim/particles.h> |
---|
16 | #include <estim/mixtures.h> |
---|
17 | #include <mex/mex_BM.h> |
---|
18 | |
---|
19 | void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { |
---|
20 | // Check the number of inputs and output arguments |
---|
21 | if ( n_input<1 ) mexErrMsgTxt ( |
---|
22 | "Usage:\n" |
---|
23 | "[pred_struct]=bm_epredictor(BM_struct, cond)\n" |
---|
24 | " BM_struct = struct('class','BM_offspring',...); % description of Bayesian Model (BM)\n" |
---|
25 | " cond = [...]; % vector of conditioning variables (if needed)\n" |
---|
26 | "output:\n" |
---|
27 | " pred_struct = struct('class','epdf_offsprin',...); % description of predictor f(yt|data).\n" |
---|
28 | ); |
---|
29 | |
---|
30 | RV::clear_all(); |
---|
31 | //CONFIG |
---|
32 | |
---|
33 | UImxArray Cfg(input[0]); |
---|
34 | Cfg.writeFile("BM_predictor.cfg"); |
---|
35 | |
---|
36 | shared_ptr<BM> bm=UI::build<BM>(Cfg); |
---|
37 | |
---|
38 | if (bm){ |
---|
39 | vec cond; |
---|
40 | if (n_input>1){ |
---|
41 | cond =mxArray2vec(input[1]); |
---|
42 | } |
---|
43 | //if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" ); |
---|
44 | shared_ptr<epdf> ep=bm->epredictor(cond); |
---|
45 | UImxArray Out; |
---|
46 | UI::save(ep.get(), Out); |
---|
47 | output[0]=UImxArray::create_mxArray(Out); |
---|
48 | } else { |
---|
49 | mexErrMsgTxt ( "Given object is not BM" ); |
---|
50 | } |
---|
51 | } |
---|
52 | #endif |
---|