#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <math.h>#include <string.h>#include <time.h>#include <ctype.h>#include "decpoint.h"#include "petunits.h"#include "datetime.h"#include "backup.h"#include "include/mathfunc.h"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 | 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) |
| 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 1319 of file mathfunc.c.
References FitVOI::p, and FitVOI::type.
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 1425 of file mathfunc.c.
References fitDerivEval().
Free memory allocated for FIT. All contents are cleared.
Definition at line 194 of file mathfunc.c.
References FIT::_voidataNr, FIT::datafile, FIT::program, FIT::time, FIT::timeunit, FIT::unit, FIT::voi, and FIT::voiNr.
Referenced by fitRead(), and fitSetmem().
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 675 of file mathfunc.c.
References MATHFUNC_TEST, FitVOI::p, FitVOI::parNr, and FitVOI::type.
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 1116 of file mathfunc.c.
References fitEval().
| 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 464 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 588 of file mathfunc.c.
Initiate FIT structure. Call this once before first use.
Definition at line 209 of file mathfunc.c.
References FIT::_voidataNr, and FIT::voiNr.
| 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 1138 of file mathfunc.c.
References FitVOI::p, and FitVOI::type.
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 1297 of file mathfunc.c.
References fitIntegralEval().
Print to stdout the contents of FIT data structure. Mainly for testing purposes.
Definition at line 332 of file mathfunc.c.
References FIT::_voidataNr, fitWrite(), MATHFUNC_TEST, and FIT::voiNr.
Read FIT file contents to the specified data structure, emptying its old contents.
| filename | Pointer to filename |
| fit | Pointer to initiated FIT struct |
Definition at line 346 of file mathfunc.c.
References FIT::datafile, FitVOI::dataNr, FitVOI::end, FIT_VER, fitEmpty(), fiterrmsg, fitSetmem(), FitVOI::hemisphere, MATHFUNC_TEST, FitVOI::name, FitVOI::p, FitVOI::parNr, FitVOI::place, FIT::program, FitVOI::start, FIT::time, FIT::timeunit, FitVOI::type, FIT::unit, FIT::voi, FitVOI::voiname, FIT::voiNr, and FitVOI::wss.
Allocate memory for FIT data. Any previous contents are destroyed.
Definition at line 311 of file mathfunc.c.
References FIT::_voidataNr, fitEmpty(), FIT::voi, and FIT::voiNr.
Referenced by fit_allocate_with_dft(), and fitRead().
Write function parameters in FIT into specified file. If necessary, a backup file (+BACKUP_EXTENSION) is created. In case of an error, >0 is returned, and a description is written in fiterrmsg.
Definition at line 222 of file mathfunc.c.
References FIT::datafile, FitVOI::dataNr, FitVOI::end, FIT_VER, fiterrmsg, FitVOI::hemisphere, MATHFUNC_TEST, FitVOI::p, FitVOI::parNr, FitVOI::place, FIT::program, FitVOI::start, FIT::time, FIT::timeunit, FitVOI::type, FIT::unit, FIT::voi, FitVOI::voiname, FIT::voiNr, and FitVOI::wss.
Referenced by fitPrint().
1.8.0