25 struct DASSL_options_struct
30 int min_toks_to_match;
35 static DASSL_options_struct DASSL_options_table [] =
37 {
"absolute tolerance",
38 {
"absolute",
"tolerance",
nullptr,
nullptr,
nullptr, },
39 { 1, 0, 0, 0, 0, }, 1, },
41 {
"relative tolerance",
42 {
"relative",
"tolerance",
nullptr,
nullptr,
nullptr, },
43 { 1, 0, 0, 0, 0, }, 1, },
45 {
"compute consistent initial condition",
46 {
"compute",
"consistent",
"initial",
"condition",
nullptr, },
47 { 1, 0, 0, 0, 0, }, 1, },
49 {
"enforce nonnegativity constraints",
50 {
"enforce",
"nonnegativity",
"constraints",
nullptr,
nullptr, },
51 { 1, 0, 0, 0, 0, }, 1, },
53 {
"initial step size",
54 {
"initial",
"step",
"size",
nullptr,
nullptr, },
55 { 1, 0, 0, 0, 0, }, 1, },
58 {
"maximum",
"order",
nullptr,
nullptr,
nullptr, },
59 { 1, 1, 0, 0, 0, }, 2, },
61 {
"maximum step size",
62 {
"maximum",
"step",
"size",
nullptr,
nullptr, },
63 { 1, 1, 0, 0, 0, }, 2, },
66 {
"step",
"limit",
nullptr,
nullptr,
nullptr, },
67 { 1, 0, 0, 0, 0, }, 1, },
71 print_DASSL_options (std::ostream& os)
73 std::ostringstream buf;
76 <<
"Options for DASSL include:\n\n"
78 <<
" ------- -----\n";
80 DASSL_options_struct *list = DASSL_options_table;
84 << std::setiosflags (std::ios::left) << std::setw (50)
86 << std::resetiosflags (std::ios::left)
91 if (val.
numel () == 1)
106 << std::setiosflags (std::ios::left) << std::setw (50)
108 << std::resetiosflags (std::ios::left)
113 if (val.
numel () == 1)
115 os << val(0) <<
"\n";
128 << std::setiosflags (std::ios::left) << std::setw (50)
130 << std::resetiosflags (std::ios::left)
140 << std::setiosflags (std::ios::left) << std::setw (50)
142 << std::resetiosflags (std::ios::left)
152 << std::setiosflags (std::ios::left) << std::setw (50)
154 << std::resetiosflags (std::ios::left)
164 << std::setiosflags (std::ios::left) << std::setw (50)
166 << std::resetiosflags (std::ios::left)
176 << std::setiosflags (std::ios::left) << std::setw (50)
178 << std::resetiosflags (std::ios::left)
188 << std::setiosflags (std::ios::left) << std::setw (50)
190 << std::resetiosflags (std::ios::left)
202 set_DASSL_options (
const std::string& keyword,
const octave_value& val)
204 DASSL_options_struct *list = DASSL_options_table;
207 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
214 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
221 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
228 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
235 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
242 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
249 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
256 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
264 warning (
"dassl_options: no match for `%s'", keyword.c_str ());
269 show_DASSL_options (
const std::string& keyword)
273 DASSL_options_struct *list = DASSL_options_table;
276 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
280 if (val.
numel () == 1)
290 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
294 if (val.
numel () == 1)
304 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
308 retval =
static_cast<double> (val);
311 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
315 retval =
static_cast<double> (val);
318 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
325 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
329 retval =
static_cast<double> (val);
332 keyword, list[6].min_toks_to_match,
MAX_TOKENS))
339 keyword, list[7].min_toks_to_match,
MAX_TOKENS))
343 retval =
static_cast<double> (val);
347 warning (
"dassl_options: no match for `%s'", keyword.c_str ());
355 DEFUN (dassl_options, args, ,
426 int nargin = args.
length ();
437 std::string keyword = args(0).xstring_value (
"dassl_options: expecting keyword as first argument");
440 retval = show_DASSL_options (keyword);
442 set_DASSL_options (keyword, args(1));
448 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type numel() const
Number of elements in the array.
void set_enforce_nonnegativity_constraints(octave_idx_type val)
Array< double > relative_tolerance() const
octave_idx_type compute_consistent_initial_condition() const
octave_idx_type maximum_order() const
void set_maximum_step_size(double val)
void set_maximum_order(octave_idx_type val)
Array< double > absolute_tolerance() const
double initial_step_size() const
void set_step_limit(octave_idx_type val)
void set_relative_tolerance(double val)
double maximum_step_size() const
void set_compute_consistent_initial_condition(octave_idx_type val)
octave_idx_type enforce_nonnegativity_constraints() const
octave_idx_type step_limit() const
void set_initial_step_size(double val)
void set_absolute_tolerance(double val)
int int_value(bool req_int=false, bool frc_str_conv=false) const
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type length() const
double double_value(bool frc_str_conv=false) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning(const char *fmt,...)
int keyword_almost_match(const char *const *std, int *min_len, const std::string &s, int min_toks_to_match, int max_toks)
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)