You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.2 KiB
35 lines
1.2 KiB
#ifndef SERIAL_UTILS_H /* Include guard */
|
|
#define SERIAL_UTILS_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
/* Structs */
|
|
typedef struct parameters {
|
|
double epsilon;
|
|
bool verbose;
|
|
bool display;
|
|
} parameters;
|
|
|
|
//Function get_args parses command line arguments.
|
|
void get_args(int argc, char **argv, parameters *params);
|
|
|
|
//Function init reads the dataset and label arrays from the corresponding files.
|
|
void init(double ***vectors, char **labels);
|
|
|
|
//Function norm returns the second norm of matrix of dimensions rowsXcols.
|
|
double norm(double **matrix, int rows, int cols);
|
|
|
|
//Function alloc_double allocates rows*cols bytes of continuous memory.
|
|
double **alloc_double(int rows, int cols);
|
|
|
|
//Function duplicate copies the values of source array to dest array.
|
|
void duplicate(double **source, int rows, int cols, double ***dest);
|
|
|
|
//Function print_matrix prints array of dimensions rowsXcols to the console.
|
|
void print_matrix(double **array, int rows, int cols);
|
|
|
|
//Function save_matrix prints matrix in a csv file with path/filename
|
|
//"output/output_iteration". If a file already exists new lines are concatenated.
|
|
void save_matrix(double **matrix, int iteration);
|
|
|
|
#endif //SERIAL_UTILS_H
|