26 #if defined (HAVE_CONFIG_H)
86 tmp =
feval (dasrt_fcn, args, 1);
93 if (tmp.
empty () || ! tmp(0).is_defined ())
98 warning (
"dasrt: ignoring imaginary part returned from user-supplied function");
102 retval = tmp(0).vector_value ();
134 if (tmp.
empty () || ! tmp(0).is_defined ())
139 warning (
"dasrt: ignoring imaginary part returned from user-supplied constraint function");
143 retval = tmp(0).vector_value ();
181 if (tlen == 0 || ! tmp(0).is_defined ())
186 warning (
"dasrt: ignoring imaginary part returned from user-supplied jacobian function");
190 retval = tmp(0).matrix_value ();
342 int nargin = args.length ();
344 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)
393 error (
"dasrt: incorrect number of elements in cell array");
402 switch (f_arg.
rows ())
427 error (
"dasrt: first arg should be a string or 2-element string array");
433 error (
"dasrt: FCN argument is not a valid function name or handle");
439 if (args(1).isempty () && args(1).is_double_type ())
448 if (args(1).is_function_handle () || args(1).is_inline_function ()
449 || args(1).is_string ())
451 std::list<std::string> cf_param_names ({
"x",
"t"});
464 if (argp + 3 > nargin)
467 ColumnVector state = args(argp++).xvector_value (
"dasrt: initial state X_0 must be a vector");
470 argp++).xvector_value (
"dasrt: initial derivatives XDOT_0 must be a vector");
473 argp++).xvector_value (
"dasrt: output time variable T must be a vector");
475 double tzero = out_times (0);
479 bool crit_times_set =
false;
483 crit_times = args(argp).xvector_value (
"dasrt: list of critical times T_CRIT must be a vector");
486 crit_times_set =
true;
499 output = dae.
integrate (out_times, crit_times);
507 retval(0) = output.
state ();
508 retval(1) = output.
deriv ();
509 retval(2) = output.
times ();
514 error (
"dasrt: %s", msg.c_str ());
static DASRT_options dasrt_opts
OCTARRAY_OVERRIDABLE_FUNC_API bool isempty(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
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 ColumnVector dasrt_user_f(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &)
static bool warned_jac_imaginary
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value dasrt_fcn
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 error_unless(bool cond)
void err_user_supplied_eval(const char *name)
octave_value get_function_handle(interpreter &interp, const octave_value &arg, const std::string ¶meter_name)
F77_RET_T const F77_DBLE * x
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()) ? '\'' :'"'))
static uint32_t state[624]