From ab119782aca1a2eb9216cd721bca3ab9a0235911 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Wed, 7 Dec 2016 21:05:57 +0100 Subject: allow datasets to be stored in libsvm/svmlight format --- include/gensvm_globals.h | 10 ++++++---- include/gensvm_io.h | 1 + include/gensvm_sparse.h | 1 + include/gensvm_strutil.h | 2 ++ 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/gensvm_globals.h b/include/gensvm_globals.h index 1151069..1aca458 100644 --- a/include/gensvm_globals.h +++ b/include/gensvm_globals.h @@ -39,15 +39,17 @@ #include "gensvm_memory.h" // all system libraries are included here +#include +#include +#include +#include +#include #include +#include #include #include -#include #include -#include #include -#include -#include // ########################### Type definitions ########################### // diff --git a/include/gensvm_io.h b/include/gensvm_io.h index afcf4a3..c18e9a2 100644 --- a/include/gensvm_io.h +++ b/include/gensvm_io.h @@ -37,6 +37,7 @@ // function declarations void gensvm_read_data(struct GenData *dataset, char *data_file); +void gensvm_read_data_libsvm(struct GenData *dataset, char *data_file); void gensvm_read_model(struct GenModel *model, char *model_filename); void gensvm_write_model(struct GenModel *model, char *output_filename); diff --git a/include/gensvm_sparse.h b/include/gensvm_sparse.h index 570e19a..f897889 100644 --- a/include/gensvm_sparse.h +++ b/include/gensvm_sparse.h @@ -71,6 +71,7 @@ struct GenSparse { struct GenSparse *gensvm_init_sparse(); void gensvm_free_sparse(struct GenSparse *sp); long gensvm_count_nnz(double *A, long rows, long cols); +bool gensvm_nnz_comparison(long nnz, long rows, long cols); bool gensvm_could_sparse(double *A, long rows, long cols); struct GenSparse *gensvm_dense_to_sparse(double *A, long rows, long cols); double *gensvm_sparse_to_dense(struct GenSparse *A); diff --git a/include/gensvm_strutil.h b/include/gensvm_strutil.h index 4e86944..1a2dccc 100644 --- a/include/gensvm_strutil.h +++ b/include/gensvm_strutil.h @@ -35,6 +35,8 @@ bool str_startswith(const char *str, const char *pre); bool str_endswith(const char *str, const char *suf); +bool str_contains_char(const char *str, const char c); +char **str_split(char *original, const char *delims, int *len_ret); void next_line(FILE *fid, char *filename); char *get_line(FILE *fid, char *filename, char *buffer); -- cgit v1.2.3