23 #if defined (HAVE_CONFIG_H) 46 #include "DASPK-opts.cc" 67 assert (
x.numel () == xdot.
numel ());
83 catch (octave::execution_exception&
e)
88 int tlen =
tmp.length ();
89 if (tlen == 0 || !
tmp(0).is_defined ())
94 warning (
"daspk: ignoring imaginary part returned from user-supplied function");
101 ires =
tmp(1).idx_type_value ();
116 assert (
x.numel () == xdot.
numel ());
133 catch (octave::execution_exception&
e)
138 int tlen =
tmp.length ();
139 if (tlen == 0 || !
tmp(0).is_defined ())
144 warning (
"daspk: ignoring imaginary part returned from user-supplied jacobian function");
260 int nargin = args.length ();
278 error (
"daspk: invalid recursive call");
291 else if (
c.numel () == 2)
293 if (
c(0).is_function_handle () ||
c(0).is_inline_function ())
298 fname =
"function y = ";
299 fname.append (fcn_name);
300 fname.append (
" (x, xdot, t) y = ");
302 fname,
"; endfunction");
307 if (
c(1).is_function_handle () ||
c(1).is_inline_function ())
312 jname =
"function jac = ";
313 jname.append (jac_name);
314 jname.append (
" (x, xdot, t, cj) jac = ");
316 jname,
"; endfunction");
320 if (fcn_name.length ())
328 error (
"daspk: incorrect number of elements in cell array");
337 switch (f_arg.
rows ())
343 fname =
"function y = ";
344 fname.append (fcn_name);
345 fname.append (
" (x, xdot, t) y = ");
347 fname,
"; endfunction");
357 fname =
"function y = ";
358 fname.append (fcn_name);
359 fname.append (
" (x, xdot, t) y = ");
361 fname,
"; endfunction");
366 jname =
"function jac = ";
367 jname.append (jac_name);
368 jname.append (
" (x, xdot, t, cj) jac = ");
370 jname,
"; endfunction");
374 if (fcn_name.length ())
387 ColumnVector state = args(1).xvector_value (
"daspk: initial state X_0 must be a vector");
389 ColumnVector deriv = args(2).xvector_value (
"daspk: initial derivatives XDOT_0 must be a vector");
391 ColumnVector out_times = args(3).xvector_value (
"daspk: output time variable T must be a vector");
394 int crit_times_set = 0;
397 crit_times = args(4).xvector_value (
"daspk: list of critical times T_CRIT must be a vector");
403 error (
"daspk: X_0 and XDOT_0 must have the same size");
405 double tzero = out_times (0);
412 dae.set_options (daspk_opts);
418 output = dae.
integrate (out_times, deriv_output, crit_times);
420 output = dae.
integrate (out_times, deriv_output);
422 if (fcn_name.length ())
424 if (jac_name.length ())
437 error (
"daspk: %s", msg.c_str ());
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
Matrix integrate(const ColumnVector &tout, Matrix &xdot_out)
OCTINTERP_API void print_usage(void)
std::string error_message(void) const
static octave_function * daspk_fcn
void error(const char *fmt,...)
octave_idx_type integration_state(void) const
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
static bool warned_fcn_imaginary
std::string unique_symbol_name(const std::string &basename)
bool integration_ok(void) const
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_function_handle(void) const
octave_idx_type rows(void) const
octave_function * function_value(bool silent=false) const
static uint32_t state[624]
void warning(const char *fmt,...)
octave::unwind_protect frame
void err_user_supplied_eval(const char *name)
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
ColumnVector daspk_user_function(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
void clear_function(const std::string &name)
string_vector string_vector_value(bool pad=false) const
static octave_function * daspk_jac
octave_idx_type numel(void) const
Number of elements in the array.
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
Cell cell_value(void) const
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
bool is_inline_function(void) const
DAEFunc & set_jacobian_function(DAEJacFunc j)