DEFUN_DLD(GSL_OCTAVE_NAME, args, nargout, "\ function y = GSL_OCTAVE_NAME (x)\n\n\ GSL_FUNC_DOCSTRING \n\ [y, err] = GSL_OCTAVE_NAME (...)\n\n\ err contains an estimate of the absolute error in the value y.\n\n\ This function is from the GNU Scientific Library,\n\ see http://www.gnu.org/software/gsl/ for documentation.\n\ ") { int i; gsl_set_error_handler (octave_gsl_errorhandler); if(args.length() != 1) { print_usage ("GSL_OCTAVE_NAME"); return octave_value(); } if(!args(0).is_real_type()) { error("The argument must be real."); print_usage ("GSL_OCTAVE_NAME"); return octave_value(); } NDArray x = args(0).array_value(); NDArray y(x.dims()); int lx = x.length(); // printf("length: %d\n", lx); // printf("nargout: %d\n", nargout); if(nargout < 2) { for(i = 0; i < lx; i++) { y.xelem(i) = GSL_FUNC_NAME (x.xelem(i)); } return octave_value(y); } else { NDArray err(x.dims()); gsl_sf_result result; octave_value_list retval; for(i = 0; i < lx; i++) { GSL_FUNC_NAME_e (x.xelem(i), &result); y.xelem(i) = result.val; err.xelem(i) = result.err; } retval(1) = octave_value(err); retval(0) = octave_value(y); return retval; } return octave_value(); } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */