Author: bugman Date: Sat Nov 29 13:29:52 2014 New Revision: 26835 URL: http://svn.gna.org/viewcvs/relax?rev=26835&view=rev Log: Split the saturation recovery exponential equations and partial derivatives into their own C file. Added: trunk/target_functions/exponential_sat.c - copied, changed from r26834, trunk/target_functions/exponential.c Modified: trunk/sconstruct trunk/target_functions/exponential.c Modified: trunk/sconstruct URL: http://svn.gna.org/viewcvs/relax/trunk/sconstruct?rev=26835&r1=26834&r2=26835&view=diff ============================================================================== --- trunk/sconstruct (original) +++ trunk/sconstruct Sat Nov 29 13:29:52 2014 @@ -567,6 +567,7 @@ # File names. files = ['c_chi2.c', 'exponential.c', + 'exponential_sat.c', 'relax_fit.c'] # Construct the python include path (for Python.h). Modified: trunk/target_functions/exponential.c URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/exponential.c?rev=26835&r1=26834&r2=26835&view=diff ============================================================================== --- trunk/target_functions/exponential.c (original) +++ trunk/target_functions/exponential.c Sat Nov 29 13:29:52 2014 @@ -50,31 +50,6 @@ } -void exponential_sat(double Iinf, double R, double relax_times[MAX_DATA], double back_calc[MAX_DATA], int num_times) { - /* Back calculate the intensity values from the exponential of the saturation recovery experiment. - * - * The function used is:: - * - * I = Iinf * (1 - exp(-R.t)). - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc[i] = 0.0; - - /* Back calculate. */ - else - back_calc[i] = Iinf * (1.0 - exp(-relax_times[i] * R)); - - } -} - - void exponential_dI0(double I0, double R, int param_index, double relax_times[MAX_DATA], double back_calc_grad[MAX_PARAMS][MAX_DATA], int num_times) { /* Calculate the dI0 partial derivate of the 2-parameter exponential curve. */ @@ -91,26 +66,6 @@ /* The partial derivate. */ else back_calc_grad[param_index][i] = exp(-relax_times[i] * R); - } -} - - -void exponential_sat_dIinf(double Iinf, double R, int param_index, double relax_times[MAX_DATA], double back_calc_grad[MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dIinf partial derivate of the saturation recovery exponential curve. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc_grad[param_index][i] = 0.0; - - /* The partial derivate. */ - else - back_calc_grad[param_index][i] = (1.0 - exp(-relax_times[i] * R)); } } @@ -135,26 +90,6 @@ } -void exponential_sat_dR(double Iinf, double R, int param_index, double relax_times[MAX_DATA], double back_calc_grad[MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dR partial derivate of the 2-parameter exponential curve. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc_grad[param_index][i] = Iinf * relax_times[i]; - - /* The partial derivate. */ - else - back_calc_grad[param_index][i] = Iinf * relax_times[i] * exp(-relax_times[i] * R); - } -} - - void exponential_dI02(double I0, double R, int I0_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { /* Calculate the dI0 double partial derivate of the 2-parameter exponential curve. */ @@ -166,21 +101,6 @@ for (i = 0; i < num_times; i++) { /* Everything is zero! */ back_calc_hess[I0_index][I0_index][i] = 0.0; - } -} - - -void exponential_sat_dIinf2(double Iinf, double R, int Iinf_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dIinf double partial derivate of the saturation recovery experiment. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Everything is zero! */ - back_calc_hess[Iinf_index][Iinf_index][i] = 0.0; } } @@ -208,29 +128,6 @@ } -void exponential_sat_dR_dIinf(double Iinf, double R, int R_index, int Iinf_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dR, dIinf second partial derivate of the 2-parameter exponential curve. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc_hess[Iinf_index][R_index][i] = relax_times[i]; - - /* The second partial derivate. */ - else - back_calc_hess[Iinf_index][R_index][i] = relax_times[i] * exp(-relax_times[i] * R); - - /* Hessian symmetry. */ - back_calc_hess[R_index][Iinf_index][i] = back_calc_hess[Iinf_index][R_index][i]; - } -} - - void exponential_dR2(double I0, double R, int R_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { /* Calculate the dR second partial derivate of the 2-parameter exponential curve. */ @@ -249,23 +146,3 @@ back_calc_hess[R_index][R_index][i] = I0 * square(relax_times[i]) * exp(-relax_times[i] * R); } } - - -void exponential_sat_dR2(double Iinf, double R, int R_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dR second partial derivate of the saturation recovery experiment. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc_hess[R_index][R_index][i] = -Iinf * square(relax_times[i]); - - /* The partial derivate. */ - else - back_calc_hess[R_index][R_index][i] = -Iinf * square(relax_times[i]) * exp(-relax_times[i] * R); - } -} Copied: trunk/target_functions/exponential_sat.c (from r26834, trunk/target_functions/exponential.c) URL: http://svn.gna.org/viewcvs/relax/trunk/target_functions/exponential_sat.c?p2=trunk/target_functions/exponential_sat.c&p1=trunk/target_functions/exponential.c&r1=26834&r2=26835&rev=26835&view=diff ============================================================================== --- trunk/target_functions/exponential.c (original) +++ trunk/target_functions/exponential_sat.c Sat Nov 29 13:29:52 2014 @@ -25,31 +25,6 @@ #include "exponential.h" -void exponential(double I0, double R, double relax_times[MAX_DATA], double back_calc[MAX_DATA], int num_times) { - /* Function to back calculate the intensity values from an exponential. - * - * The function used is:: - * - * I = I0 * exp(-R.t) - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc[i] = I0; - - /* Back calculate. */ - else - back_calc[i] = I0 * exp(-relax_times[i] * R); - - } -} - - void exponential_sat(double Iinf, double R, double relax_times[MAX_DATA], double back_calc[MAX_DATA], int num_times) { /* Back calculate the intensity values from the exponential of the saturation recovery experiment. * @@ -75,26 +50,6 @@ } -void exponential_dI0(double I0, double R, int param_index, double relax_times[MAX_DATA], double back_calc_grad[MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dI0 partial derivate of the 2-parameter exponential curve. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc_grad[param_index][i] = 1.0; - - /* The partial derivate. */ - else - back_calc_grad[param_index][i] = exp(-relax_times[i] * R); - } -} - - void exponential_sat_dIinf(double Iinf, double R, int param_index, double relax_times[MAX_DATA], double back_calc_grad[MAX_PARAMS][MAX_DATA], int num_times) { /* Calculate the dIinf partial derivate of the saturation recovery exponential curve. */ @@ -111,26 +66,6 @@ /* The partial derivate. */ else back_calc_grad[param_index][i] = (1.0 - exp(-relax_times[i] * R)); - } -} - - -void exponential_dR(double I0, double R, int param_index, double relax_times[MAX_DATA], double back_calc_grad[MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dR partial derivate of the 2-parameter exponential curve. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc_grad[param_index][i] = -I0 * relax_times[i]; - - /* The partial derivate. */ - else - back_calc_grad[param_index][i] = -I0 * relax_times[i] * exp(-relax_times[i] * R); } } @@ -155,21 +90,6 @@ } -void exponential_dI02(double I0, double R, int I0_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dI0 double partial derivate of the 2-parameter exponential curve. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Everything is zero! */ - back_calc_hess[I0_index][I0_index][i] = 0.0; - } -} - - void exponential_sat_dIinf2(double Iinf, double R, int Iinf_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { /* Calculate the dIinf double partial derivate of the saturation recovery experiment. */ @@ -181,29 +101,6 @@ for (i = 0; i < num_times; i++) { /* Everything is zero! */ back_calc_hess[Iinf_index][Iinf_index][i] = 0.0; - } -} - - -void exponential_dR_dI0(double I0, double R, int R_index, int IO_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dR, dI0 second partial derivate of the 2-parameter exponential curve. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc_hess[IO_index][R_index][i] = -relax_times[i]; - - /* The second partial derivate. */ - else - back_calc_hess[IO_index][R_index][i] = -relax_times[i] * exp(-relax_times[i] * R); - - /* Hessian symmetry. */ - back_calc_hess[R_index][IO_index][i] = back_calc_hess[IO_index][R_index][i]; } } @@ -231,26 +128,6 @@ } -void exponential_dR2(double I0, double R, int R_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { - /* Calculate the dR second partial derivate of the 2-parameter exponential curve. - */ - - /* Declarations. */ - int i; - - /* Loop over the time points. */ - for (i = 0; i < num_times; i++) { - /* Zero Rx value. */ - if (R == 0.0) - back_calc_hess[R_index][R_index][i] = I0 * square(relax_times[i]); - - /* The partial derivate. */ - else - back_calc_hess[R_index][R_index][i] = I0 * square(relax_times[i]) * exp(-relax_times[i] * R); - } -} - - void exponential_sat_dR2(double Iinf, double R, int R_index, double relax_times[MAX_DATA], double back_calc_hess[MAX_PARAMS][MAX_PARAMS][MAX_DATA], int num_times) { /* Calculate the dR second partial derivate of the saturation recovery experiment. */