26 #if defined (HAVE_CONFIG_H)
85 tmp =
feval (daspk_fcn, args, 1);
93 if (tlen == 0 || ! tmp(0).is_defined ())
98 warning (
"daspk: ignoring imaginary part returned from user-supplied function");
102 retval = tmp(0).vector_value ();
105 ires = tmp(1).idx_type_value ();
143 if (tlen == 0 || ! tmp(0).is_defined ())
148 warning (
"daspk: ignoring imaginary part returned from user-supplied jacobian function");
152 retval = tmp(0).matrix_value ();
264 int nargin = args.length ();
266 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)
308 error (
"daspk: incorrect number of elements in cell array");
317 switch (f_arg.
rows ())
342 error (
"daspk: first arg should be a string or 2-element string array");
348 error (
"daspk: FCN argument is not a valid function name or handle");
350 ColumnVector state = args(1).xvector_value (
"daspk: initial state X_0 must be a vector");
352 ColumnVector deriv = args(2).xvector_value (
"daspk: initial derivatives XDOT_0 must be a vector");
354 ColumnVector out_times = args(3).xvector_value (
"daspk: output time variable T must be a vector");
357 int crit_times_set = 0;
360 crit_times = args(4).xvector_value (
"daspk: list of critical times T_CRIT must be a vector");
366 error (
"daspk: X_0 and XDOT_0 must have the same size");
368 double tzero = out_times (0);
381 output = dae.
integrate (out_times, deriv_output, crit_times);
383 output = dae.
integrate (out_times, deriv_output);
390 retval(1) = deriv_output;
395 error (
"daspk: %s", msg.c_str ());
static DASPK_options daspk_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)
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
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
static octave_value daspk_jac
static Matrix daspk_user_jacobian(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
static bool warned_jac_imaginary
DEFMETHOD(daspk, interp, args, nargout, doc:)
static ColumnVector daspk_user_function(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
static bool warned_fcn_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]