From e8baad9ae430a838c34fa8173b36f92c9baa862d Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Fri, 17 Feb 2017 19:17:17 -0500 Subject: allow max_iter to be set in the model --- src/gensvm_optimize.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/gensvm_optimize.c') diff --git a/src/gensvm_optimize.c b/src/gensvm_optimize.c index 95f9df2..fff6768 100644 --- a/src/gensvm_optimize.c +++ b/src/gensvm_optimize.c @@ -30,13 +30,6 @@ #include "gensvm_optimize.h" -/** - * Maximum number of iterations of the algorithm. - */ -#ifndef GENSVM_MAX_ITER - #define GENSVM_MAX_ITER 1000000000 -#endif - /** * Iteration frequency with which to print to stdout */ @@ -94,7 +87,7 @@ void gensvm_optimize(struct GenModel *model, struct GenData *data) Lbar = L + 2.0*model->epsilon*L; // run main loop - while ((it < GENSVM_MAX_ITER) && (Lbar - L)/L > model->epsilon) + while ((it < model->max_iter) && (Lbar - L)/L > model->epsilon) { // ensures V contains newest V and Vbar contains V from // previous @@ -115,7 +108,7 @@ void gensvm_optimize(struct GenModel *model, struct GenData *data) if (L > Lbar) err("[GenSVM Warning]: Negative step occurred in " "majorization.\n"); - if (it >= GENSVM_MAX_ITER) + if (it >= model->max_iter) err("[GenSVM Warning]: maximum number of iterations " "reached.\n"); -- cgit v1.2.3