📄 fastgauss.h
字号:
// File : FastGauss.h
// Purpose : FAST GAUSS TRANSFORM interface
// Author : Changjiang Yang
//
// $Revision: 0.99 $
// $Date : Mon Jul 8 18:11:31 EDT 2002 $
//
// $Revision: 1.00 $
// $Date : Wed Jan 29 16:05:21 EDT 2003 $
//
// $Revision: 1.01 $
// $Date : Wed Apr 14 09:51:26 EDT 2004 $
#ifndef FAST_GAUSS_H
#define FAST_GAUSS_H
#include <mex.h>
//#include <malloc.h>
//interface for FastGauss:
class FastGauss{
private:
//------------------------------------------------------------------------------------//
// data structure
// interface:
int Dim; //dimension of the points.
int NSources; //number of sources.
int DWeights; //dimension of weights.
double *pSources; //pointer to sources, (Dim*Nsources).
double *pSigmas; //pointer to sigmas, (Dim*Nsources).
double *pWeights; //pointer to weights, (DWeights*NSources).
double bandwid; //bandwidth
double epsilon; //desired precision.
int pterms; //number of truncation terms.
// internal data:
int pd; //number of coefficients
double *A_k; //pointer to coefficients
double *B_k; //pointer to coefficients
int K_N;
double ratio_far;
double *xc;
int *xcind; //center of the sources
int *indx;
int *xheads;
int *xboxsz;
int *bkindx;
double rx2;
//---------------------------------------------------------------------------------------//
// private functions
int nchoosek(int n, int k);
void TaylorExpansion(int d, int du, int p);
void Compute_C_k(int d, int p, double *C_k);
void Compute_A_k(double *xc, double *C_k);
void Compute_Centers(double *xc, double *x, int d, int n, int *ind, int K, int *bxsz);
// K-centers algorithm
double dkcenter(const int dim, const int n, const int K,
const double *x, double *cn, int *cind);
double dkcenter(const int dim, const int n, const int K,
const double *x, int *cn, int *cind);
double dkcenter(const int dim, const int n, const int K,
const double *x, int *cn, int *cind, int *cnn);
double dkcenter(const int dim, const int n, const int K,
const double *x, int *cn, int *cind,
int *heads, int *boxsz, int *nind);
inline float sdist(const int d, const float *x, const float *y);
inline double ddist(const int d, const double *x, const double *y);
// Some functions of Intel Math Kernel Library.
// Implemented for the
void dcopy(const int d, const double *x, double *y);
int idmax(int n, double *x);
//---------------------------------------------------------------------------------------//
// public functions
public:
//constructors
FastGauss(int dim, double *u, int du, double *x, int ns,
double h, int p, int K, double e);
//destructor
~FastGauss();
void Compute_v_i(double *y, const int mt, double *v_i);
void *operator new[] (size_t s){ return mxMalloc(s);}
void operator delete[] (void* mem){ mxFree(mem);}
// void *operator new[] (size_t s){ return _aligned_malloc(s, 16);}
// void operator delete[] (void* mem){ _aligned_free(mem);}
};
#endif //FAST_GAUSS_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -