int scan_help (int argc,char **argv): This routine just scans the options for a -h and returns a 1 if found and a 0 if not.
double *get_series (char *name, unsigned long *l,unsigned long ex, unsigned int col, unsigned int verbosity): This routine reads a scalar time series from the file name into the array which is returned.l is the number of data read (will on return be the minimum of the file size and the value given). The first ex lines of the file are ignored and the time series is supposed to be the cols column. verbosity specifies the verbosity level of the program.
char* search_datafile(int n,char **names,unsinged int *col,unsigned int verbosity) This routines gets an array of strings names of size n and scans it for a name of an existing file. It returns the filename in case it found one or a NULL pointer if not. If the filename is given like filename,i the i is interpreted as the column and is returned in col, if col was not a pointer to NULL. verbosity specifies the verbosity level of the program.
double **get_multi_series(char *name,
unsigned long *l,unsigned long ex, unsigned int *col,
char *which,char colfix,unsigned int verbosity):
Reads a multivariate time series
and returns a
pointer to it. The first three parameters are the same as in
get_series. *col is the number
of columns to read and which is a string which
contains the columns to be read, separated by commas. colfix determines whether *col can be modified within the routine.
Example: to read the first three columns:
which=1,2,3 or if the columns should be permuted
which=3,2,1 means: x=third column, ...
If which contains less columns than specified in
col it is extended in such a way that columns are
appended that are larger than the largest given in
which.
Example: col=3
which=1,2 -which=1,2,3
or
which=5,1 -which=5,1,6
If which contains more columns than
specified in *col, then which determines the number of columns to read
unless the dimension was specified on the command line, explicitely.
verbosity
specifies the verbosity level of the program.
char* check_option (char **str,int n,char flag,char type) This routine looks for the flag flag in the string array str (typically argv) which has n (typically argc) entries. The flag is supposed to be of type type. See the sources for the valid types. The return string contains the parameter for the flag or NULL if none was found.
void rescale_data (double *s,unsigned long l,double *min,double *interval): This routine rescales the data in the array s, which has a length l, to the interval [0:1]. On return min is the minimum of the original data and interval their original interval.
void variance (double *s, unsigned long l,double *av,double *var). Simply calculates the average av and the variance var of a time series s, which has length l.
void make_box (double *s,long **box,long *list, unsigned long l,unsigned int bs,unsigned int dim,unsigned int del,double eps): This routine together with the routine find_neighbors constitute the box-assisted search algorithm. The parameters are: The time series s of length l, a two dimensional box of dimension bs, where bs has to be a power of 2, the search list, also of length l, the dimension dim of the embedding vectors, which are build with delay del and the size eps of the boxes.
unsigned long find_neighbors (double *s,long **box,long *list,double *x, unsigned long l,unsigned int bs,unsigned int dim, unsigned int del,double eps,unsigned long *flist): This routine searches for all neighbors of a vector x within the time series s. The indexes of the neighbors found are stored in the array flist, which has length l and the number of neighbors found is returned. All other parameters have the same meaning as in the routine make_box.
void solvele(double **mat,double *vec,unsigned int dim): Solves a dim-dimensional system of linear equations given by mat*x=vec. It uses a Gaussian elimination scheme. On return vec contains x.
double **invert_matrix (double **mat,unsigned int size): Inverts the matrix mat which is sizexsize. It uses the routine solvele. The inverse matrix is returned.
void test_outfile(char *name): This routine just checks whether the program can write to the file named name. If not the program exits.
unsigned long exclude_interval(unsigned long found,long ex0,long ex1,long *before,long *newlist): This routine is meant to be used in connection with the find_neighbors routine. After having found found neighbors which are stored in before with the latter routine, this new routine allows to exclude a interval of indexes bounded by ex0 and ex1 from this list. The modified list is returned in newlist and the new number of neigbors is the return value of the routine.
void make_multi_box(double **series,long **box,long *list,unsigned long length,unsigned int bs,unsigned int dim, unsigned int emb, unsigned int del,double eps): This routine is used to create the mesh for the box assisted search algorithm in case you have multivariate data. The parameter dim determines the number of components of the vector. All other parameter have the same meaning as in make_box.
unsigned long find_multi_neighbors (double *s,long **box,long *list,double **x, unsigned long l,unsigned int bs,unsigned int dim, unsigned int emb,unsigned int del,double eps,unsigned long *flist): This routine searches for all neighbors of a multicomponent vector x within the multicomponent time series s. dim is the number of components. All other parameters have the same meaning as the ones of find_neighbors.
void what_i_do(char *text,char *name): Just writes a message to stderr saying what the program name does (text).
void myfgets(char *str,int *size,FILE *fin, unsigned int verbosity): This routine wraps the fgets routine of C to handle looong input lines. The parameters have the same meaning as in fgets. The only differences are: size can be changed inside and verbosity handles the verbosity level for the output of warnings.