26#if defined (HAVE_CONFIG_H)
69 tmp_deriv = (*user_fun) (*
tmp_x, time);
75 for (
F77_INT i = 0; i < neq; i++)
76 deriv[i] = tmp_deriv.
elem (i);
92 tmp_jac = (*user_jac) (*
tmp_x, time);
94 for (
F77_INT j = 0; j < neq; j++)
95 for (
F77_INT i = 0; i < neq; i++)
96 pd[nrowpd * j + i] = tmp_jac (i, j);
109 || LSODE_options::m_reset)
123 if (integration_method () ==
"stiff")
133 m_lrw = 22 + n * (9 + n);
147 for (
F77_INT i = 4; i < 9; i++)
152 for (
F77_INT i = 4; i < 9; i++)
159 if (maxord > 0 && maxord <= max_maxord)
161 m_iwork(4) = octave::to_f77_int (maxord);
167 (*current_liboctave_error_handler)
168 (
"lsode: invalid value for maximum order");
203 (*current_liboctave_error_handler)
204 (
"lsode: inconsistent sizes for state and derivative vectors");
219 if (abs_tol_len == 1)
221 else if (abs_tol_len == n)
226 (*current_liboctave_error_handler)
227 (
"lsode: inconsistent sizes for state and absolute tolerance vectors");
233 double iss = initial_step_size ();
240 double maxss = maximum_step_size ();
247 double minss = minimum_step_size ();
254 F77_INT sl = octave::to_f77_int (step_limit ());
261 LSODE_options::m_reset =
false;
301 (*current_liboctave_error_handler)
302 (
"unrecognized value of istate (= %" OCTAVE_IDX_TYPE_FORMAT
") "
315 std::ostringstream buf;
317 std::string t_curr = buf.str ();
322 retval =
"prior to initial integration step";
326 retval =
"successful exit";
330 retval =
"prior to continuation call with modified parameters";
334 retval =
"excess work on this call (t = " + t_curr +
335 "; perhaps wrong integration method)";
339 retval =
"excess accuracy requested (tolerances too small)";
343 retval =
"invalid input detected (see printed message)";
347 retval =
"repeated error test failures (t = " + t_curr +
348 "; check all inputs)";
352 retval =
"repeated convergence failures (t = " + t_curr +
353 "; perhaps bad Jacobian supplied or wrong choice of integration method or tolerances)";
357 retval =
"error weight became zero during problem. (t = " + t_curr +
358 "; solution component i vanished, and atol or atol(i) == 0)";
362 retval =
"return requested in user-supplied function (t = "
367 retval =
"unknown error state";
382 if (n_out > 0 && n > 0)
386 for (
F77_INT i = 0; i < n; i++)
396 for (
F77_INT i = 0; i < n; i++)
397 retval.
elem (j, i) = x_next.
elem (i);
412 if (n_out > 0 && n > 0)
416 for (
F77_INT i = 0; i < n; i++)
425 double next_crit = tcrit.
elem (0);
427 while (i_out < n_out)
429 bool do_restart =
false;
431 next_out = tout.
elem (i_out);
433 next_crit = tcrit.
elem (i_crit);
435 bool save_output =
false;
438 if (next_crit == next_out)
447 else if (next_crit < next_out)
480 for (
F77_INT i = 0; i < n; i++)
481 retval.
elem (i_out-1, i) = x_next.
elem (i);
F77_INT(* lsode_jac_ptr)(const F77_INT &, const double &, double *, const F77_INT &, const F77_INT &, double *, const F77_INT &)
static F77_INT lsode_f(const F77_INT &neq, const double &time, double *, double *deriv, F77_INT &ierr)
F77_INT(* lsode_fcn_ptr)(const F77_INT &, const double &, double *, double *, F77_INT &)
static ODEFunc::ODEJacFunc user_jac
F77_RET_T F77_FUNC(dlsode, DLSODE)(lsode_fcn_ptr
F77_RET_T F77_INT F77_DBLE F77_DBLE F77_DBLE F77_INT F77_DBLE const F77_DBLE F77_INT F77_INT F77_INT F77_DBLE F77_INT F77_INT F77_INT F77_INT &static ODEFunc::ODERHSFunc user_fun
static ColumnVector * tmp_x
static F77_INT lsode_j(const F77_INT &neq, const double &time, double *, const F77_INT &, const F77_INT &, double *pd, const F77_INT &nrowpd)
octave_idx_type numel(void) const
Number of elements in the array.
T & elem(octave_idx_type n)
Size of the specified dimension.
bool isempty(void) const
Size of the specified dimension.
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
Array< double > m_abs_tol
octave_f77_int_type m_lrw
octave_f77_int_type m_liw
std::string error_message(void) const
ColumnVector do_integrate(double t)
octave_f77_int_type m_itol
octave_f77_int_type m_method_flag
octave_f77_int_type m_iopt
octave_f77_int_type m_itask
Array< octave_f77_int_type > m_iwork
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
ODERHSFunc function(void) const
ColumnVector(* ODERHSFunc)(const ColumnVector &, double)
Matrix(* ODEJacFunc)(const ColumnVector &, double)
ODEJacFunc jacobian_function(void) const
virtual void force_restart(void)
octave_idx_type size(void) const
void set_stop_time(double tt)
void clear_stop_time(void)
Vector representing the dimensions (size) of an Array.
subroutine dlsode(F, NEQ, Y, T, TOUT, ITOL, RTOL, ATOL, ITASK, ISTATE, IOPT, RWORK, LRW, IWORK, LIW, JAC, MF)
#define F77_XFCN(f, F, args)
octave_f77_int_type F77_INT
F77_RET_T(F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, F77_CONST_CHAR_ARG_DECL, const F77_INT &, const F77_INT &, const F77_INT &, F77_INT &, F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, F77_DBLE *, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, const F77_INT &, F77_DBLE *, F77_INT *, F77_INT &F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL F77_CHAR_ARG_LEN_DECL)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE const F77_INT F77_INT & ierr