26 #if defined (HAVE_CONFIG_H)
70 assert (
x.numel () == xdot.
numel ());
86 catch (octave::execution_exception& e)
91 if (tmp.
empty () || ! tmp(0).is_defined ())
96 warning (
"dasrt: ignoring imaginary part returned from user-supplied function");
100 retval = tmp(0).vector_value ();
127 catch (octave::execution_exception& e)
132 if (tmp.
empty () || ! tmp(0).is_defined ())
137 warning (
"dasrt: ignoring imaginary part returned from user-supplied constraint function");
141 retval = tmp(0).vector_value ();
156 assert (
x.numel () == xdot.
numel ());
173 catch (octave::execution_exception& e)
179 if (tlen == 0 || ! tmp(0).is_defined ())
184 warning (
"dasrt: ignoring imaginary part returned from user-supplied jacobian function");
188 retval = tmp(0).matrix_value ();
340 int nargin = args.length ();
342 if (nargin < 4 || nargin > 6)
357 error (
"dasrt: invalid recursive call");
360 std::string fcn_name, fname, jac_name, jname;
372 std::list<std::string> fcn_param_names ({
"x",
"xdot",
"t"});
373 std::list<std::string> jac_param_names ({
"x",
"xdot",
"t",
"cj"});
380 else if (c.
numel () == 2)
395 error (
"dasrt: incorrect number of elements in cell array");
404 switch (f_arg.
rows ())
430 error (
"dasrt: first arg should be a string or 2-element string array");
436 error (
"dasrt: FCN argument is not a valid function name or handle");
442 if (args(1).isempty () && args(1).is_double_type ())
451 if (args(1).is_function_handle () || args(1).is_inline_function ()
452 || args(1).is_string ())
454 std::list<std::string> cf_param_names ({
"x",
"t"});
467 if (argp + 3 > nargin)
470 ColumnVector state = args(argp++).xvector_value (
"dasrt: initial state X_0 must be a vector");
472 ColumnVector stateprime = args(argp++).xvector_value (
"dasrt: initial derivatives XDOT_0 must be a vector");
474 ColumnVector out_times = args(argp++).xvector_value (
"dasrt: output time variable T must be a vector");
476 double tzero = out_times (0);
480 bool crit_times_set =
false;
484 crit_times = args(argp).xvector_value (
"dasrt: list of critical times T_CRIT must be a vector");
487 crit_times_set =
true;
500 output = dae.
integrate (out_times, crit_times);
515 error (
"dasrt: %s", msg.c_str ());
static DASRT_options dasrt_opts
octave_idx_type numel(void) const
Number of elements in the array.
bool isempty(void) const
Size of the specified dimension.
DAEFunc & set_jacobian_function(DAEJacFunc j)
DAERTFunc & set_constraint_function(DAERTConstrFunc cf)
ColumnVector times(void) const
DASRT_result integrate(const ColumnVector &tout)
std::string error_message(void) const
bool integration_ok(void) const
octave_idx_type integration_state(void) const
octave_idx_type length(void) const
octave_idx_type rows(void) const
bool is_defined(void) const
Cell cell_value(void) const
bool is_function_handle(void) const
string_vector string_vector_value(bool pad=false) const
bool is_undefined(void) const
bool is_inline_function(void) const
static Matrix dasrt_user_j(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
static octave_value dasrt_jac
DEFMETHOD(dasrt, interp, args, nargout, doc:)
static octave_value dasrt_cf
static ColumnVector dasrt_user_cf(const ColumnVector &x, double t)
static octave_value dasrt_fcn
static ColumnVector dasrt_user_f(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &)
static bool warned_jac_imaginary
static bool warned_fcn_imaginary
static bool warned_cf_imaginary
OCTINTERP_API void print_usage(void)
void warning(const char *fmt,...)
void error(const char *fmt,...)
void err_user_supplied_eval(const char *name)
F77_RET_T const F77_DBLE * x
static uint32_t state[624]
octave_value get_function_handle(interpreter &interp, const octave_value &arg, const std::string ¶meter_name)
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_value::octave_value(const Array< char > &chm, char type) return retval