Mercurial > forge
view main/gsl/src/int_to_double.cc.template @ 2613:10a324ca4214 octave-forge
escape {} in help.
author | adb014 |
---|---|
date | Fri, 06 Oct 2006 23:20:34 +0000 |
parents | cda668d89f21 |
children |
line wrap: on
line source
DEFUN_DLD(GSL_OCTAVE_NAME, args, nargout, "\ -*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{y} =} GSL_OCTAVE_NAME (@var{n})\n\ @deftypefnx {Loadable Function} {[@var{y}, @var{err}] =} GSL_OCTAVE_NAME (@dots{})\n\ \n\ GSL_FUNC_DOCSTRING \n\ @var{err} contains an estimate of the absolute error in the value @var{y}.\n\ \n\ This function is from the GNU Scientific Library,\n\ see @url{http://www.gnu.org/software/gsl/} for documentation.\n\ @end deftypefn\n\ ") { int i; gsl_set_error_handler (octave_gsl_errorhandler); if(args.length() != 1) { print_usage (); return octave_value(); } if(!args(0).is_real_type()) { error("The argument must be real."); print_usage (); 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 (static_cast<int>(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 (static_cast<int>(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_list(); } /* ;;; Local Variables: *** ;;; mode: C++ *** ;;; End: *** */