From 2c6c5a9b28deaeeaf36477e154afd5192a0bab0c Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 30 Sep 2016 20:16:10 +0200 Subject: remove unnecessary W and t matrices --- include/gensvm_base.h | 4 ---- src/gensvm_base.c | 9 --------- src/gensvm_optimize.c | 13 ++----------- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/include/gensvm_base.h b/include/gensvm_base.h index 0366edf..ded0149 100644 --- a/include/gensvm_base.h +++ b/include/gensvm_base.h @@ -74,10 +74,6 @@ struct GenModel { ///< parameter for the Huber hinge function double lambda; ///< regularization parameter in the loss function - double *W; - ///< weight matrix - double *t; - ///< translation vector double *V; ///< augmented weight matrix double *Vbar; diff --git a/src/gensvm_base.c b/src/gensvm_base.c index 3e2dfeb..7710fc9 100644 --- a/src/gensvm_base.c +++ b/src/gensvm_base.c @@ -88,8 +88,6 @@ struct GenModel *gensvm_init_model() model->kerneltype = K_LINEAR; model->kernelparam = NULL; - model->W = NULL; - model->t = NULL; model->V = NULL; model->Vbar = NULL; model->U = NULL; @@ -119,8 +117,6 @@ void gensvm_allocate_model(struct GenModel *model) long m = model->m; long K = model->K; - model->W = Calloc(double, m*(K-1)); - model->t = Calloc(double, K-1); model->V = Calloc(double, (m+1)*(K-1)); model->Vbar = Calloc(double, (m+1)*(K-1)); model->U = Calloc(double, K*(K-1)); @@ -169,9 +165,6 @@ void gensvm_reallocate_model(struct GenModel *model, long n, long m) model->n = n; } if (model->m != m) { - model->W = Realloc(model->W, double, m*(K-1)); - Memset(model->W, double, m*(K-1)); - model->V = Realloc(model->V, double, (m+1)*(K-1)); Memset(model->V, double, (m+1)*(K-1)); @@ -197,8 +190,6 @@ void gensvm_free_model(struct GenModel *model) if (model == NULL) return; - free(model->W); - free(model->t); free(model->V); free(model->Vbar); free(model->U); diff --git a/src/gensvm_optimize.c b/src/gensvm_optimize.c index aa9dcbf..19e697e 100644 --- a/src/gensvm_optimize.c +++ b/src/gensvm_optimize.c @@ -41,8 +41,8 @@ */ void gensvm_optimize(struct GenModel *model, struct GenData *data) { - long i, j, it = 0; - double L, Lbar, value; + long it = 0; + double L, Lbar; long n = model->n; long m = model->m; @@ -102,15 +102,6 @@ void gensvm_optimize(struct GenModel *model, struct GenData *data) note("Number of support vectors: %li\n", gensvm_num_sv(model)); model->training_error = (Lbar - L)/L; - - for (i=0; it[i] = matrix_get(model->V, K-1, 0, i); - for (i=1; iV, K-1, i, j); - matrix_set(model->W, K-1, i-1, j, value); - } - } free(B); free(ZV); free(ZAZ); -- cgit v1.2.3