CAMLprim value ml_gsl_stats_minmax(value data) { size_t len = Double_array_length(data); double mi, ma; gsl_stats_minmax(&mi, &ma, Double_array_val(data), 1, len); return copy_two_double(mi, ma); }
/* BIVARIATE */ CAMLprim value ml_gsl_ran_bivariate_gaussian(value rng, value sigma_x, value sigma_y, value rho) { double x,y; gsl_ran_bivariate_gaussian(Rng_val(rng), Double_val(sigma_x), Double_val(sigma_y), Double_val(rho), &x, &y); return copy_two_double(x, y); }
CAMLprim value ml_gsl_odeiv_evolve_apply(value e, value c, value s, value syst, value t, value t1, value h, value y) { CAMLparam5(e, c, s, syst, y); double t_c = Double_val(t); double h_c = Double_val(h); LOCALARRAY(double, y_copy, Double_array_length(y)); int status; memcpy(y_copy, Double_array_val(y), Bosize_val(y)); status = gsl_odeiv_evolve_apply(ODEIV_EVOLVE_VAL(e), ODEIV_CONTROL_VAL(c), ODEIV_STEP_VAL(s), ODEIV_SYSTEM_VAL(syst), &t_c, Double_val(t1), &h_c, y_copy); /* GSL does not call the error handler for this function */ if (status) GSL_ERROR_VAL ("gsl_odeiv_evolve_apply", status, Val_unit); memcpy(Double_array_val(y), y_copy, Bosize_val(y)); CAMLreturn(copy_two_double(t_c, h_c)); }
CAMLprim value ml_gsl_min_fminimizer_x_interv(value S) { return copy_two_double(gsl_min_fminimizer_x_lower(Minimizer_val(S)), gsl_min_fminimizer_x_upper(Minimizer_val(S))); }
CAMLprim value ml_gsl_ran_dir_2d_trig_method(value rng) { double x,y; gsl_ran_dir_2d_trig_method(Rng_val(rng), &x, &y); return copy_two_double(x, y); }
CAMLprim value ml_gsl_root_fsolver_x_interv(value S) { return copy_two_double(gsl_root_fsolver_x_lower(Fsolver_val(S)), gsl_root_fsolver_x_upper(Fsolver_val(S))); }