Revision 954, 1.4 kB
(checked in by smidl, 14 years ago)
|
wrapper for epdf_condition
|
Line | |
---|
1 | /*! |
---|
2 | \file |
---|
3 | \brief wrapper function for epdf.condition() |
---|
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 | #include <mex/mex_pdf.h> |
---|
15 | |
---|
16 | void mexFunction ( int n_output, mxArray *output[], int n_input, const mxArray *input[] ) { |
---|
17 | // Check the number of inputs and output arguments |
---|
18 | if ( n_input<1 ) mexErrMsgTxt ( "Usage:\n" |
---|
19 | "vec=pdf_condition(pdf_struct, RVs)\n" |
---|
20 | " pdf_struct = struct('class','pdf_offspring',...); % description of pdf\n" |
---|
21 | " RVs = RV(...); % description of variables of the resulting density, remaining will be in condition" |
---|
22 | "output:\n" |
---|
23 | " pdf_struct = struct('class','marginal_type',...); % description of the conditional pdf." ); |
---|
24 | |
---|
25 | RV::clear_all(); |
---|
26 | //CONFIG |
---|
27 | if (n_input<2){mexErrMsgTxt("RVs not given"); } |
---|
28 | |
---|
29 | UImxArray Cfg(input[0]); |
---|
30 | UImxArray RVs(input[1]); |
---|
31 | //Cfg.writeFile("epdf_marginal.cfg"); |
---|
32 | |
---|
33 | shared_ptr<epdf> ep=UI::build<epdf>(Cfg); |
---|
34 | |
---|
35 | if (ep){ |
---|
36 | //if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" ); |
---|
37 | RV r; |
---|
38 | UI::get(r,RVs); |
---|
39 | shared_ptr<pdf> cond = ep->condition(r); |
---|
40 | UImxArray Out; |
---|
41 | UI::save(cond, Out); |
---|
42 | output[0]=UImxArray::create_mxArray(Out); |
---|
43 | } else { |
---|
44 | mexErrMsgTxt ( "Given object is not epdf" ); |
---|
45 | } |
---|
46 | } |
---|
47 | #endif |
---|