34 if (
verbose > 0) std::cout <<
"Hello world from Least_squares_solver::optimize()" << std::endl;
51 return std::numeric_limits<double>::quiet_NaN();
63 std::cerr <<
"Error! The (0-based) entry " << j <<
" in the sigmas array is 0. sigmas must all be nonzero." << std::endl;
64 throw std::runtime_error(
"Error in mango::problem::optimize_least_squares. sigmas is not all nonzero.");
115 if (!proc0_world)
return std::numeric_limits<double>::quiet_NaN();
136 std::cout <<
"Here comes the optimal state_vector from optimize_least_squares.cpp: " <<
state_vector[0];
140 std::cout << std::endl;
157 if (least_squares_solver->
verbose > 0) std::cout <<
"Hello from least_squares_to_single_objective" << std::endl;
168 int N_terms = least_squares_solver->
N_terms;
171 for (
int j=0; j<N_terms; j++) {
172 term = (least_squares_solver->
residuals[j] - least_squares_solver->
targets[j]) / least_squares_solver->
sigmas[j];
185 double total_objective_function, temp;
188 total_objective_function = 0;
189 for (j=0; j<N_terms; j++) {
190 temp = (residuals_in[j] - targets[j]) / sigmas[j];
191 total_objective_function += temp*temp;
193 return(total_objective_function);