Recent Changes - Search:

edit SideBar



Authors: G. Hobbs, J. Khoo

The toolkit.c and toolkit.h files are publically available routines. The tempo2 plugins make heavy use of this toolkit. The currently available functions are described below.

Design philosophy

The toolkit has been written in ansi-C, all routines are stored within one file (toolkit.c), the algorithms are written for simplicity and clarity and not for speed and the majority of the routines are stand-alone and can therefore be extracted from the toolkit and including in separate source code.


  • void TKoutput1(double *x,int n,char *file,int type), outputs one column of values. If type =1 then a counter is also displayed. The output is written to a file with name "file". To display to the screen use file = "stdout"


  • double TKmean(double *x,int n), calculates the mean
  • double TKmin(double *x,int n), float TKmin_f(float *x,int n), calculates the minimum value
  • double TKmax(double *x,int n), float TKmax_f(float*x,int n), calculates the maximum value
  • double TKrange(double *x,int n), gives the range (maximum-minimum)
  • void TKremoveMean(double *x,int n), removes the mean from each value in the x array
  • double TKminVal(double x1,double x2), gives the minimum of x1 and x2
  • double TKmaxVal(double x1,double x2), gives the maximum of x1 and x2
  • double TKvariance(double *x, int n), calculates the variance
  • double TKsdev(double *x,int n), calculates the standard deviation (sqrt(1/N) definition)
  • double TKsampleSdev(double *x,int n), calculates the sample standard deviation (sqrt(1/N-1) definition)


  • void TKfitSVD(double *x,double *y,double *sig,int n,int nfunc, void *(fitFuncs)(double,double *,int),double *ans), uses singular value decomposition to fit a linear function.
  • void TKfitPoly(double x,double *a,int n), used when fitting a polynomial


  • void TKsort(double *x,int n), sorts the x array in numerical order

Random number generation

  • double TKranDev(long *seed), returns random deviate between 0 and 1
  • long TKsetSeed(), returns a random number seed set from the computer clock
  • double TKgaussDev(long *seed), returns Gaussian random deviates
Edit - History - Print - Recent Changes - Search
Page last modified on May 19, 2007, at 09:45 PM