Author: bugman Date: Fri Apr 5 19:13:55 2013 New Revision: 19396 URL: http://svn.gna.org/viewcvs/relax?rev=19396&view=rev Log: Simplified the code of the relax_fit C module. 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=19396&r1=19395&r2=19396&view=diff ============================================================================== --- trunk/target_functions/relax_fit.c (original) +++ trunk/target_functions/relax_fit.c Fri Apr 5 19:13:55 2013 @@ -53,40 +53,26 @@ relax_times = (double *) malloc(sizeof(double)*num_times); scaling_matrix = (double *) malloc(sizeof(double)*num_params); - /* Place the value elements into the C array */ + /* Place the parameter related arguments into C arrays */ + for (i = 0; i < num_params; i++) { + /* The diagonalised scaling matrix list argument element */ + element = PySequence_GetItem(scaling_matrix_arg, i); + scaling_matrix[i] = PyFloat_AsDouble(element); + } + + /* Place the time related arguments into C arrays */ for (i = 0; i < num_times; i++) { - /* Get the element */ + /* The value argument element */ element = PySequence_GetItem(values_arg, i); - - /* Convert to a C double */ values[i] = PyFloat_AsDouble(element); - } - - /* Place the sd elements into the C array */ - for (i = 0; i < num_times; i++) { - /* Get the element */ + + /* The sd argument element */ element = PySequence_GetItem(sd_arg, i); - - /* Convert to a C double */ sd[i] = PyFloat_AsDouble(element); - } - - /* Place the relax_times elements into the C array */ - for (i = 0; i < num_times; i++) { - /* Get the element */ + + /* The relax_times argument element */ element = PySequence_GetItem(relax_times_arg, i); - - /* Convert to a C double */ relax_times[i] = PyFloat_AsDouble(element); - } - - /* Place the scaling matrix elements into the C array */ - for (i = 0; i < num_params; i++) { - /* Get the element */ - element = PySequence_GetItem(scaling_matrix_arg, i); - - /* Convert to a C double */ - scaling_matrix[i] = PyFloat_AsDouble(element); } /* Return nothing */