Author: Andreas Tille <tille@debian.org>
Last-Update: Fri, 17 Mar 2017 10:23:15 +010
Description: Use Debian packaged libsvm

--- libpsortb.orig/svmloc/Makefile.am
+++ libpsortb/svmloc/Makefile.am
@@ -3,8 +3,5 @@
 # svmloc dir
 
 lib_LTLIBRARIES		= libsvmloc.la
-libsvmloc_la_SOURCES	= binding.cpp libsvm.cpp svmloc.cpp binding.h libsvm.h svmloc.h
-libsvmloc_la_LDFLAGS	= -version-info 0:0:0
-
-noinst_HEADERS = \
-COPYRIGHT
+libsvmloc_la_SOURCES	= binding.cpp svmloc.cpp binding.h svmloc.h
+libsvmloc_la_LDFLAGS	= -version-info 0:0:0 -lsvm
--- libpsortb.orig/svmloc/svmloc.h
+++ libpsortb/svmloc/svmloc.h
@@ -12,7 +12,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "libsvm.h"
+#include <libsvm/svm.h>
 
 using namespace std;
 
--- libpsortb.orig/svmloc/svmloc.cpp
+++ libpsortb/svmloc/svmloc.cpp
@@ -166,7 +166,7 @@
 
   // Free any old model we have.
   if(model != NULL) {
-    svm_destroy_model(model);
+    svm_free_and_destroy_model(&model);
     model = NULL;
   }
 
@@ -282,7 +282,7 @@
   }
 
   if(model != NULL) {
-    svm_destroy_model(model);
+    svm_free_and_destroy_model(&model);
     model = NULL;
   }
 
@@ -436,7 +436,7 @@
 	sumyy += y*y;
 	sumvy += v*y;
       }
-      svm_destroy_model(submodel);
+      svm_free_and_destroy_model(&submodel);
       // cout << "Mean squared error = %g\n", error/(end-begin));
       total_error += error;			
     } else {
@@ -447,7 +447,7 @@
 	double v = svm_predict(submodel,prob->x[j]);
 	if(v == prob->y[j]) ++correct;
       }
-      svm_destroy_model(submodel);
+      svm_free_and_destroy_model(&submodel);
       //cout << "Accuracy = " << 100.0*correct/(end-begin) << " (" <<
       //correct << "/" << (end-begin) << endl;
       total_correct += correct;
@@ -502,6 +502,6 @@
 
 SVM::~SVM() {
 	if(x_space!=NULL) { free_x_space(); }
-  if(model != NULL) { svm_destroy_model(model); model=NULL; }
+  if(model != NULL) { svm_free_and_destroy_model(&model); model=NULL; }
   if(prob != NULL) { free(prob); prob=NULL; }
 }
