23 #if defined (HAVE_CONFIG_H)
82 catch (octave::execution_exception&
e)
88 if (tlen == 0 || !
tmp(0).is_defined ())
91 if (! warned_fcn_imaginary &&
tmp(0).is_complex_type ())
93 warning (
"daspk: ignoring imaginary part returned from user-supplied function");
94 warned_fcn_imaginary =
true;
97 retval =
tmp(0).vector_value ();
100 ires =
tmp(1).idx_type_value ();
132 catch (octave::execution_exception&
e)
138 if (tlen == 0 || !
tmp(0).is_defined ())
141 if (! warned_jac_imaginary &&
tmp(0).is_complex_type ())
143 warning (
"daspk: ignoring imaginary part returned from user-supplied jacobian function");
144 warned_jac_imaginary =
true;
147 retval =
tmp(0).matrix_value ();
259 if (nargin < 4 || nargin > 5)
262 warned_fcn_imaginary =
false;
263 warned_jac_imaginary =
false;
273 error (
"daspk: invalid recursive call");
286 else if (c.
numel () == 2)
288 if (
c(0).is_function_handle () ||
c(0).is_inline_function ())
289 daspk_fcn =
c(0).function_value ();
293 fname =
"function y = ";
294 fname.append (fcn_name);
295 fname.append (
" (x, xdot, t) y = ");
297 fname,
"; endfunction");
302 if (
c(1).is_function_handle () ||
c(1).is_inline_function ())
303 daspk_jac =
c(1).function_value ();
307 jname =
"function jac = ";
308 jname.append (jac_name);
309 jname.append (
" (x, xdot, t, cj) jac = ");
311 jname,
"; endfunction");
315 if (fcn_name.length ())
323 error (
"daspk: incorrect number of elements in cell array");
326 if (! daspk_fcn && ! f_arg.
is_cell ())
332 switch (f_arg.
rows ())
338 fname =
"function y = ";
339 fname.append (fcn_name);
340 fname.append (
" (x, xdot, t) y = ");
342 fname,
"; endfunction");
352 fname =
"function y = ";
353 fname.append (fcn_name);
354 fname.append (
" (x, xdot, t) y = ");
356 fname,
"; endfunction");
361 jname =
"function jac = ";
362 jname.append (jac_name);
363 jname.append (
" (x, xdot, t, cj) jac = ");
365 jname,
"; endfunction");
369 if (fcn_name.length ())
384 ColumnVector deriv =
args(2).xvector_value (
"daspk: initial derivatives XDOT_0 must be a vector");
386 ColumnVector out_times =
args(3).xvector_value (
"daspk: output time variable T must be a vector");
389 int crit_times_set = 0;
392 crit_times =
args(4).xvector_value (
"daspk: list of critical times T_CRIT must be a vector");
398 error (
"daspk: X_0 and XDOT_0 must have the same size");
400 double tzero = out_times (0);
406 DASPK dae (state, deriv, tzero, func);
413 output = dae.
integrate (out_times, deriv_output, crit_times);
415 output = dae.
integrate (out_times, deriv_output);
417 if (fcn_name.length ())
419 if (jac_name.length ())
432 error (
"daspk: %s", msg.c_str ());
bool is_empty(void) const
Matrix integrate(const ColumnVector &tout, Matrix &xdot_out)
virtual octave_value_list do_multi_index_op(int nargout, const octave_value_list &idx)
octave_idx_type rows(void) const
bool integration_ok(void) const
OCTINTERP_API void print_usage(void)
octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type length(void) const
static octave_function * daspk_fcn
void error(const char *fmt,...)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
static bool warned_fcn_imaginary
bool is_function_handle(void) const
std::string unique_symbol_name(const std::string &basename)
Cell cell_value(void) const
void clear_function(const std::string &nm)
Matrix daspk_user_jacobian(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
bool is_inline_function(void) const
void set_options(const DASPK_options &opt)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
string_vector string_vector_value(bool pad=false) const
static uint32_t state[624]
octave_function * function_value(bool silent=false) const
void warning(const char *fmt,...)
octave::unwind_protect frame
void err_user_supplied_eval(const char *name)
std::string error_message(void) const
octave_function * extract_function(const octave_value &arg, const std::string &warn_for, const std::string &fname, const std::string &header, const std::string &trailer)
static bool warned_jac_imaginary
octave_idx_type integration_state(void) const
ColumnVector daspk_user_function(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
static octave_function * daspk_jac
static DASPK_options daspk_opts
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
DEFUN(daspk, args, nargout, doc:)
DAEFunc & set_jacobian_function(DAEJacFunc j)