void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { double *i_oesgp_object; i_oesgp_object = mxGetPr(prhs[0]); VectorXd prediction; VectorXd prediction_variance; ObjectHandle<OESGP>* handle = ObjectHandle<OESGP>::from_mex_handle(prhs[0]); handle->get_object().predict(prediction, prediction_variance); if (nlhs >= 1) { plhs[0] = mxCreateDoubleMatrix(prediction.rows(), 1, mxREAL); double *output = mxGetPr(plhs[0]); for (unsigned int i=0; i<prediction.rows(); i++) { output[i] = prediction[i]; } } if (nlhs >= 2) { plhs[1] = mxCreateDoubleMatrix(prediction_variance.rows(), 1, mxREAL); double *output = mxGetPr(plhs[1]); for (unsigned int i=0; i<prediction_variance.rows(); i++) { output[i] = prediction_variance[i]; } } }
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { double *i_oesgp_object; char *i_filename; int buflen = (mxGetM(prhs[1]) * mxGetN(prhs[1])); i_oesgp_object = mxGetPr(prhs[0]); i_filename = mxArrayToString(prhs[1]); std::string filename(i_filename, buflen); ObjectHandle<OESGP>* handle = ObjectHandle<OESGP>::from_mex_handle(prhs[0]); handle->get_object().save(filename); mxFree(i_filename); }
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { double *i_oesgp_object; double *i_inputs; i_oesgp_object = mxGetPr(prhs[0]); i_inputs = mxGetPr(prhs[1]); //assign the kernel parameters unsigned int m = mxGetM(prhs[1]); unsigned int n = mxGetN(prhs[1]); unsigned int len = (m > n) ? m : n; VectorXd inputs(len); for (unsigned int i=0; i<len; i++) { inputs[i] = i_inputs[i]; } ObjectHandle<OESGP>* handle = ObjectHandle<OESGP>::from_mex_handle(prhs[0]); handle->get_object().update(inputs); }