mathgl/mathgl-2.3.3-gsl2.patch
2015-12-09 17:02:08 +06:00

55 lines
2.0 KiB
Diff

diff -urp mathgl-2.3.3/CMakeLists.txt mathgl-2.3.3-gsl2/CMakeLists.txt
--- mathgl-2.3.3/CMakeLists.txt 2015-12-08 21:39:12.774499940 +0600
+++ mathgl-2.3.3-gsl2/CMakeLists.txt 2015-12-08 21:39:50.534220640 +0600
@@ -259,6 +259,16 @@ endif(enable-pthread)
if(enable-gsl)
set(MGL_HAVE_GSL 1)
+ FIND_PACKAGE(PkgConfig)
+ pkg_check_modules(GSL2 REQUIRED gsl)
+ if ( GSL2_FOUND )
+ if ( NOT ${GSL2_VERSION} LESS 2.0 )
+ SET(ISGSL2 1)
+ endif ( NOT ${GSL2_VERSION} LESS 2.0 )
+ if ( ${GSL2_VERSION} LESS 1.16 )
+ SET(ISOLDGSL 1)
+ endif ( ${GSL2_VERSION} LESS 1.16 )
+ endif ( GSL2_FOUND )
find_library(GSL_LIB gsl)
find_library(GSL_CBLAS_LIB gslcblas)
find_path(GSL_INCLUDE_DIR gsl/gsl_fft_complex.h)
diff -urp mathgl-2.3.3/src/CMakeLists.txt mathgl-2.3.3-gsl2/src/CMakeLists.txt
--- mathgl-2.3.3/src/CMakeLists.txt 2015-06-01 13:29:02.000000000 +0600
+++ mathgl-2.3.3-gsl2/src/CMakeLists.txt 2015-12-08 21:40:21.154183235 +0600
@@ -23,6 +23,12 @@ ${MathGL_BINARY_DIR}/include/mgl2/dllexp
)
add_definitions(-DMGL_SRC)
+if(DEFINED ISGSL2)
+add_definitions(-DHAVE_GSL_2)
+endif(DEFINED ISGSL2)
+if(DEFINED ISOLDGSL)
+add_definitions(-DGSL_DISABLE_DEPRECATED)
+endif(DEFINED ISOLDGSL)
if(MGL_HAVE_PNG)
set(prc_src prc/PRCbitStream.cc prc/PRCdouble.cc prc/oPRCFile.cc prc/writePRC.cc prc.cpp )
diff -urp mathgl-2.3.3/src/fit.cpp mathgl-2.3.3-gsl2/src/fit.cpp
--- mathgl-2.3.3/src/fit.cpp 2015-06-01 13:29:02.000000000 +0600
+++ mathgl-2.3.3-gsl2/src/fit.cpp 2015-12-08 21:41:24.987020578 +0600
@@ -193,7 +193,14 @@ mreal MGL_NO_EXPORT mgl_fit_base(mglFitD
}
while ( status == GSL_CONTINUE && iter < 500 );
gsl_matrix *covar = gsl_matrix_alloc(m, m);
+#ifdef HAVE_GSL_2
+ gsl_matrix *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
mglFitCovar.Set(covar);
mreal res = gsl_blas_dnrm2(s->f);
for(i=0;i<m;i++) ini[i] = gsl_vector_get(s->x, i);