[809] | 1 | /*! |
---|
| 2 | \file |
---|
| 3 | \brief wrapper function for enorm.bhattacharyya() |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include <stat/emix.h> |
---|
| 9 | |
---|
| 10 | using namespace bdm; |
---|
| 11 | |
---|
| 12 | #ifdef MEX |
---|
| 13 | #include <mex/mex_parser.h> |
---|
| 14 | |
---|
| 15 | void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { |
---|
| 16 | // Check the number of inputs and output arguments |
---|
| 17 | if ( n_input<2 ) mexErrMsgTxt ( "Usage:\n" |
---|
| 18 | "vec=enorm_bhattacharyya(enorm_struct, enorm_struct)\n" |
---|
| 19 | " pdf_struct = struct('class','enorm<>',...); % description of pdf\n" |
---|
| 20 | "output:\n" |
---|
| 21 | " double Bhattacharia distance between arguments." ); |
---|
| 22 | |
---|
| 23 | RV::clear_all(); |
---|
| 24 | //CONFIG |
---|
| 25 | UImxArray E1(input[0]); |
---|
[1002] | 26 | UImxArray E2(input[1]); |
---|
[809] | 27 | // Cfg.writeFile("epdf_mean.cfg"); |
---|
| 28 | |
---|
| 29 | double bht=-1.0; |
---|
| 30 | string cls= E1.getRoot()["class"]; |
---|
| 31 | if (cls.find("ldmat")!=string::npos){ |
---|
| 32 | shared_ptr<enorm<ldmat> > ep=UI::build<enorm<ldmat> >(E1); |
---|
| 33 | shared_ptr<enorm<ldmat> > ep2=UI::build<enorm<ldmat> >(E2); |
---|
| 34 | bht = ep->bhattacharyya(*ep2); |
---|
| 35 | } |
---|
| 36 | if (cls.find("fsqmat")!=string::npos){ |
---|
| 37 | shared_ptr<enorm<fsqmat> > ep=UI::build<enorm<fsqmat> >(E1); |
---|
| 38 | shared_ptr<enorm<fsqmat> > ep2=UI::build<enorm<fsqmat> >(E2); |
---|
| 39 | bht = ep->bhattacharyya(*ep2); |
---|
| 40 | } |
---|
| 41 | if (cls.find("chmat")!=string::npos){ |
---|
| 42 | shared_ptr<enorm<chmat> > ep=UI::build<enorm<chmat> >(E1); |
---|
| 43 | shared_ptr<enorm<chmat> > ep2=UI::build<enorm<chmat> >(E2); |
---|
| 44 | bht = ep->bhattacharyya(*ep2); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | if (bht>-1.0){ |
---|
| 48 | //if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" ); |
---|
| 49 | output[0] = mxCreateDoubleMatrix(1, 1, mxREAL); |
---|
| 50 | double2mxArray(bht, output[0]); |
---|
| 51 | } else { |
---|
| 52 | mexErrMsgTxt ( "Given objects ar not of the same type" ); |
---|
| 53 | } |
---|
| 54 | } |
---|
| 55 | #endif |
---|