23 #if defined (HAVE_CONFIG_H) 46 #include "DASSL-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 (
"dassl: ignoring imaginary part returned from user-supplied function");
101 ires =
tmp(1).int_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 (
"dassl: ignoring imaginary part returned from user-supplied jacobian function");
261 int nargin = args.length ();
277 error (
"dassl: invalid recursive call");
292 else if (
c.numel () == 2)
294 if (
c(0).is_function_handle () ||
c(0).is_inline_function ())
299 fname =
"function y = ";
300 fname.append (fcn_name);
301 fname.append (
" (x, xdot, t) y = ");
308 if (
c(1).is_function_handle () ||
c(1).is_inline_function ())
313 jname =
"function jac = ";
314 jname.append (jac_name);
315 jname.append (
" (x, xdot, t, cj) jac = ");
317 jname,
"; endfunction");
321 if (fcn_name.length ())
329 error (
"dassl: incorrect number of elements in cell array");
338 switch (f_arg.
rows ())
344 fname =
"function y = ";
345 fname.append (fcn_name);
346 fname.append (
" (x, xdot, t) y = ");
348 fname,
"; endfunction");
358 fname =
"function y = ";
359 fname.append (fcn_name);
360 fname.append (
" (x, xdot, t) y = ");
362 fname,
"; endfunction");
367 jname =
"function jac = ";
368 jname.append (jac_name);
369 jname.append (
" (x, xdot, t, cj) jac = ");
376 if (fcn_name.length ())
389 ColumnVector state = args(1).xvector_value (
"dassl: initial state X_0 must be a vector");
391 ColumnVector deriv = args(2).xvector_value (
"dassl: initial derivatives XDOT_0 must be a vector");
393 ColumnVector out_times = args(3).xvector_value (
"dassl: output time variable T must be a vector");
396 int crit_times_set = 0;
399 crit_times = args(4).xvector_value (
"dassl: list of critical times T_CRIT must be a vector");
405 error (
"dassl: X and XDOT_0 must have the same size");
407 double tzero = out_times (0);
415 dae.set_options (dassl_opts);
421 output = dae.
integrate (out_times, deriv_output, crit_times);
423 output = dae.
integrate (out_times, deriv_output);
425 if (fcn_name.length ())
427 if (jac_name.length ())
440 error (
"dassl: %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)
Matrix dassl_user_jacobian(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
std::string error_message(void) const
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 octave_function * dassl_jac
std::string unique_symbol_name(const std::string &basename)
bool integration_ok(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 xample nargout(@histc)
bool is_function_handle(void) const
static octave_function * dassl_fcn
octave_idx_type rows(void) const
octave_function * function_value(bool silent=false) const
static uint32_t state[624]
static bool warned_fcn_imaginary
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)
ColumnVector dassl_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 bool warned_jac_imaginary
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)