2013-11-13 22:50:38 +04:00
|
|
|
#ifndef UTILS_H
|
|
|
|
#define UTILS_H
|
|
|
|
#include <stdio.h>
|
2014-10-22 01:49:18 +04:00
|
|
|
#include <time.h>
|
2013-11-13 22:50:38 +04:00
|
|
|
#include "list.h"
|
|
|
|
|
|
|
|
void error(char *s);
|
|
|
|
void malloc_error();
|
|
|
|
void file_error(char *s);
|
|
|
|
void strip(char *s);
|
|
|
|
void strip_char(char *s, char bad);
|
|
|
|
list *split_str(char *s, char delim);
|
|
|
|
char *fgetl(FILE *fp);
|
|
|
|
list *parse_csv_line(char *line);
|
|
|
|
char *copy_string(char *s);
|
|
|
|
int count_fields(char *line);
|
2014-01-29 04:28:42 +04:00
|
|
|
float *parse_fields(char *line, int n);
|
|
|
|
void normalize_array(float *a, int n);
|
|
|
|
void scale_array(float *a, int n, float s);
|
|
|
|
void translate_array(float *a, int n, float s);
|
|
|
|
int max_index(float *a, int n);
|
|
|
|
float constrain(float a, float max);
|
|
|
|
float rand_normal();
|
2014-02-14 22:26:31 +04:00
|
|
|
float rand_uniform();
|
2014-08-11 23:52:07 +04:00
|
|
|
float sum_array(float *a, int n);
|
2014-01-29 04:28:42 +04:00
|
|
|
float mean_array(float *a, int n);
|
|
|
|
float variance_array(float *a, int n);
|
|
|
|
float **one_hot_encode(float *a, int n, int k);
|
2014-10-22 01:49:18 +04:00
|
|
|
float sec(clock_t clocks);
|
2013-11-13 22:50:38 +04:00
|
|
|
#endif
|
|
|
|
|