Description: adoptation to gsl2. Author: Damir Islamov , Anton Gladky Last-Update: 2015-12-04 Index: qtiplot-0.9.8.9/qtiplot/src/analysis/Fit.cpp =================================================================== --- qtiplot/src/analysis/Fit.cpp +++ qtiplot/src/analysis/Fit.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -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; }