26 #if defined (HAVE_CONFIG_H)
69 assert (
x.numel () == xdot.
numel ());
85 catch (octave::execution_exception& e)
91 if (tlen == 0 || ! tmp(0).is_defined ())
96 warning (
"daspk: ignoring imaginary part returned from user-supplied function");
100 retval = tmp(0).vector_value ();
103 ires = tmp(1).idx_type_value ();
118 assert (
x.numel () == xdot.
numel ());
135 catch (octave::execution_exception& e)
141 if (tlen == 0 || ! tmp(0).is_defined ())
146 warning (
"daspk: ignoring imaginary part returned from user-supplied jacobian function");
150 retval = tmp(0).matrix_value ();
262 int nargin = args.length ();
264 if (nargin < 4 || nargin > 5)
278 error (
"daspk: invalid recursive call");
280 std::string fcn_name, fname, jac_name, jname;
287 std::list<std::string> fcn_param_names ({
"x",
"xdot",
"t"});
288 std::list<std::string> jac_param_names ({
"x",
"xdot",
"t",
"cj"});
295 else if (c.
numel () == 2)
310 error (
"daspk: incorrect number of elements in cell array");
319 switch (f_arg.
rows ())
345 error (
"daspk: first arg should be a string or 2-element string array");
351 error (
"daspk: FCN argument is not a valid function name or handle");
353 ColumnVector state = args(1).xvector_value (
"daspk: initial state X_0 must be a vector");
355 ColumnVector deriv = args(2).xvector_value (
"daspk: initial derivatives XDOT_0 must be a vector");
357 ColumnVector out_times = args(3).xvector_value (
"daspk: output time variable T must be a vector");
360 int crit_times_set = 0;
363 crit_times = args(4).xvector_value (
"daspk: list of critical times T_CRIT must be a vector");
369 error (
"daspk: X_0 and XDOT_0 must have the same size");
371 double tzero = out_times (0);
384 output = dae.
integrate (out_times, deriv_output, crit_times);
386 output = dae.
integrate (out_times, deriv_output);
398 error (
"daspk: %s", msg.c_str ());
static DASPK_options daspk_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)
std::string error_message(void) const
Matrix integrate(const ColumnVector &tout, Matrix &xdot_out)
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
Matrix daspk_user_jacobian(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
ColumnVector daspk_user_function(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
static octave_value daspk_jac
static bool warned_jac_imaginary
DEFMETHOD(daspk, interp, args, nargout, doc:)
static octave_value daspk_fcn
static bool warned_fcn_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