1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
Description: adoptation to gsl2.
Author: Damir Islamov <damir@secretlaboratory.ru>, Anton Gladky <gladk@debian.org>
Last-Update: 2015-12-04
Index: qtiplot-0.9.8.9/qtiplot/src/analysis/Fit.cpp
===================================================================
--- qtiplot-0.9.8.9.orig/qtiplot/src/analysis/Fit.cpp
+++ qtiplot-0.9.8.9/qtiplot/src/analysis/Fit.cpp
@@ -39,6 +39,7 @@
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_blas.h>
#include <gsl/gsl_cdf.h>
+#include <gsl/gsl_version.h>
#include <QApplication>
#include <QMessageBox>
@@ -126,10 +127,19 @@ gsl_multifit_fdfsolver * Fit::fitGSL(gsl
break;
}
}
-
if (status){
+ // allocate memory and calculate covariance matrix based on residuals
+#if GSL_MAJOR_VERSION == 2
+ gsl_matrix *J = gsl_matrix_alloc(d_n, d_p);
+ gsl_multifit_fdfsolver_jac(s, J);
+ gsl_multifit_covar (J, 0.0, covar);
+ iterations = 0;
+ // free previousely allocated memory
+ gsl_matrix_free (J);
+#else
gsl_multifit_covar (s->J, 0.0, covar);
iterations = 0;
+#endif
return s;
}
@@ -154,10 +164,18 @@ gsl_multifit_fdfsolver * Fit::fitGSL(gsl
status = gsl_multifit_test_delta (s->dx, s->x, d_tolerance, d_tolerance);
} while (inRange && status == GSL_CONTINUE && (int)iter < d_max_iterations);
-
+#if GSL_MAJOR_VERSION == 2
+ // allocate memory and calculate covariance matrix based on residuals
+ gsl_matrix *J = gsl_matrix_alloc(d_n, d_p);
+ gsl_multifit_fdfsolver_jac(s, J);
+ gsl_multifit_covar (J, 0.0, covar);
+ iterations = iter;
+ // free previousely allocated memory
+ gsl_matrix_free (J);
+#else
gsl_multifit_covar (s->J, 0.0, covar);
-
iterations = iter;
+#endif
return s;
}
|