Changeset 1002 for applications/bdmtoolbox/mex
- Timestamp:
- 05/27/10 13:08:31 (15 years ago)
- Location:
- applications/bdmtoolbox/mex
- Files:
-
- 2 added
- 5 modified
Legend:
- Unmodified
- Added
- Removed
-
applications/bdmtoolbox/mex/CMakeLists.txt
r995 r1002 33 33 34 34 MEX(bm_bayes) 35 MEX(bm_bayesweighted) 36 MEX(bm_epredictor) 35 37 36 38 MEX(arx_structure_reduction) -
applications/bdmtoolbox/mex/arx_structure_reduction.cpp
r995 r1002 36 36 shared_ptr<ARX> Apri=UI::build<ARX>(Cfgpri); 37 37 38 if ( ARX) && (ARXpri){38 if ((A1) && (Apri)){ 39 39 40 40 //if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" ); 41 ivec strnew=A1->structure_est_LT(Apri );41 ivec strnew=A1->structure_est_LT(Apri->posterior()); 42 42 UImxArray Out; 43 43 A1->reduce_structure(strnew); -
applications/bdmtoolbox/mex/bm_bayes.cpp
r978 r1002 14 14 #include <estim/kalman.h> 15 15 #include <estim/particles.h> 16 #include <estim/mixtures.h> 16 17 #include <mex/mex_BM.h> 17 18 18 19 void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { 19 20 // Check the number of inputs and output arguments 20 if ( n_input<1 ) mexErrMsgTxt ( "Usage:\n" 21 "bm_struct=bm_bayes(BM_struct, yt, cond)\n" 22 " bm_struct = struct('class','BM_offspring',...); % description of Bayesian Model (BM)\n" 23 " yt = [...]; % vector of observed data\n" 24 " cond = [...]; % vector of conditioning variables\n" 25 "output:\n" 26 " bm_struct = struct('class','BM_offsprin',...); % description of BM afret update." ); 21 if ( n_input<1 ) mexErrMsgTxt ( 22 "Usage:\n" 23 "[bm_struct,logevidence]=bm_bayes(BM_struct, yt, cond)\n" 24 " BM_struct = struct('class','BM_offspring',...); % description of Bayesian Model (BM)\n" 25 " yt = [...]; % vector of observed data\n" 26 " cond = [...]; % vector of conditioning variables\n" 27 "output:\n" 28 " bm_struct = struct('class','BM_offsprin',...); % description of BM afret update.\n" 29 " logevidence = 0.0; % logarithm of normalizing constant f(yt|cond)" 30 ); 27 31 28 32 RV::clear_all(); … … 50 54 UI::save(bm.get(), Out); 51 55 output[0]=UImxArray::create_mxArray(Out); 56 if (n_output>1){ 57 mxArray *le=mxCreateDoubleScalar(mxREAL); 58 double2mxArray(bm->_ll(), le); 59 output[1]=le; 60 } 52 61 } else { 53 62 mexErrMsgTxt ( "Given object is not BM" ); -
applications/bdmtoolbox/mex/enorm_bhattacharyya.cpp
r809 r1002 24 24 //CONFIG 25 25 UImxArray E1(input[0]); 26 UImxArray E2(input[ 0]);26 UImxArray E2(input[1]); 27 27 // Cfg.writeFile("epdf_mean.cfg"); 28 28 -
applications/bdmtoolbox/mex/mixef_init.cpp
r801 r1002 21 21 " Data = []; % matrix of data \n" 22 22 " Com1 = struct('class','BMEF_offspring'); % A typical component \n" 23 " no_com = [10]; % requested numbebr of component \n" 23 24 "output:\n" 24 25 " structure with description of mixture." ); … … 37 38 38 39 UImxArray Cfg(input[1]); 39 //Cfg.writeFile("mixef_init.cfg");40 Cfg.writeFile("mixef_init.cfg"); 40 41 42 int no_com=10; 43 if (n_input>2){ 44 no_com = mxArray2double(input[2]); 45 } 41 46 #else 42 47 int main() { 43 48 UIFile Cfg ( "mixef_init.cfg" ); 44 49 mat Data=randn(2,100); // <<<<<<<<< ============== beware!!! 50 int no_com =10; 45 51 #endif 46 52 47 53 shared_ptr<BMEF> com1=UI::build<BMEF>(Cfg.getRoot()); 48 54 MixEF mix; 49 mix.init(&(*com1),Data, 10);55 mix.init(&(*com1),Data,no_com); 50 56 mix.bayes_batch(Data,zeros(0,Data.cols()),ones(Data.cols())); 51 57 shared_ptr<epdf> p=mix.epredictor(vec(0)); 58 UIFile prf; 59 UI::save(p.get(), prf.getRoot(),"predictor"); 60 prf.writeFile("mix_pred.cfg"); 61 52 62 #ifdef MEX 53 63 UImxArray out; 54 64 UI::save( &mix, out ); 55 65 output[0]= out.create_mxArray(); 66 if (n_output>1){ 67 UImxArray ep; 68 shared_ptr<epdf> p=mix.epredictor(vec(0)); 69 UI::save( p.get(), ep ); 70 output[1] = ep.create_mxArray(); 71 } 72 56 73 #else 57 74 UIFile out;