Revision 943, 1.2 kB
(checked in by smidl, 14 years ago)
|
syntax of epredictor
|
Rev | Line | |
---|
[729] | 1 | /*! |
---|
| 2 | \file |
---|
| 3 | \brief wrapper function for epdf.sample_mat() |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include <stat/emix.h> |
---|
| 9 | |
---|
| 10 | using namespace bdm; |
---|
| 11 | |
---|
| 12 | #ifdef MEX |
---|
| 13 | #include <mex/mex_parser.h> |
---|
[943] | 14 | #include <mex/mex_pdf.h> |
---|
[729] | 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 | "mat=pdf_sample_mat(pdf_struct, nos)\n" |
---|
| 20 | " pdf_struct = struct('class','pdf_offspring',...); % description of pdf\n" |
---|
| 21 | " nos = 10; % number of samples\n" |
---|
| 22 | "output:\n" |
---|
| 23 | " matrix of samples, each sample in one column." ); |
---|
| 24 | |
---|
| 25 | RV::clear_all(); |
---|
| 26 | //CONFIG |
---|
| 27 | UImxArray Cfg(input[0]); |
---|
[801] | 28 | // Cfg.writeFile("epdf_sample_mat.cfg"); |
---|
[756] | 29 | shared_ptr<epdf> ep=UI::build<epdf>(Cfg); |
---|
[729] | 30 | |
---|
[756] | 31 | int nos=10; |
---|
| 32 | if (n_input>1) {nos = (int)(*mxGetPr(input[1]));} |
---|
[729] | 33 | |
---|
| 34 | if ( n_output<1 ) mexErrMsgTxt ( "No output - nothing to do!" ); |
---|
| 35 | output[0] = mxCreateDoubleMatrix(ep->dimension(), nos, mxREAL); |
---|
| 36 | mat2mxArray(ep->sample_mat(nos), output[0]); |
---|
| 37 | } |
---|
| 38 | #endif |
---|