23 #if defined (HAVE_CONFIG_H) 48 #include "LSODE-opts.cc" 80 catch (octave::execution_exception&
e)
85 if (
tmp.empty () || !
tmp(0).is_defined ())
90 warning (
"lsode: ignoring imaginary part returned from user-supplied function");
94 retval =
tmp(0).xvector_value (
"lsode: expecting user supplied function to return numeric vector");
120 catch (octave::execution_exception&
e)
125 if (
tmp.empty () || !
tmp(0).is_defined ())
130 warning (
"lsode: ignoring imaginary part returned from user-supplied jacobian function");
134 retval =
tmp(0).xmatrix_value (
"lsode: expecting user supplied jacobian function to return numeric array");
262 int nargin = args.length ();
276 error (
"lsode: 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, t) y = ");
312 jname =
"function jac = ";
313 jname.append (jac_name);
314 jname.append (
" (x, t) jac = ");
316 jname,
"; endfunction");
320 if (fcn_name.length ())
328 error (
"lsode: 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, t) y = ");
347 fname,
"; endfunction");
357 fname =
"function y = ";
358 fname.append (fcn_name);
359 fname.append (
" (x, t) y = ");
361 fname,
"; endfunction");
366 jname =
"function jac = ";
367 jname.append (jac_name);
368 jname.append (
" (x, t) jac = ");
375 if (fcn_name.length ())
384 error (
"lsode: first arg should be a string or 2-element string array");
390 error (
"lsode: FCN argument is not a valid function name or handle");
392 ColumnVector state = args(1).xvector_value (
"lsode: initial state X_0 must be a vector");
393 ColumnVector out_times = args(2).xvector_value (
"lsode: output time variable T must be a vector");
397 int crit_times_set = 0;
400 crit_times = args(3).xvector_value (
"lsode: list of critical times T_CRIT must be a vector");
405 double tzero = out_times (0);
413 ode.set_options (lsode_opts);
417 output =
ode.integrate (out_times, crit_times);
419 output =
ode.integrate (out_times);
421 if (fcn_name.length ())
423 if (jac_name.length ())
430 if (
ode.integration_ok ())
433 error (
"lsode: %s", msg.c_str ());
437 retval(1) =
static_cast<double> (
ode.integration_state ());
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
static bool warned_jac_imaginary
#define DEFMETHOD(name, interp_name, args_name, nargout_name, doc)
Macro to define a builtin method.
OCTINTERP_API void print_usage(void)
Matrix lsode_user_jacobian(const ColumnVector &x, double t)
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
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
std::string unique_symbol_name(const std::string &basename)
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)
bool is_function_handle(void) const
static octave_function * lsode_jac
octave_idx_type rows(void) const
octave_function * function_value(bool silent=false) const
static uint32_t state[624]
void warning(const char *fmt,...)
static octave_function * lsode_fcn
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)
void clear_function(const std::string &name)
string_vector string_vector_value(bool pad=false) 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
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