Exemplo n.º 1
0
      /**
       * The default constructor creates a new fsolver with n elements.
       * @param T The fsolver type.
       * @param n The number of elements in the fsolver.
       * @param p The number of predictor variables
       */
      explicit fsolver( type const* T, size_t const n, size_t const p ){
	ccgsl_pointer = gsl_multifit_fsolver_alloc( T, n, p );
	// just plausibly we could allocate fsolver but not count
	try { count = new size_t; } catch( std::bad_alloc& e ){
	  // try to tidy up before rethrowing
	  gsl_multifit_fsolver_free( ccgsl_pointer );
	  throw e;
	}
	*count = 1; // initially there is just one reference to ccgsl_pointer
      }
Exemplo n.º 2
0
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;	
}