root/applications/bdmtoolbox/mex/arx_structure_reduction.cpp @ 995

Revision 995, 1.4 kB (checked in by smidl, 14 years ago)

arx structure reduction

Line 
1/*!
2\file
3\brief wrapper function for arx.structure_est_LT()
4
5
6 */
7
8#include <stat/emix.h>
9
10using namespace bdm;
11
12#ifdef MEX
13#include <estim/arx_ext.h>
14#include <estim/kalman.h>
15#include <estim/particles.h>
16#include <mex/mex_BM.h>
17#include <estim/arx.h>
18
19void 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 ( "Usage:\n"
22                                                "arx_struct=arx_structure_reduction(ARX_struct, ARX_prior)\n"
23                                                "  ARX_struct = struct('class','ARX',...);            % posterior ARX\n"
24                                                "  ARX_prior  = struct('class','ARX',...);            % prior ARX\n"
25                                                "output:\n"
26                                                "  ARX_struct = struct('class','ARX',...);            % best reduced structure of ARX class." );
27
28        RV::clear_all();
29        //CONFIG
30        if (n_input<2){                 bdm_error("no prior entered"); }
31       
32        UImxArray Cfg(input[0]);
33        UImxArray Cfgpri(input[1]);
34
35        shared_ptr<ARX> A1=UI::build<ARX>(Cfg);
36        shared_ptr<ARX> Apri=UI::build<ARX>(Cfgpri);
37       
38        if (ARX) && (ARXpri){   
39               
40                //if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" );
41                ivec strnew=A1->structure_est_LT(Apri);
42                UImxArray Out;
43                A1->reduce_structure(strnew);
44                UI::save(A1, Out);
45                output[0]=UImxArray::create_mxArray(Out);
46        } else { 
47                mexErrMsgTxt ( "Given objects are not ARX" );
48        }
49}
50#endif
Note: See TracBrowser for help on using the browser.