25 struct DASRT_options_struct
30 int min_toks_to_match;
35 static DASRT_options_struct DASRT_options_table [] =
37 {
"absolute tolerance",
38 {
"absolute",
"tolerance",
nullptr,
nullptr, },
39 { 1, 0, 0, 0, }, 1, },
41 {
"relative tolerance",
42 {
"relative",
"tolerance",
nullptr,
nullptr, },
43 { 1, 0, 0, 0, }, 1, },
45 {
"initial step size",
46 {
"initial",
"step",
"size",
nullptr, },
47 { 1, 0, 0, 0, }, 1, },
50 {
"maximum",
"order",
nullptr,
nullptr, },
51 { 1, 1, 0, 0, }, 2, },
53 {
"maximum step size",
54 {
"maximum",
"step",
"size",
nullptr, },
55 { 1, 1, 0, 0, }, 2, },
58 {
"step",
"limit",
nullptr,
nullptr, },
59 { 1, 0, 0, 0, }, 1, },
63 print_DASRT_options (std::ostream& os)
65 std::ostringstream buf;
68 <<
"Options for DASRT include:\n\n"
70 <<
" ------- -----\n";
72 DASRT_options_struct *list = DASRT_options_table;
76 << std::setiosflags (std::ios::left) << std::setw (50)
78 << std::resetiosflags (std::ios::left)
83 if (val.
numel () == 1)
98 << std::setiosflags (std::ios::left) << std::setw (50)
100 << std::resetiosflags (std::ios::left)
105 if (val.
numel () == 1)
107 os << val(0) <<
"\n";
120 << std::setiosflags (std::ios::left) << std::setw (50)
122 << std::resetiosflags (std::ios::left)
132 << std::setiosflags (std::ios::left) << std::setw (50)
134 << std::resetiosflags (std::ios::left)
144 << std::setiosflags (std::ios::left) << std::setw (50)
146 << std::resetiosflags (std::ios::left)
156 << std::setiosflags (std::ios::left) << std::setw (50)
158 << std::resetiosflags (std::ios::left)
170 set_DASRT_options (
const std::string& keyword,
const octave_value& val)
172 DASRT_options_struct *list = DASRT_options_table;
175 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
182 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
189 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
196 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
203 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
210 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
218 warning (
"dasrt_options: no match for `%s'", keyword.c_str ());
223 show_DASRT_options (
const std::string& keyword)
227 DASRT_options_struct *list = DASRT_options_table;
230 keyword, list[0].min_toks_to_match,
MAX_TOKENS))
234 if (val.
numel () == 1)
244 keyword, list[1].min_toks_to_match,
MAX_TOKENS))
248 if (val.
numel () == 1)
258 keyword, list[2].min_toks_to_match,
MAX_TOKENS))
265 keyword, list[3].min_toks_to_match,
MAX_TOKENS))
269 retval =
static_cast<double> (val);
272 keyword, list[4].min_toks_to_match,
MAX_TOKENS))
279 keyword, list[5].min_toks_to_match,
MAX_TOKENS))
283 retval =
static_cast<double> (val);
287 warning (
"dasrt_options: no match for `%s'", keyword.c_str ());
295 DEFUN (dasrt_options, args, ,
354 int nargin = args.
length ();
365 std::string keyword = args(0).xstring_value (
"dasrt_options: expecting keyword as first argument");
368 retval = show_DASRT_options (keyword);
370 set_DASRT_options (keyword, args(1));
376 OCTAVE_END_NAMESPACE(
octave)
octave_idx_type numel() const
Number of elements in the array.
void set_maximum_step_size(double val)
void set_maximum_order(octave_idx_type val)
octave_idx_type maximum_order() const
void set_relative_tolerance(double val)
octave_idx_type step_limit() const
void set_step_limit(octave_idx_type val)
void set_initial_step_size(double val)
Array< double > relative_tolerance() const
double initial_step_size() const
void set_absolute_tolerance(double val)
Array< double > absolute_tolerance() const
double maximum_step_size() const
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)