23 #if defined (HAVE_CONFIG_H)
79 catch (octave::execution_exception&
e)
84 if (tmp.
empty () || !
tmp(0).is_defined ())
87 if (! warned_fcn_imaginary &&
tmp(0).is_complex_type ())
89 warning (
"lsode: ignoring imaginary part returned from user-supplied function");
90 warned_fcn_imaginary =
true;
93 retval =
tmp(0).xvector_value (
"lsode: expecting user supplied function to return numeric vector");
119 catch (octave::execution_exception&
e)
124 if (tmp.
empty () || !
tmp(0).is_defined ())
127 if (! warned_jac_imaginary &&
tmp(0).is_complex_type ())
129 warning (
"lsode: ignoring imaginary part returned from user-supplied jacobian function");
130 warned_jac_imaginary =
true;
133 retval =
tmp(0).xmatrix_value (
"lsode: expecting user supplied jacobian function to return numeric array");
262 if (nargin < 3 || nargin > 4)
265 warned_fcn_imaginary =
false;
266 warned_jac_imaginary =
false;
274 error (
"lsode: invalid recursive call");
287 else if (c.
numel () == 2)
289 if (
c(0).is_function_handle () ||
c(0).is_inline_function ())
290 lsode_fcn =
c(0).function_value ();
294 fname =
"function y = ";
295 fname.append (fcn_name);
296 fname.append (
" (x, t) y = ");
303 if (
c(1).is_function_handle () ||
c(1).is_inline_function ())
304 lsode_jac =
c(1).function_value ();
308 jname =
"function jac = ";
309 jname.append (jac_name);
310 jname.append (
" (x, t) jac = ");
312 jname,
"; endfunction");
316 if (fcn_name.length ())
324 error (
"lsode: incorrect number of elements in cell array");
327 if (! lsode_fcn && ! f_arg.
is_cell ())
333 switch (f_arg.
rows ())
339 fname =
"function y = ";
340 fname.append (fcn_name);
341 fname.append (
" (x, t) y = ");
343 fname,
"; endfunction");
353 fname =
"function y = ";
354 fname.append (fcn_name);
355 fname.append (
" (x, t) y = ");
357 fname,
"; endfunction");
362 jname =
"function jac = ";
363 jname.append (jac_name);
364 jname.append (
" (x, t) jac = ");
371 if (fcn_name.length ())
380 error (
"lsode: first arg should be a string or 2-element string array");
386 error (
"lsode: FCN argument is not a valid function name or handle");
389 ColumnVector out_times =
args(2).xvector_value (
"lsode: output time variable T must be a vector");
393 int crit_times_set = 0;
396 crit_times =
args(3).xvector_value (
"lsode: list of critical times T_CRIT must be a vector");
401 double tzero = out_times (0);
413 output = ode.
integrate (out_times, crit_times);
417 if (fcn_name.length ())
419 if (jac_name.length ())
429 error (
"lsode: %s", msg.c_str ());
static bool warned_jac_imaginary
bool is_empty(void) const
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.
Matrix lsode_user_jacobian(const ColumnVector &x, double t)
virtual ColumnVector integrate(double tt)
static bool warned_fcn_imaginary
void error(const char *fmt,...)
ColumnVector lsode_user_function(const ColumnVector &x, double t)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
void set_options(const LSODE_options &opt)
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)
ODEFunc & set_jacobian_function(ODEJacFunc j)
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)
static octave_function * lsode_jac
bool is_inline_function(void) const
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
DEFUN(lsode, args, nargout, doc:)
void warning(const char *fmt,...)
static octave_function * lsode_fcn
octave::unwind_protect frame
void err_user_supplied_eval(const char *name)
static LSODE_options lsode_opts
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)
octave_idx_type integration_state(void) const
nd group nd example Use ode
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
std::string error_message(void) const