|
Revision 803, 1.3 kB
(checked in by smidl, 16 years ago)
|
|
new wrappers in bdmtoolbox + display functions
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | \file |
|---|
| 3 | \brief wrapper function for epdf.marginal() |
|---|
| 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<1 ) mexErrMsgTxt ( "Usage:\n" |
|---|
| 18 | "vec=pdf_marginal(pdf_struct, RVs)\n" |
|---|
| 19 | " pdf_struct = struct('class','pdf_offspring',...); % description of pdf\n" |
|---|
| 20 | " RVs = RV(...); % description of variables of teh marginal" |
|---|
| 21 | "output:\n" |
|---|
| 22 | " pdf_struct = struct('class','marginal_type',...); % description of marginal pdf." ); |
|---|
| 23 | |
|---|
| 24 | RV::clear_all(); |
|---|
| 25 | //CONFIG |
|---|
| 26 | if (n_input<2){mexErrMsgTxt("RVs not given"); } |
|---|
| 27 | |
|---|
| 28 | UImxArray Cfg(input[0]); |
|---|
| 29 | UImxArray RVs(input[1]); |
|---|
| 30 | //Cfg.writeFile("epdf_marginal.cfg"); |
|---|
| 31 | |
|---|
| 32 | shared_ptr<epdf> ep=UI::build<epdf>(Cfg); |
|---|
| 33 | |
|---|
| 34 | if (ep){ |
|---|
| 35 | //if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" ); |
|---|
| 36 | shared_ptr<RV> rv=UI::build<RV>(RVs); |
|---|
| 37 | shared_ptr<epdf> marginal = ep->marginal(*rv); |
|---|
| 38 | UImxArray Out; |
|---|
| 39 | UI::save(marginal, Out); |
|---|
| 40 | output[0]=UImxArray::create_mxArray(Out); |
|---|
| 41 | } else { |
|---|
| 42 | mexErrMsgTxt ( "Given object is not epdf" ); |
|---|
| 43 | } |
|---|
| 44 | } |
|---|
| 45 | #endif |
|---|