53 lines
1.5 KiB
Diff
53 lines
1.5 KiB
Diff
diff -u -r qtiplot-0.9.8.9/qtiplot/src/analysis/Fit.cpp qtiplot-0.9.8.9-patched/qtiplot/src/analysis/Fit.cpp
|
|
--- qtiplot-0.9.8.9/qtiplot/src/analysis/Fit.cpp 2011-10-17 11:06:00.000000000 +0100
|
|
+++ qtiplot-0.9.8.9-patched/qtiplot/src/analysis/Fit.cpp 2015-11-18 22:26:22.535193469 +0000
|
|
@@ -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>
|
|
@@ -106,6 +107,10 @@
|
|
gsl_multifit_fdfsolver * Fit::fitGSL(gsl_multifit_function_fdf f, int &iterations, int &status)
|
|
{
|
|
const gsl_multifit_fdfsolver_type *T;
|
|
+#if GSL_MAJOR_VERSION >=2
|
|
+ gsl_matrix *J=0;
|
|
+#endif
|
|
+
|
|
if (d_solver)
|
|
T = gsl_multifit_fdfsolver_lmder;
|
|
else
|
|
@@ -128,7 +133,14 @@
|
|
}
|
|
|
|
if (status){
|
|
+#if GSL_MAJOR_VERSION >=2
|
|
+ J=gsl_matrix_alloc(s->fdf->n, s->fdf->p);
|
|
+ gsl_multifit_fdfsolver_jac (s, J);
|
|
+ gsl_multifit_covar (J, 0.0, covar);
|
|
+ gsl_matrix_free(J);
|
|
+#else
|
|
gsl_multifit_covar (s->J, 0.0, covar);
|
|
+#endif
|
|
iterations = 0;
|
|
return s;
|
|
}
|
|
@@ -155,7 +167,14 @@
|
|
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
|
|
+ J=gsl_matrix_alloc(s->fdf->n, s->fdf->p);
|
|
+ gsl_multifit_fdfsolver_jac (s, J);
|
|
+ gsl_multifit_covar (J, 0.0, covar);
|
|
+ gsl_matrix_free(J);
|
|
+#else
|
|
gsl_multifit_covar (s->J, 0.0, covar);
|
|
+#endif
|
|
|
|
iterations = iter;
|
|
return s;
|