23 #if defined (HAVE_CONFIG_H) 46 #include "Quad-opts.cc" 73 catch (octave::execution_exception&
e)
78 if (!
tmp.length () || !
tmp(0).is_defined ())
83 warning (
"quad: ignoring imaginary part returned from user-supplied function");
87 retval =
tmp(0).xdouble_value (
"quad: expecting user supplied function to return numeric value");
109 catch (octave::execution_exception&
e)
114 if (!
tmp.length () || !
tmp(0).is_defined ())
119 warning (
"quad: ignoring imaginary part returned from user-supplied function");
123 retval =
tmp(0).xfloat_value (
"quad: expecting user supplied function to return numeric value");
175 int nargin = args.length ();
188 error (
"quad: invalid recursive call");
192 if (args(0).is_function_handle () || args(0).is_inline_function ())
198 fname.append (fcn_name);
199 fname.append (
"(x) y = ");
207 error (
"quad: FCN argument is not a valid function name or handle");
211 if (args(1).is_single_type () || args(2).is_single_type ())
213 float a = args(1).xfloat_value (
"quad: lower limit of integration A must be a scalar");
214 float b = args(2).xfloat_value (
"quad: upper limit of integration B must be a scalar");
242 bool have_sing =
false;
250 error (
"quad: singularities not allowed on infinite intervals");
254 sing = args(4).xfloat_vector_value (
"quad: fifth argument SING must be a vector of singularities");
258 tol = args(3).xfloat_vector_value (
"quad: TOL must be a 1 or 2-element vector");
260 switch (tol.
numel ())
263 quad_opts.set_single_precision_relative_tolerance (tol (1));
267 quad_opts.set_single_precision_absolute_tolerance (tol (0));
271 error (
"quad: TOL must be a 1 or 2-element vector");
280 iq.set_options (quad_opts);
288 dq.set_options (quad_opts);
294 dq.set_options (quad_opts);
310 double a = args(1).xdouble_value (
"quad: lower limit of integration A must be a scalar");
311 double b = args(2).xdouble_value (
"quad: upper limit of integration B must be a scalar");
338 bool have_sing =
false;
346 error (
"quad: singularities not allowed on infinite intervals");
350 sing = args(4).vector_value (
"quad: fifth argument SING must be a vector of singularities");
354 tol = args(3).xvector_value (
"quad: TOL must be a 1 or 2-element vector");
356 switch (tol.
numel ())
359 quad_opts.set_relative_tolerance (tol (1));
363 quad_opts.set_absolute_tolerance (tol (0));
367 error (
"quad: TOL must be a 1 or 2-element vector");
375 iq.set_options (quad_opts);
383 dq.set_options (quad_opts);
389 dq.set_options (quad_opts);
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
virtual double integrate(void)
virtual float float_integrate(void)
OCTINTERP_API void print_usage(void)
identity matrix If supplied two scalar respectively For allows like xample val
double quad_user_function(double x)
void error(const char *fmt,...)
#define DEFMETHODX(name, fname, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method with certain internal name.
std::string unique_symbol_name(const std::string &basename)
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
float quad_float_user_function(float x)
#define panic_impossible()
static bool warned_imaginary
static octave_function * quad_fcn
void warning(const char *fmt,...)
OCTAVE_EXPORT octave_value_list Fquad(octave::interpreter &interp, const octave_value_list &args, int) ar
octave::unwind_protect frame
void err_user_supplied_eval(const char *name)
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
octave_function * extract_function(const octave_value &arg, const std::string &warn_for, const std::string &fname, const std::string &header, const std::string &trailer)
void add_method(T *obj, void(T::*method)(void))
void clear_function(const std::string &name)
virtual octave_function * function_value(bool silent=false)
octave_idx_type numel(void) const
Number of elements in the array.
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x