Content originally posted in LPCWare by trichloramine on Tue Nov 04 13:47:03 MST 2014
I have written a series of math functions in C++ for the IAR compiler.
lowpass filter, convolution, least squares curve fit, no lag smoothing filter, discrete FFT, discrete derivative... small and fast.
float * curvreg(float * vx, float * vy, unsigned n, unsigned terms,
float *mse);
void vfree(float * v);
float * least_sq(int (*f)(float, float *, unsigned), float * vx,
float * vy, unsigned n, unsigned nord1, float *mse);
float * lineqn(float * m, float * v, unsigned n);
void lineqn_(float * b, float * work, float * a, unsigned n);
bool DiscreteDerivative(float* dataVector, int originalVectorLength, float *solutionVector, float delta);
bool Convolve(float * data, float *solutionVector ,int originalVectorLength, float* weights, int nweights,
int decimationFactor, int filterType, int symmetry, int *usefulVectorLength);
bool smooth(float* data, int ndata, float *smoothed, int factor);
float besi0_(float x);
float vmaxval(float* v, unsigned n, unsigned *imx);
float vminval(float* v, unsigned n, unsigned *imx);
void FFT(void *d, int nfft);
void Dfft(void *d, int nn);
unsigned short GetNextCrc(unsigned char ch,unsigned short lastcrc);
unsigned short GetCrc(unsigned char *Buf,unsigned long count);
void AppendCrc(unsigned char *crcData, unsigned long length);
bool CheckCrc(unsigned char *crcData, unsigned long length);
char *ftoa(float f,char *buffer);
char* _itoa(int value, char* result, int base);
if you are interested in any or all of the NXP library, please contact me.