mailr25344 - /trunk/target_functions/relax_fit.c


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

Header


Content

Posted by edward on August 27, 2014 - 18:56:
Author: bugman
Date: Wed Aug 27 18:56:05 2014
New Revision: 25344

URL: http://svn.gna.org/viewcvs/relax?rev=25344&view=rev
Log:
Clean up of the declarations in the target_functions.relax_fit C module.

The Python list objects are now declared at the start of the functions, and 
then PyList_New() is
called later on.  This allows the code to compile on certain Windows systems.


Modified:
    trunk/target_functions/relax_fit.c

Modified: trunk/target_functions/relax_fit.c
URL: 
http://svn.gna.org/viewcvs/relax/trunk/target_functions/relax_fit.c?rev=25344&r1=25343&r2=25344&view=diff
==============================================================================
--- trunk/target_functions/relax_fit.c  (original)
+++ trunk/target_functions/relax_fit.c  Wed Aug 27 18:56:05 2014
@@ -132,6 +132,7 @@
 
     /* Declarations. */
     PyObject *params_arg;
+    PyObject *list;
     int i;
 
     /* Parse the function arguments, the only argument should be the 
parameter array. */
@@ -152,7 +153,7 @@
     dchi2(dchi2_vals, values, back_calc, back_calc_grad, sd, num_times, 
num_params);
 
     /* Convert to a Python list, and scale the values. */
-    PyObject *list = PyList_New(0);
+    list = PyList_New(0);
     Py_INCREF(list);
     for (i = 0; i < num_params; i++) {
         PyList_Append(list, PyFloat_FromDouble(dchi2_vals[i] * 
scaling_matrix[i]));
@@ -170,6 +171,7 @@
 
     /* Declarations. */
     PyObject *params_arg;
+    PyObject *list, *list2;
     int j, k;
 
     /* Parse the function arguments, the only argument should be the 
parameter array. */
@@ -195,10 +197,10 @@
     d2chi2(d2chi2_vals, values, back_calc, back_calc_grad, back_calc_hess, 
sd, num_times, num_params);
 
     /* Convert to a Python list, and scale the values. */
-    PyObject *list = PyList_New(0);
+    list = PyList_New(0);
     Py_INCREF(list);
     for (j = 0; j < num_params; j++) {
-        PyObject *list2 = PyList_New(0);
+        list2 = PyList_New(0);
         Py_INCREF(list2);
         for (k = 0; k < num_params; k++) {
             PyList_Append(list2, PyFloat_FromDouble(d2chi2_vals[j][k] * 
scaling_matrix[j] * scaling_matrix[k]));
@@ -234,6 +236,7 @@
 
     /* Declarations. */
     PyObject *params_arg;
+    PyObject *list, *list2;
     int i, j;
 
     /* Parse the function arguments, the only argument should be the 
parameter array. */
@@ -248,10 +251,10 @@
     exponential_dI0(params[index_I0], params[index_R], index_I0, 
relax_times, back_calc_grad, num_times);
 
     /* Convert to a Python list of lists. */
-    PyObject *list = PyList_New(0);
+    list = PyList_New(0);
     Py_INCREF(list);
     for (i = 0; i < num_params; i++) {
-        PyObject *list2 = PyList_New(0);
+        list2 = PyList_New(0);
         Py_INCREF(list2);
         for (j = 0; j < num_times; j++) {
             PyList_Append(list2, PyFloat_FromDouble(back_calc_grad[i][j]));




Related Messages


Powered by MHonArc, Updated Wed Aug 27 19:00:02 2014