📄 kctfgt.cpp
字号:
/* $Revision: 1.3 $ */
// Automatically generated by MATLAB Project Wizard version 1.0
//
// This is the gateway routine for a MATLAB Math/Graphics Library-based
// C MATLAB MEX File.
#include "mex.h"
#include <math.h>
#include "FastGauss.h"
//-----------------------------------------------------------------------//
void mexFunction(
int nlhs, // Number of left hand side (output) arguments
mxArray *plhs[], // Array of left hand side arguments
int nrhs, // Number of right hand side (input) arguments
const mxArray *prhs[] // Array of right hand side arguments
)
{
//------------------------------------------------------//
if(nrhs!=6) //datapts, bandwid, p, K, e, itmax
mexErrMsgTxt("Six inputs required.");
if(nlhs!=1) //xt
mexErrMsgTxt("One outputs required.");
//------------------------------------------------------//
// create a pointer to the input matrix datapts.
// The 2D array is column-major: each column represents a point.
double *datapts = mxGetPr(prhs[0]);
/* get the dimensions of the matrix input datapts */
int d = mxGetM(prhs[0]);
int n = mxGetN(prhs[0]);
/* get the scalar input bandwid */
double bandwid = mxGetScalar(prhs[1]);
/* get the scalar input bandwid */
double dp = mxGetScalar(prhs[2]);
int p = (int) dp;
double dK = mxGetScalar(prhs[3]);
int K = (int) dK;
double e = mxGetScalar(prhs[4]);
/* get the scalar input itmax */
double ditmax = mxGetScalar(prhs[5]);
int itmax = (int) ditmax;
//------------------------------------------------------//
/* set the output pointer to the output matrix */
plhs[0] = mxCreateDoubleMatrix(d, n, mxREAL);
/* create a C pointer to a copy of the output matrix */
double *xt = mxGetPr(plhs[0]);
//------------------------------------------------------//
for (int i = 0; i < d*n; i++)
xt[i] = datapts[i];
/* call the C subroutine */
FastGauss* pFGT = new FastGauss(d, datapts, d, datapts, n, bandwid, p, K, e);
for (int i = 0; i < itmax; i++)
pFGT->Compute_v_i(xt, n, xt);
delete pFGT;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -