26 #if defined (HAVE_CONFIG_H)
74 tmp =
feval (quad_fcn, args, 1);
81 if (! tmp.
length () || ! tmp(0).is_defined ())
86 warning (
"quad: ignoring imaginary part returned from user-supplied function");
90 retval = tmp(0).xdouble_value (
"quad: expecting user supplied function to return numeric value");
110 tmp =
feval (quad_fcn, args, 1);
117 if (! tmp.
length () || ! tmp(0).is_defined ())
122 warning (
"quad: ignoring imaginary part returned from user-supplied function");
126 retval = tmp(0).xfloat_value (
"quad: expecting user supplied function to return numeric value");
178 int nargin = args.length ();
180 if (nargin < 3 || nargin > 5)
189 error (
"quad: invalid recursive call");
195 if (args(1).is_single_type () || args(2).is_single_type ())
197 float a = args(1).xfloat_value (
"quad: lower limit of integration A must be a scalar");
198 float b = args(2).xfloat_value (
"quad: upper limit of integration B must be a scalar");
226 bool have_sing =
false;
234 error (
"quad: singularities not allowed on infinite intervals");
238 sing = args(4).xfloat_vector_value (
"quad: fifth argument SING must be a vector of singularities");
242 tol = args(3).xfloat_vector_value (
"quad: TOL must be a 1 or 2-element vector");
244 switch (tol.
numel ())
247 quad_opts.set_single_precision_relative_tolerance (tol (1));
251 quad_opts.set_single_precision_absolute_tolerance (tol (0));
255 error (
"quad: TOL must be a 1 or 2-element vector");
289 retval =
ovl (val, ier, nfev, abserr);
294 double a = args(1).xdouble_value (
"quad: lower limit of integration A must be a scalar");
295 double b = args(2).xdouble_value (
"quad: upper limit of integration B must be a scalar");
322 bool have_sing =
false;
330 error (
"quad: singularities not allowed on infinite intervals");
334 sing = args(4).xvector_value (
"quad: fifth argument SING must be a vector of singularities");
338 tol = args(3).xvector_value (
"quad: TOL must be a 1 or 2-element vector");
340 switch (tol.
numel ())
343 quad_opts.set_relative_tolerance (tol (1));
347 quad_opts.set_absolute_tolerance (tol (0));
351 error (
"quad: TOL must be a 1 or 2-element vector");
384 retval =
ovl (val, ier, nfev, abserr);
static Quad_options quad_opts
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
virtual double integrate(void)
virtual float float_integrate(void)
octave_idx_type length(void) const
bool is_defined(void) const
OCTINTERP_API void print_usage(void)
void warning(const char *fmt,...)
void error(const char *fmt,...)
#define panic_impossible()
void err_user_supplied_eval(const char *name)
octave_value get_function_handle(interpreter &interp, const octave_value &arg, const std::string ¶meter_name)
F77_RET_T const F77_DBLE * x
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
DEFMETHODX("quad", Fquad, interp, args,, doc:)
static double quad_user_function(double x)
static bool warned_imaginary
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value quad_fcn
static float quad_float_user_function(float x)