36 {
"absolute tolerance",
37 {
"absolute",
"tolerance", 0, 0, 0, },
38 { 1, 0, 0, 0, 0, }, 1, },
40 {
"relative tolerance",
41 {
"relative",
"tolerance", 0, 0, 0, },
42 { 1, 0, 0, 0, 0, }, 1, },
44 {
"compute consistent initial condition",
45 {
"compute",
"consistent",
"initial",
"condition", 0, },
46 { 1, 0, 0, 0, 0, }, 1, },
48 {
"enforce nonnegativity constraints",
49 {
"enforce",
"nonnegativity",
"constraints", 0, 0, },
50 { 1, 0, 0, 0, 0, }, 1, },
52 {
"initial step size",
53 {
"initial",
"step",
"size", 0, 0, },
54 { 1, 0, 0, 0, 0, }, 1, },
57 {
"maximum",
"order", 0, 0, 0, },
58 { 1, 1, 0, 0, 0, }, 2, },
60 {
"maximum step size",
61 {
"maximum",
"step",
"size", 0, 0, },
62 { 1, 1, 0, 0, 0, }, 2, },
65 {
"step",
"limit", 0, 0, 0, },
66 { 1, 0, 0, 0, 0, }, 1, },
72 std::ostringstream buf;
75 <<
"Options for DASSL include:\n\n"
77 <<
" ------- -----\n";
114 os << val(0) <<
"\n";
206 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
214 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
222 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
230 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
238 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
246 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
254 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
262 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
271 warning (
"dassl_options: no match for `%s'", keyword.c_str ());
283 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
297 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
311 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
315 retval =
static_cast<double> (val);
318 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
322 retval =
static_cast<double> (val);
325 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
332 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
336 retval =
static_cast<double> (val);
339 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
346 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
350 retval =
static_cast<double> (val);
354 warning (
"dassl_options: no match for `%s'", keyword.c_str ());
360 DEFUN (dassl_options, args, ,
362 @deftypefn {Built-in Function} {} dassl_options ()\n\
363 @deftypefnx {Built-in Function} {val =} dassl_options (@var{opt})\n\
364 @deftypefnx {Built-in Function} {} dassl_options (@var{opt}, @var{val})\n\
365 Query or set options for the function @code{dassl}.\n\
367 When called with no arguments, the names of all available options and\n\
368 their current values are displayed.\n\
370 Given one argument, return the value of the option @var{opt}.\n\
372 When called with two arguments, @code{dassl_options} sets the option\n\
373 @var{opt} to value @var{val}.\n\
378 @item @qcode{\"absolute tolerance\"}\n\
379 Absolute tolerance. May be either vector or scalar. If a vector, it\n\
380 must match the dimension of the state vector, and the relative\n\
381 tolerance must also be a vector of the same length.\n\
383 @item @qcode{\"relative tolerance\"}\n\
384 Relative tolerance. May be either vector or scalar. If a vector, it\n\
385 must match the dimension of the state vector, and the absolute\n\
386 tolerance must also be a vector of the same length.\n\
388 The local error test applied at each integration step is\n\
392 abs (local error in x(i))\n\
393 <= rtol(i) * abs (Y(i)) + atol(i)\n\
397 @item @qcode{\"compute consistent initial condition\"}\n\
398 If nonzero, @code{dassl} will attempt to compute a consistent set of initial\n\
399 conditions. This is generally not reliable, so it is best to provide\n\
400 a consistent set and leave this option set to zero.\n\
402 @item @qcode{\"enforce nonnegativity constraints\"}\n\
403 If you know that the solutions to your equations will always be\n\
404 non-negative, it may help to set this parameter to a nonzero\n\
405 value. However, it is probably best to try leaving this option set to\n\
406 zero first, and only setting it to a nonzero value if that doesn't\n\
409 @item @qcode{\"initial step size\"}\n\
410 Differential-algebraic problems may occasionally suffer from severe\n\
411 scaling difficulties on the first step. If you know a great deal\n\
412 about the scaling of your problem, you can help to alleviate this\n\
413 problem by specifying an initial stepsize.\n\
415 @item @qcode{\"maximum order\"}\n\
416 Restrict the maximum order of the solution method. This option must\n\
417 be between 1 and 5, inclusive.\n\
419 @item @qcode{\"maximum step size\"}\n\
420 Setting the maximum stepsize will avoid passing over very large\n\
421 regions (default is not specified).\n\
423 @item @qcode{\"step limit\"}\n\
424 Maximum number of integration steps to attempt on a single call to the\n\
425 underlying Fortran code.\n\
431 int nargin = args.
length ();
437 else if (nargin == 1 || nargin == 2)
439 std::string keyword = args(0).string_value ();
449 error (
"dassl_options: expecting keyword as first argument");
octave_idx_type maximum_order(void) const
void set_maximum_order(octave_idx_type val)
static octave_value_list show_DASSL_options(const std::string &keyword)
Array< double > absolute_tolerance(void) const
void set_step_limit(octave_idx_type val)
OCTINTERP_API void print_usage(void)
octave_idx_type length(void) const
void set_relative_tolerance(double val)
int int_value(bool req_int=false, bool frc_str_conv=false) const
Array< double > relative_tolerance(void) const
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
void set_enforce_nonnegativity_constraints(octave_idx_type val)
static DASSL_options dassl_opts
octave_idx_type compute_consistent_initial_condition(void) const
octave_idx_type enforce_nonnegativity_constraints(void) const
int keyword_almost_match(const char *const *std, int *min_len, const std::string &s, int min_toks_to_match, int max_toks)
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.
void set_absolute_tolerance(double val)
void octave_print_internal(std::ostream &, char, bool)
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type step_limit(void) const
void set_maximum_step_size(double val)
double initial_step_size(void) const
double maximum_step_size(void) const
void set_initial_step_size(double val)
static void print_DASSL_options(std::ostream &os)
double double_value(bool frc_str_conv=false) const
void set_compute_consistent_initial_condition(octave_idx_type val)
static DASSL_options_struct DASSL_options_table[]
static void set_DASSL_options(const std::string &keyword, const octave_value &val)