source: issm/branches/trunk-jpl-damage/src/modules/Kriging/Kriging.cpp@ 12168

Last change on this file since 12168 was 12164, checked in by Mathieu Morlighem, 13 years ago

Added Kriging module (empty for now)

File size: 1.5 KB
Line 
1/*\file Kriging.c
2 *\brief: best linear predictor
3 */
4#include "./Kriging.h"
5
6void mexFunction( int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]){
7
8 /*Outputs*/
9 double *x = NULL;
10 double *y = NULL;
11 double *observations = NULL;
12 double *x_interp = NULL;
13 double *y_interp = NULL;
14 double *predictions = NULL;
15 int n_interp,n,n_obs;
16
17 /*Boot module: */
18 MODULEBOOT();
19
20 /*checks on arguments on the matlab side: */
21 CheckNumMatlabArguments(nlhs,NLHS,nrhs,NRHS,__FUNCT__,&KrigingUsage);
22
23 /*Fetch inputs: */
24 FetchData(&x,&n_obs,X);
25 FetchData(&y,&n,Y); if(n_obs!=n) _error_("x and y should have the same size");
26 FetchData(&observations,&n,OBSERVATIONS); if(n_obs!=n) _error_("x and observations should have the same size");
27 FetchData(&x_interp,&n_interp,XINTERP);
28 FetchData(&y_interp,&n,YINTERP); if(n_interp!=n) _error_("x_interp and y_interp should have the same size");
29
30 /*Call x layer*/
31 Krigingx(&predictions,x,y,observations,n_obs,x_interp,y_interp,n_interp);
32
33 /*Generate output Matlab Structures*/
34 WriteData(PREDICTIONS,predictions,n_interp);
35
36 /*Free ressources: */
37 xfree((void**)&x);
38 xfree((void**)&y);
39 xfree((void**)&observations);
40 xfree((void**)&x_interp);
41 xfree((void**)&y_interp);
42 xfree((void**)&predictions);
43
44 /*end module: */
45 MODULEEND();
46}
47
48void KrigingUsage(void){
49 _printf_(true,"\n");
50 _printf_(true," usage: predictions=%s(x,y,observations,x_interp,y_interp);\n",__FUNCT__);
51 _printf_(true,"\n");
52}
Note: See TracBrowser for help on using the repository browser.