36 {
"absolute tolerance",
37 {
"absolute",
"tolerance", 0, 0, },
38 { 1, 0, 0, 0, }, 1, },
40 {
"relative tolerance",
41 {
"relative",
"tolerance", 0, 0, },
42 { 1, 0, 0, 0, }, 1, },
44 {
"integration method",
45 {
"integration",
"method", 0, 0, },
46 { 3, 0, 0, 0, }, 1, },
48 {
"initial step size",
49 {
"initial",
"step",
"size", 0, },
50 { 3, 0, 0, 0, }, 1, },
53 {
"maximum",
"order", 0, 0, },
54 { 2, 1, 0, 0, }, 2, },
56 {
"maximum step size",
57 {
"maximum",
"step",
"size", 0, },
58 { 2, 1, 0, 0, }, 2, },
60 {
"minimum step size",
61 {
"minimum",
"step",
"size", 0, },
62 { 2, 0, 0, 0, }, 1, },
65 {
"step",
"limit", 0, 0, },
66 { 1, 0, 0, 0, }, 1, },
72 std::ostringstream buf;
75 <<
"Options for LSODE include:\n\n"
77 <<
" ------- -----\n";
194 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
202 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
210 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
218 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
226 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
234 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
242 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
250 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
259 warning (
"lsode_options: no match for `%s'", keyword.c_str ());
271 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
285 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
292 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
297 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
304 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
308 retval =
static_cast<double> (val);
311 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
318 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
325 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
329 retval =
static_cast<double> (val);
333 warning (
"lsode_options: no match for `%s'", keyword.c_str ());
339 DEFUN (lsode_options, args, ,
341 @deftypefn {Built-in Function} {} lsode_options ()\n\
342 @deftypefnx {Built-in Function} {val =} lsode_options (@var{opt})\n\
343 @deftypefnx {Built-in Function} {} lsode_options (@var{opt}, @var{val})\n\
344 Query or set options for the function @code{lsode}.\n\
346 When called with no arguments, the names of all available options and\n\
347 their current values are displayed.\n\
349 Given one argument, return the value of the option @var{opt}.\n\
351 When called with two arguments, @code{lsode_options} sets the option\n\
352 @var{opt} to value @var{val}.\n\
357 @item @qcode{\"absolute tolerance\"}\n\
358 Absolute tolerance. May be either vector or scalar. If a vector, it\n\
359 must match the dimension of the state vector.\n\
361 @item @qcode{\"relative tolerance\"}\n\
362 Relative tolerance parameter. Unlike the absolute tolerance, this\n\
363 parameter may only be a scalar.\n\
365 The local error test applied at each integration step is\n\
369 abs (local error in x(i)) <= ...\n\
370 rtol * abs (y(i)) + atol(i)\n\
374 @item @qcode{\"integration method\"}\n\
375 A string specifying the method of integration to use to solve the ODE\n\
376 system. Valid values are\n\
379 @item @qcode{\"adams\"}\n\
380 @itemx @qcode{\"non-stiff\"}\n\
381 No Jacobian used (even if it is available).\n\
383 @item @qcode{\"bdf\"}\n\
384 @itemx @qcode{\"stiff\"}\n\
385 Use stiff backward differentiation formula (BDF) method. If a\n\
386 function to compute the Jacobian is not supplied, @code{lsode} will\n\
387 compute a finite difference approximation of the Jacobian matrix.\n\
390 @item @qcode{\"initial step size\"}\n\
391 The step size to be attempted on the first step (default is determined\n\
394 @item @qcode{\"maximum order\"}\n\
395 Restrict the maximum order of the solution method. If using the Adams\n\
396 method, this option must be between 1 and 12. Otherwise, it must be\n\
397 between 1 and 5, inclusive.\n\
399 @item @qcode{\"maximum step size\"}\n\
400 Setting the maximum stepsize will avoid passing over very large\n\
401 regions (default is not specified).\n\
403 @item @qcode{\"minimum step size\"}\n\
404 The minimum absolute step size allowed (default is 0).\n\
406 @item @qcode{\"step limit\"}\n\
407 Maximum number of steps allowed (default is 100000).\n\
413 int nargin = args.
length ();
419 else if (nargin == 1 || nargin == 2)
421 std::string keyword = args(0).string_value ();
431 error (
"lsode_options: expecting keyword as first argument");
double relative_tolerance(void) const
static octave_value_list show_LSODE_options(const std::string &keyword)
void set_initial_step_size(double val)
double maximum_step_size(void) const
Array< double > absolute_tolerance(void) const
double initial_step_size(void) const
OCTINTERP_API void print_usage(void)
octave_idx_type length(void) const
void set_absolute_tolerance(double val)
int int_value(bool req_int=false, bool frc_str_conv=false) const
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
std::string integration_method(void) const
static LSODE_options_struct LSODE_options_table[]
void set_maximum_step_size(double val)
void set_relative_tolerance(double val)
std::string string_value(bool force=false) const
void set_minimum_step_size(double val)
octave_idx_type step_limit(void) const
void set_step_limit(octave_idx_type val)
int keyword_almost_match(const char *const *std, int *min_len, const std::string &s, int min_toks_to_match, int max_toks)
static void set_LSODE_options(const std::string &keyword, const octave_value &val)
void warning(const char *fmt,...)
Handles the reference counting for all the derived classes.
octave_idx_type length(void) const
Number of elements in the array.
octave_idx_type maximum_order(void) const
static LSODE_options lsode_opts
void octave_print_internal(std::ostream &, char, bool)
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
static void print_LSODE_options(std::ostream &os)
void set_maximum_order(octave_idx_type val)
double double_value(bool frc_str_conv=false) const
double minimum_step_size(void) const
void set_integration_method(const std::string &val)