33 double* base_case_residual_vector =
new double[
N_terms];
38 int j_parameter, j_term;
40 *base_case_objective_function = 0;
42 for (j_term=0; j_term<
N_terms; j_term++) {
43 term = (base_case_residual_vector[j_term] -
targets[j_term]) /
sigmas[j_term];
44 *base_case_objective_function += term*term;
45 for (j_parameter=0; j_parameter<
N_parameters; j_parameter++) {
46 gradient[j_parameter] += 2 * (term /
sigmas[j_term]) * Jacobian[j_parameter*
N_terms + j_term];
50 delete[] base_case_residual_vector;