mailr25304 - /trunk/target_functions/c_chi2.c


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on August 26, 2014 - 18:09:
Author: bugman
Date: Tue Aug 26 18:09:39 2014
New Revision: 25304

URL: http://svn.gna.org/viewcvs/relax?rev=25304&view=rev
Log:
Changed the internal variables of the chi-squared gradient C code to match 
the Python code.


Modified:
    trunk/target_functions/c_chi2.c

Modified: trunk/target_functions/c_chi2.c
URL: 
http://svn.gna.org/viewcvs/relax/trunk/target_functions/c_chi2.c?rev=25304&r1=25303&r2=25304&view=diff
==============================================================================
--- trunk/target_functions/c_chi2.c     (original)
+++ trunk/target_functions/c_chi2.c     Tue Aug 26 18:09:39 2014
@@ -103,13 +103,13 @@
     */
 
     /* Declarations. */
-    int data_index, param_index;
+    int i, j;
 
     /* Calculate the chi-squared gradient. */
-    for (param_index = 0; param_index < num_params; ++param_index) {
-        dchi2[param_index] = 0.0;
-        for (data_index = 0; data_index < num_points; ++data_index) {
-            dchi2[param_index] += -2.0 / square(errors[data_index]) * 
(data[data_index] - back_calc_vals[data_index]) * 
back_calc_grad[param_index][data_index];
+    for (j = 0; j < num_params; ++j) {
+        dchi2[j] = 0.0;
+        for (i = 0; i < num_points; ++i) {
+            dchi2[j] += -2.0 / square(errors[i]) * (data[i] - 
back_calc_vals[i]) * back_calc_grad[j][i];
         }
     }
 }




Related Messages


Powered by MHonArc, Updated Tue Aug 26 18:40:02 2014