/**
       * C++ version of gsl_multifit_fdfsolver_position().
       * Note that it is s and not the return value
       * that owns the data in the return value.
       * @param s The fdfsolver.
       * @return The current estimate of the position.
       */
      inline static vector position( fdfsolver const& s ){
	vector result( gsl_multifit_fdfsolver_position( s.get() ) );
#ifdef __GXX_EXPERIMENTAL_CXX0X__
	return std::move( result );
#else
	return result;
#endif
      }
Beispiel #2
0
static void
test_fdf_checksol(const char *sname, const char *pname,
                  const double epsrel, gsl_multifit_fdfsolver *s,
                  test_fdf_problem *problem)
{
  gsl_multifit_function_fdf *fdf = problem->fdf;
  const double *sigma = problem->sigma;
  gsl_vector *f = gsl_multifit_fdfsolver_residual(s);
  gsl_vector *x = gsl_multifit_fdfsolver_position(s);
  double sumsq;

  /* check solution vector x and sumsq = ||f||^2 */
  gsl_blas_ddot(f, f, &sumsq);
  (problem->checksol)(x->data, sumsq, epsrel, sname, pname);

#if 1
  /* check variances */
  if (sigma)
    {
      const size_t n = fdf->n;
      const size_t p = fdf->p;
      size_t i;
      gsl_matrix * J = gsl_matrix_alloc(n, p);
      gsl_matrix * covar = gsl_matrix_alloc (p, p);

      gsl_multifit_fdfsolver_jac (s, J);
      gsl_multifit_covar(J, 0.0, covar);

      for (i = 0; i < p; i++) 
        {
          double ei = sqrt(sumsq/(n-p))*sqrt(gsl_matrix_get(covar,i,i));
          gsl_test_rel (ei, sigma[i], epsrel, 
                        "%s/%s, sigma(%d)", sname, pname, i) ;
        }

      gsl_matrix_free (J);
      gsl_matrix_free (covar);
    }
#endif
}
      /**
       * C++ version of gsl_multifit_fdfsolver_position().
       * Note that it is @c this fsolver and not the return value
       * that owns the data in the return value.
       * @return The current estimate of the position.
       */
      vector const& position(){
	p_v.wrap_gsl_vector_without_ownership( gsl_multifit_fdfsolver_position( get() ) );
	return p_v;
      }
Beispiel #4
0
gsl_vector *
gsl_multifit_fdfridge_position (const gsl_multifit_fdfridge * w)
{
  return gsl_multifit_fdfsolver_position(w->s);
}