|
Revision 336, 1.3 kB
(checked in by smidl, 16 years ago)
|
|
testbed for #19
|
| Line | |
|---|
| 1 | #include <itpp/itmex.h> |
|---|
| 2 | #include <estim/arx.h> |
|---|
| 3 | |
|---|
| 4 | using namespace bdm; |
|---|
| 5 | |
|---|
| 6 | class mexEpdf: public epdf{ |
|---|
| 7 | protected: |
|---|
| 8 | string name; |
|---|
| 9 | vec S; //bude struktura mxArray |
|---|
| 10 | public: |
|---|
| 11 | mexEpdf(){}; |
|---|
| 12 | void set(const string name0, const vec &S0){name=name0; S=S0;} // vola fci name+"new" a preda ji mxArray misto S |
|---|
| 13 | vec mean() const {return S;} //bude vysledek volani fce matlabu |
|---|
| 14 | }; |
|---|
| 15 | class mexBM: public BM{ |
|---|
| 16 | protected : |
|---|
| 17 | string name; |
|---|
| 18 | mexEpdf est; |
|---|
| 19 | public: |
|---|
| 20 | mexBM(string name0){name=name0;est.set("mexEpdf",vec_1(1.2));} |
|---|
| 21 | void bayes(const vec &dt){/* volej matlab name+"_bayes" */} |
|---|
| 22 | const mexEpdf& posterior()const{return est;} //tohle by melo zustat!! |
|---|
| 23 | const mexEpdf* _e()const{return &est;} //tohle by melo zustat!! |
|---|
| 24 | }; |
|---|
| 25 | |
|---|
| 26 | void mexFunction(int n_output, mxArray *output[], int n_input, const mxArray *input[]) |
|---|
| 27 | { |
|---|
| 28 | // Check the number of inputs and output arguments |
|---|
| 29 | if(n_input!=1) mexErrMsgTxt("Wrong number of input variables - expected parameter 'name'!"); |
|---|
| 30 | |
|---|
| 31 | // ------------------ Start of routine --------------------------- |
|---|
| 32 | |
|---|
| 33 | mexBM mB(mxArray2string(input[0])); // naplni |
|---|
| 34 | mB.bayes(vec_1(1.3)); |
|---|
| 35 | |
|---|
| 36 | // ------------------ End of routine ----------------------------- |
|---|
| 37 | |
|---|
| 38 | // Create output vectors |
|---|
| 39 | output[0] = mxCreateDoubleMatrix(1,1, mxREAL); |
|---|
| 40 | |
|---|
| 41 | // Convert the IT++ format to Matlab format for output |
|---|
| 42 | vec2mxArray(mB.posterior().mean(), output[0]); |
|---|
| 43 | } |
|---|