TPCCLIB
|
IO for FIT files and calculating function values. More...
Go to the source code of this file.
Functions | |
void | fitEmpty (FIT *fit) |
void | fitInit (FIT *fit) |
int | fitWrite (FIT *fit, char *filename) |
int | fitSetmem (FIT *fit, int voiNr) |
void | fitPrint (FIT *fit) |
int | fitRead (char *filename, FIT *fit, int verbose) |
int | fitFunctionformat (int type, char *str) |
int | fitFunctionname (int type, char *str) |
int | fitEval (FitVOI *r, double x, double *y) |
int | fitEvaltac (FitVOI *r, double *x, double *y, int dataNr) |
int | fitIntegralEval (FitVOI *r, double x, double *yi) |
int | fitIntegralEvaltac (FitVOI *r, double *x, double *yi, int dataNr) |
int | fitDerivEval (FitVOI *r, double x, double *yd) |
int | fitDerivEvaltac (FitVOI *r, double *x, double *yd, int dataNr) |
unsigned int | factorial (unsigned int n) |
unsigned long long int | lfactorial (unsigned long long int n) |
double | igam (double a, double x) |
double | igamc (double a, double x) |
Variables | |
int | MATHFUNC_TEST |
char | fiterrmsg [64] |
IO for FIT files and calculating function values.
Definition in file mathfunc.c.
unsigned int factorial | ( | unsigned int | n | ) |
Calculate factorial of given number.
n | Integer n, from which the factorial is calculated. |
Definition at line 1678 of file mathfunc.c.
Referenced by factorial().
int fitDerivEval | ( | FitVOI * | r, |
double | x, | ||
double * | yd ) |
Evaluates yd=Df(x).
r | Fit parameters of a single region |
x | Time where to evaluate the derivative of the function |
yd | The derivative of the function is returned here |
Definition at line 1540 of file mathfunc.c.
Referenced by fitDerivEvaltac().
int fitDerivEvaltac | ( | FitVOI * | r, |
double * | x, | ||
double * | yd, | ||
int | dataNr ) |
Evaluates an array yd[i]=Df(x[i]).
r | Fit parameters of a single region |
x | Times where to evaluate the function derivatives |
yd | Array for the function derivatives |
dataNr | Nr of (x,yd) data |
Definition at line 1655 of file mathfunc.c.
void fitEmpty | ( | FIT * | fit | ) |
Free memory allocated for FIT. All contents are cleared.
fit | Pointer to FIT struct. |
Definition at line 18 of file mathfunc.c.
Referenced by fitRead(), and fitSetmem().
int fitEval | ( | FitVOI * | r, |
double | x, | ||
double * | y ) |
Evaluate y=f(x).
r | Fit parameters of a single region |
x | Time where to evaluate the function |
y | The value of the function is returned here |
Definition at line 645 of file mathfunc.c.
Referenced by fitEvaltac().
int fitEvaltac | ( | FitVOI * | r, |
double * | x, | ||
double * | y, | ||
int | dataNr ) |
Evaluates an array y[i]=f(x[i]).
r | Fit parameters of a single region |
x | Times where to evaluate the function |
y | Array for the function values |
dataNr | Nr of (x,y) data |
Definition at line 1252 of file mathfunc.c.
int fitFunctionformat | ( | int | type, |
char * | str ) |
Copies the description of a function type to the specified string which must have space for >=128 characters.
type | The number of function |
str | Representation of the format of the function |
Definition at line 381 of file mathfunc.c.
int fitFunctionname | ( | int | type, |
char * | str ) |
Copies the name of the function to the specified string which must have space for >=128 characters.
type | The number of function |
str | Name of the function |
Definition at line 539 of file mathfunc.c.
void fitInit | ( | FIT * | fit | ) |
Initiate FIT structure. Call this once before first use.
Definition at line 38 of file mathfunc.c.
int fitIntegralEval | ( | FitVOI * | r, |
double | x, | ||
double * | yi ) |
Evaluates yi=Integral of f(x) between 0 and x.
r | Fit parameters of a single region |
x | Time where to evaluate integral of the function |
yi | The integral value of the function is returned here |
Definition at line 1308 of file mathfunc.c.
Referenced by fitIntegralEvaltac().
int fitIntegralEvaltac | ( | FitVOI * | r, |
double * | x, | ||
double * | yi, | ||
int | dataNr ) |
Evaluate an array yi[i]=Integral of f(x[i]) between 0 and x.
r | Fit parameters of a single region |
x | Times where to evaluate the function integrals |
yi | Array for the function integral values |
dataNr | Nr of (x,yi) data |
Definition at line 1517 of file mathfunc.c.
void fitPrint | ( | FIT * | fit | ) |
Print to stdout the contents of FIT data structure.
Mainly for testing purposes.
fit | Pointer to FIT struct. |
Definition at line 180 of file mathfunc.c.
int fitRead | ( | char * | filename, |
FIT * | fit, | ||
int | verbose ) |
Read FIT file contents to the specified data structure, emptying its old contents.
filename | Pointer to file name. |
fit | Pointer to initiated FIT struct. |
verbose | Verbose level; if <=0, then nothing is printed into stdout. |
Definition at line 196 of file mathfunc.c.
int fitSetmem | ( | FIT * | fit, |
int | voiNr ) |
Allocate memory for FIT data. Any previous contents are destroyed.
fit | Pointer to FIT struct. |
voiNr | Nr of TACs to allocate. |
Definition at line 154 of file mathfunc.c.
Referenced by fit_allocate_with_dft(), and fitRead().
int fitWrite | ( | FIT * | fit, |
char * | filename ) |
Write function parameters in FIT into specified file.
If necessary, a backup file (+BACKUP_EXTENSION) is created.
fit | Pointer to FIT struct. |
filename | Filename. |
Definition at line 54 of file mathfunc.c.
Referenced by fitPrint().
double igam | ( | double | a, |
double | x ) |
Cumulative gamma distribution, or Regularized gamma function, more specifically, lower incomplete gamma function divided by gamma function.
Standard gamma distribution is assumed (Beta=1). f(a,x) = (1/Gamma(a)) * Integral(0,x)(e^-t * t^(a-1))dt
a | Shape parameter alpha; must be > 0. |
x | Integral from 0 to x; must be >= 0. |
Definition at line 1715 of file mathfunc.c.
double igamc | ( | double | a, |
double | x ) |
Regularized gamma function, more specifically, upper incomplete gamma function divided by gamma function.
f(a,x) = (1/Gamma(a)) * Integral(x,Inf)(e^-t * t^(a-1))dt Standard gamma distribution is assumed (Beta=1).
a | Shape parameter alpha; must be > 0. |
x | Integral from x to infinity; must be >= 0 |
Definition at line 1756 of file mathfunc.c.
Referenced by igam().
unsigned long long int lfactorial | ( | unsigned long long int | n | ) |
Calculate factorial of given number.
n | Integer n, from which the factorial is calculated. |
Definition at line 1695 of file mathfunc.c.
Referenced by fitEval(), fitIntegralEval(), and lfactorial().
char fiterrmsg[64] |
Error message from FIT functions
Definition at line 6 of file mathfunc.c.
Referenced by fitRead(), and fitWrite().
int MATHFUNC_TEST |
Verbose prints from FIT functions
Definition at line 5 of file mathfunc.c.
Referenced by fitEval(), fitPrint(), and fitWrite().