[Kst] kdeextragear-2/kst/plugins/fits_nonlinear

Andrew Walker arwalker at sumusltd.com
Wed Feb 4 19:18:46 CET 2004


CVS commit by arwalker: 

Added exponential weighted and un-weighted fits


  A            exponential/.cvsignore   1.1
  A            exponential/Makefile.am   1.1
  A            exponential/kstfit_exponential.cpp   1.1 [UNKNOWN]
  A            exponential/kstfit_exponential.desktop   1.1
  A            exponential/kstfit_exponential.xml   1.1
  A            exponential_weighted/.cvsignore   1.1
  A            exponential_weighted/Makefile.am   1.1
  A            exponential_weighted/kstfit_exponential.desktop   1.1
  A            exponential_weighted/kstfit_exponential_weighted.cpp   1.1 [UNKNOWN]
  A            exponential_weighted/kstfit_exponential_weighted.xml   1.1
  M +1 -1      Makefile.am   1.4
  M +4 -0      non_linear.h   1.4
  M +11 -7     non_linear_weighted.h   1.2


--- kdeextragear-2/kst/plugins/fits_nonlinear/Makefile.am  #1.3:1.4
@@ -1,2 +1,2 @@
-SUBDIRS=gaussian gaussian_weighted lorentzian lorentzian_weighted
+SUBDIRS=gaussian gaussian_weighted lorentzian lorentzian_weighted exponential exponential_weighted
 

--- kdeextragear-2/kst/plugins/fits_nonlinear/non_linear.h  #1.3:1.4
@@ -13,4 +13,6 @@
 #include <gsl/gsl_statistics.h>
 
+#define KST_UNUSED(x) if(x){};
+
 #define X                                       0
 #define Y                                       1
@@ -91,4 +93,6 @@ int kstfit_nonlinear(
         double outScalars[] ) {
   
+  KST_UNUSED( inScalars )
+  
   const gsl_multifit_fdfsolver_type* pType;
   gsl_multifit_fdfsolver* pSolver;

--- kdeextragear-2/kst/plugins/fits_nonlinear/non_linear_weighted.h  #1.1:1.2
@@ -13,4 +13,6 @@
 #include <gsl/gsl_statistics.h>
 
+#define KST_UNUSED(x) if(x){};
+
 #define X                                       0
 #define Y                                       1
@@ -21,5 +23,5 @@ struct data {
   const double* pdX;
   const double* pdY;
-  const double* pdSigma;
+  const double* pdWeight;
 };
 
@@ -50,5 +52,5 @@ int function_f( const gsl_vector* pVecto
   for( i=0; i<pData->n; i++ ) {
     dY  = function_calculate( pData->pdX[i], dParameters );
-    gsl_vector_set( pVectorF, i, (dY - pData->pdY[i])/pData->pdSigma[i] );
+    gsl_vector_set( pVectorF, i, (dY - pData->pdY[i])*pData->pdWeight[i] );
   }
   
@@ -71,5 +73,5 @@ int function_df( const gsl_vector* pVect
     
     for( j=0; j<NUM_PARAMS; j++ ) {
-      gsl_matrix_set( pMatrixJ, i, j, dDerivatives[j] / pData->pdSigma[i] );
+      gsl_matrix_set( pMatrixJ, i, j, dDerivatives[j] * pData->pdWeight[i] );
     }
   }
@@ -93,4 +95,6 @@ int kstfit_nonlinear(
         double outScalars[] ) {
   
+  KST_UNUSED( inScalars )
+    
   const gsl_multifit_fdfsolver_type* pType;
   gsl_multifit_fdfsolver* pSolver;
@@ -160,5 +164,5 @@ int kstfit_nonlinear(
         d.pdX       = inArrays[X];
         d.pdY     = inArrays[Y];
-        d.pdSigma       = inArrays[WEIGHT];
+        d.pdWeight = inArrays[WEIGHT];
         
         function.f        = function_f;





More information about the Kst mailing list