Ticket #50007: root5.diff

File root5.diff, 4.2 KB (added by mojca (Mojca Miklavec), 9 years ago)

A patch for GSL for ROOT5

  • Portfile

     
    1010
    1111github.setup        root-mirror root 5-34-34 v
    1212version             5.34.34
    13 revision            1
     13revision            2
    1414
    1515set version_major   [lindex [split ${version} .] 0]
    1616
     
    5050select.group        root
    5151select.file         ${filespath}/${name}
    5252
     53patchfiles-append   patch-math-mathmore-src-GSLMultiFit.h.diff
     54
    5355post-patch {
    5456#   reinplace "s|-lfreetype| \`freetype-config --libs\`|g" ${worksrcpath}/config/root-config.in
    5557    reinplace "s|\"/usr/include\"|\"${prefix}/include /usr/include\"|g" ${worksrcpath}/configure
     
    187189
    188190universal_variant   no
    189191
    190 default_variants    +ssl +xml +minuit2 +tmva +roofit +graphviz +opengl +soversion +http
     192default_variants    +ssl +xml +gsl +minuit2 +tmva +roofit +graphviz +opengl +soversion +http
    191193
    192194# Since ROOT 5.34.15 the cocoa backend is default on OSX 10.8 or newer
    193195# We also make it default on 10.7
  • files/patch-math-mathmore-src-GSLMultiFit.h.diff

     
     1From 850a56cad37733694a6858314e30e3dafbacc220 Mon Sep 17 00:00:00 2001
     2From: Pere Mato <pere.mato@cern.ch>
     3Date: Tue, 15 Dec 2015 11:58:24 +0100
     4Subject: [PATCH] Fix for ROOT-7776 - Integrate GSL 2.0 in ROOT.
     5
     6---
     7 math/mathmore/src/GSLMultiFit.h | 40 ++++++++++++++++++++++++++--------------
     8 1 file changed, 26 insertions(+), 14 deletions(-)
     9
     10diff --git a/math/mathmore/src/GSLMultiFit.h b/math/mathmore/src/GSLMultiFit.h
     11index a1cb348..e2570a0 100644
     12--- math/mathmore/src/GSLMultiFit.h
     13+++ math/mathmore/src/GSLMultiFit.h
     14@@ -31,6 +31,7 @@
     15 #include "gsl/gsl_matrix.h"
     16 #include "gsl/gsl_multifit_nlin.h"
     17 #include "gsl/gsl_blas.h"
     18+#include "gsl/gsl_version.h"
     19 #include "GSLMultiFitFunctionWrapper.h"
     20 
     21 #include "Math/IFunction.h"
     22@@ -127,20 +128,24 @@ class GSLMultiFit {
     23    int Iterate() {
     24       if (fSolver == 0) return -1;
     25       return gsl_multifit_fdfsolver_iterate(fSolver);
     26-   }
     27-
     28-   /// parameter values at the minimum
     29-   const double * X() const {
     30-      if (fSolver == 0) return 0;
     31-      gsl_vector * x =  gsl_multifit_fdfsolver_position(fSolver);       
     32-      return x->data;
     33    }
     34 
     35-   /// gradient value at the minimum
     36-   const double * Gradient() const {
     37-      if (fSolver == 0) return 0;
     38-      gsl_multifit_gradient(fSolver->J, fSolver->f,fVec);       
     39-      return fVec->data;
     40+   /// parameter values at the minimum
     41+   const double * X() const {
     42+      if (fSolver == 0) return 0;
     43+      gsl_vector * x =  gsl_multifit_fdfsolver_position(fSolver);
     44+      return x->data;
     45+   }
     46+
     47+   /// gradient value at the minimum
     48+   const double * Gradient() const {
     49+      if (fSolver == 0) return 0;
     50+#if GSL_MAJOR_VERSION  > 1
     51+      fType->gradient(fSolver->state, fVec);
     52+#else
     53+      gsl_multifit_gradient(fSolver->J, fSolver->f,fVec);
     54+#endif
     55+      return fVec->data;
     56    }
     57 
     58    /// return covariance matrix of the parameters
     59@@ -150,9 +155,16 @@ class GSLMultiFit {
     60       unsigned int npar = fSolver->fdf->p;
     61       fCov = gsl_matrix_alloc( npar, npar );
     62       static double kEpsrel = 0.0001;
     63+#if GSL_MAJOR_VERSION > 1
     64+      gsl_matrix* J = gsl_matrix_alloc(npar,npar);
     65+      gsl_multifit_fdfsolver_jac (fSolver, J);
     66+      int ret = gsl_multifit_covar(J, kEpsrel, fCov);
     67+      gsl_matrix_free(J);
     68+#else
     69       int ret = gsl_multifit_covar(fSolver->J, kEpsrel, fCov);
     70-      if (ret != GSL_SUCCESS) return 0;
     71-      return fCov->data;
     72+#endif
     73+      if (ret != GSL_SUCCESS) return 0;
     74+      return fCov->data;
     75    }
     76 
     77    /// test gradient (ask from solver gradient vector)
  • files/root5

     
    2828libexec/root5/bin/thisroot.sh
    2929libexec/root5/bin/xpdtest
    3030-
     31-
     32-
     33-
     34-
     35-
     36-
     37-
     38-
    3139libexec/root5/share/man/man1/cint.1.gz
    3240libexec/root5/share/man/man1/g2root.1.gz
    3341libexec/root5/share/man/man1/g2rootold.1.gz