aboutsummaryrefslogtreecommitdiff
path: root/academic/QtiPlot/qtiplot-0.9.8.9_gsl-2.patch
blob: d6ff7d00b04c7caa98e1c58c6ee9f88ddea99891 (plain)
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
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;