diff options
| author | Gertjan van den Burg <burg@ese.eur.nl> | 2016-12-07 12:42:49 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <burg@ese.eur.nl> | 2016-12-07 12:42:49 +0100 |
| commit | 845631ad78415e022295373d8b0c9517ae17403e (patch) | |
| tree | 896e8e293fdce2df98b104755b5995c132dae0d6 | |
| parent | document undocumented elements (diff) | |
| download | gensvm-845631ad78415e022295373d8b0c9517ae17403e.tar.gz gensvm-845631ad78415e022295373d8b0c9517ae17403e.zip | |
switch some integer variables to long for cross platform size guarantees
| -rw-r--r-- | include/gensvm_cross_validation.h | 2 | ||||
| -rw-r--r-- | include/gensvm_gridsearch.h | 2 | ||||
| -rw-r--r-- | include/gensvm_sparse.h | 4 | ||||
| -rw-r--r-- | src/gensvm_cross_validation.c | 4 | ||||
| -rw-r--r-- | src/gensvm_cv_util.c | 8 | ||||
| -rw-r--r-- | src/gensvm_gridsearch.c | 6 | ||||
| -rw-r--r-- | src/gensvm_init.c | 2 | ||||
| -rw-r--r-- | src/gensvm_sparse.c | 6 | ||||
| -rw-r--r-- | src/gensvm_update.c | 4 | ||||
| -rw-r--r-- | src/gensvm_zv.c | 4 |
10 files changed, 21 insertions, 21 deletions
diff --git a/include/gensvm_cross_validation.h b/include/gensvm_cross_validation.h index 16c7223..fd62e30 100644 --- a/include/gensvm_cross_validation.h +++ b/include/gensvm_cross_validation.h @@ -36,6 +36,6 @@ // function declarations double gensvm_cross_validation(struct GenModel *model, struct GenData **train_folds, struct GenData **test_folds, - int folds, long n_total); + long folds, long n_total); #endif diff --git a/include/gensvm_gridsearch.h b/include/gensvm_gridsearch.h index f0be067..46142fd 100644 --- a/include/gensvm_gridsearch.h +++ b/include/gensvm_gridsearch.h @@ -44,7 +44,7 @@ void gensvm_fill_queue(struct GenGrid *grid, struct GenQueue *queue, struct GenData *train_data, struct GenData *test_data); bool gensvm_kernel_changed(struct GenTask *newtask, struct GenTask *oldtask); -void gensvm_kernel_folds(int folds, struct GenModel *model, +void gensvm_kernel_folds(long folds, struct GenModel *model, struct GenData **train_folds, struct GenData **test_folds); void gensvm_gridsearch_progress(struct GenTask *task, long N, double perf, double duration, double current_max); diff --git a/include/gensvm_sparse.h b/include/gensvm_sparse.h index 4d55ae3..570e19a 100644 --- a/include/gensvm_sparse.h +++ b/include/gensvm_sparse.h @@ -62,9 +62,9 @@ struct GenSparse { double *values; ///< actual nonzero values, should be of length nnz - int *ia; + long *ia; ///< cumulative row lengths, should be of length n_row+1 - int *ja; + long *ja; ///< column indices, should be of length nnz }; diff --git a/src/gensvm_cross_validation.c b/src/gensvm_cross_validation.c index 2fe6198..d17443b 100644 --- a/src/gensvm_cross_validation.c +++ b/src/gensvm_cross_validation.c @@ -51,9 +51,9 @@ extern FILE *GENSVM_OUTPUT_FILE; */ double gensvm_cross_validation(struct GenModel *model, struct GenData **train_folds, struct GenData **test_folds, - int folds, long n_total) + long folds, long n_total) { - int f; + long f; long *predy = NULL; double performance, total_perf = 0; diff --git a/src/gensvm_cv_util.c b/src/gensvm_cv_util.c index 384b2a4..f8b5649 100644 --- a/src/gensvm_cv_util.c +++ b/src/gensvm_cv_util.c @@ -273,16 +273,16 @@ void gensvm_get_tt_split_sparse(struct GenData *full_data, train_data->spZ->n_row = train_n; train_data->spZ->n_col = full_data->m+1; train_data->spZ->values = Calloc(double, train_nnz); - train_data->spZ->ia = Calloc(int, train_n+1); - train_data->spZ->ja = Calloc(int, train_nnz); + train_data->spZ->ia = Calloc(long, train_n+1); + train_data->spZ->ja = Calloc(long, train_nnz); // set GenSparse variables for test test_data->spZ->nnz = test_nnz; test_data->spZ->n_row = test_n; test_data->spZ->n_col = full_data->m+1; test_data->spZ->values = Calloc(double, test_nnz); - test_data->spZ->ia = Calloc(int, test_n+1); - test_data->spZ->ja = Calloc(int, test_nnz); + test_data->spZ->ia = Calloc(long, test_n+1); + test_data->spZ->ja = Calloc(long, test_nnz); tr_nnz_idx = 0; tr_row_idx = 0; diff --git a/src/gensvm_gridsearch.c b/src/gensvm_gridsearch.c index 2ac9639..9c30d3a 100644 --- a/src/gensvm_gridsearch.c +++ b/src/gensvm_gridsearch.c @@ -238,10 +238,10 @@ bool gensvm_kernel_changed(struct GenTask *newtask, struct GenTask *oldtask) * @param[in,out] test_folds array of test datasets * */ -void gensvm_kernel_folds(int folds, struct GenModel *model, +void gensvm_kernel_folds(long folds, struct GenModel *model, struct GenData **train_folds, struct GenData **test_folds) { - int f; + long f; note("Computing kernel"); for (f=0; f<folds; f++) { @@ -274,7 +274,7 @@ void gensvm_kernel_folds(int folds, struct GenModel *model, */ void gensvm_train_queue(struct GenQueue *q) { - int f, folds; + long f, folds; double perf, duration, current_max = 0; struct GenTask *task = get_next_task(q); struct GenTask *prevtask = NULL; diff --git a/src/gensvm_init.c b/src/gensvm_init.c index 90ee5cd..d65e307 100644 --- a/src/gensvm_init.c +++ b/src/gensvm_init.c @@ -76,7 +76,7 @@ void gensvm_init_V(struct GenModel *from_model, if (data->Z == NULL) { // sparse matrix - int *visit_count = Calloc(int, m+1); + long *visit_count = Calloc(long, m+1); for (i=0; i<n; i++) { jj_start = data->spZ->ia[i]; jj_end = data->spZ->ia[i+1]; diff --git a/src/gensvm_sparse.c b/src/gensvm_sparse.c index 84312f9..ce99b3b 100644 --- a/src/gensvm_sparse.c +++ b/src/gensvm_sparse.c @@ -135,7 +135,7 @@ bool gensvm_could_sparse(double *A, long rows, long cols) struct GenSparse *gensvm_dense_to_sparse(double *A, long rows, long cols) { double value; - int row_cnt; + long row_cnt; long i, j, cnt, nnz = 0; struct GenSparse *spA = NULL; @@ -147,8 +147,8 @@ struct GenSparse *gensvm_dense_to_sparse(double *A, long rows, long cols) spA->n_row = rows; spA->n_col = cols; spA->values = Calloc(double, nnz); - spA->ia = Calloc(int, rows+1); - spA->ja = Calloc(int, nnz); + spA->ia = Calloc(long, rows+1); + spA->ja = Calloc(long, nnz); cnt = 0; spA->ia[0] = 0; diff --git a/src/gensvm_update.c b/src/gensvm_update.c index 3bf7549..f81d224 100644 --- a/src/gensvm_update.c +++ b/src/gensvm_update.c @@ -479,8 +479,8 @@ void gensvm_get_ZAZ_ZB_dense(struct GenModel *model, struct GenData *data, void gensvm_get_ZAZ_ZB_sparse(struct GenModel *model, struct GenData *data, struct GenWork *work) { - int *Zia = NULL, - *Zja = NULL; + long *Zia = NULL, + *Zja = NULL; long b, i, j, k, K, jj, kk, jj_start, jj_end, blk_start, blk_end, rem_size, n_blocks, n_row = data->spZ->n_row, n_col = data->spZ->n_col; diff --git a/src/gensvm_zv.c b/src/gensvm_zv.c index afa770d..d631fbf 100644 --- a/src/gensvm_zv.c +++ b/src/gensvm_zv.c @@ -76,8 +76,8 @@ void gensvm_calculate_ZV_sparse(struct GenModel *model, K = model->K; - int *Zia = data->spZ->ia; - int *Zja = data->spZ->ja; + long *Zia = data->spZ->ia; + long *Zja = data->spZ->ja; double *vals = data->spZ->values; for (i=0; i<n_row; i++) { |
