root/applications/bdmtoolbox/mex/epdf_variance.cpp @ 767

Revision 761, 0.9 kB (checked in by smidl, 14 years ago)

changes to dist identific example + wrapper for variance

Line 
1/*!
2\file
3\brief wrapper function for epdf.covariance()
4
5
6 */
7
8#include <stat/emix.h>
9
10using namespace bdm;
11
12#ifdef MEX
13#include <mex/mex_parser.h>
14
15void 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<1 ) mexErrMsgTxt ( "Usage:\n"
18                                                "vec=pdf_variance(pdf_struct)\n"
19                                                "  pdf_struct = struct('class','pdf_offspring',...);  % description of pdf\n"
20                                                "output:\n"
21                                                "  vec variance of given pdf." );
22
23        RV::clear_all();
24        //CONFIG
25        UImxArray Cfg(input[0]);
26        Cfg.writeFile("epdf_covariance.cfg");
27
28        shared_ptr<epdf> ep=UI::build<epdf>(Cfg);
29       
30       
31        if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" );
32        output[0] = mxCreateDoubleMatrix(ep->dimension(), 1, mxREAL);
33        vec2mxArray(ep->variance(), output[0]);
34}
35#endif
Note: See TracBrowser for help on using the browser.