/** * C++ version of gsl_multifit_fsolver_set(). * @param s The fsolver. * @param f The function. * @param x The initial guess of the fit. * @return Error code on failure. */ inline static int set( fsolver& s, function* f, vector const& x ){ int const result = gsl_multifit_fsolver_set( s.get(), f, x.get() ); s.x_v.wrap_gsl_vector_without_ownership( s.get()->x ); s.f_v.wrap_gsl_vector_without_ownership( s.get()->f ); s.dx_v.wrap_gsl_vector_without_ownership( s.get()->dx ); return result; }
/** * C++ version of gsl_multifit_fsolver_set(). * @param f The function. * @param x The initial guess of the fit. * @return Error code on failure. */ int set( function* f, vector const& x ){ int const result = gsl_multifit_fsolver_set( get(), f, x.get() ); x_v.wrap_gsl_vector_without_ownership( get()->x ); f_v.wrap_gsl_vector_without_ownership( get()->f ); dx_v.wrap_gsl_vector_without_ownership( get()->dx ); return result; }
int MultiFitter::MainF() { multifit_fdfsolver_type = gsl_multifit_fdfsolver_lmsder; sf = gsl_multifit_fsolver_alloc (multifit_fsolver_type, n, p); gsl_multifit_fsolver_set (sf, &Ff, &x.vector); do { iter++; status = gsl_multifit_fsolver_iterate (sf); status = gsl_multifit_test_delta (sf->dx, sf->x, epsabs, epsrel); } while (status == GSL_CONTINUE && iter < max_iter); return status; }