26 #if defined (HAVE_CONFIG_H)
76 for (
F77_INT i = 0; i < neq; i++)
77 deriv[i] = tmp_deriv.
elem (i);
86 double *pd,
const F77_INT& nrowpd)
97 for (
F77_INT j = 0; j < neq; j++)
98 for (
F77_INT i = 0; i < neq; i++)
99 pd[nrowpd * j + i] = tmp_jac (i, j);
102 for (
F77_INT i = 0, j = mu; i <= ml; j == 0 ? i++ : j--)
104 for (
F77_INT k = i, l = j; k < neq && l < neq; k++, l++)
105 pd[nrowpd * l + k + mu - l] = tmp_jac (k, l);
118 || LSODE_options::m_reset)
136 m_iwork(0) = lower_jacobian_subdiagonals ();
138 m_iwork(1) = upper_jacobian_subdiagonals ();
140 if (integration_method () ==
"stiff")
146 if (jacobian_type () ==
"banded")
156 if (jacobian_type () ==
"full")
158 else if (jacobian_type () ==
"banded")
160 else if (jacobian_type () ==
"diagonal")
165 (*current_liboctave_error_handler)
166 (
"lsode: internal error, wrong jacobian type");
187 for (
F77_INT i = 4; i < 9; i++)
192 for (
F77_INT i = 4; i < 9; i++)
199 if (maxord > 0 && maxord <= max_maxord)
201 m_iwork(4) = octave::to_f77_int (maxord);
207 (*current_liboctave_error_handler)
208 (
"lsode: invalid value for maximum order");
243 (*current_liboctave_error_handler)
244 (
"lsode: inconsistent sizes for state and derivative vectors");
259 if (abs_tol_len == 1)
261 else if (abs_tol_len ==
n)
266 (*current_liboctave_error_handler)
267 (
"lsode: inconsistent sizes for state and absolute tolerance vectors");
273 double iss = initial_step_size ();
280 double maxss = maximum_step_size ();
287 double minss = minimum_step_size ();
294 F77_INT sl = octave::to_f77_int (step_limit ());
301 LSODE_options::m_reset =
false;
341 (*current_liboctave_error_handler)
342 (
"unrecognized value of istate (= %" OCTAVE_IDX_TYPE_FORMAT
") "
355 std::ostringstream buf;
357 std::string t_curr = buf.str ();
362 retval =
"prior to initial integration step";
366 retval =
"successful exit";
370 retval =
"prior to continuation call with modified parameters";
374 retval =
"excess work on this call (t = " + t_curr +
375 "; perhaps wrong integration method)";
379 retval =
"excess accuracy requested (tolerances too small)";
383 retval =
"invalid input detected (see printed message)";
387 retval =
"repeated error test failures (t = " + t_curr +
388 "; check all inputs)";
392 retval =
"repeated convergence failures (t = " + t_curr +
393 "; perhaps bad Jacobian supplied or wrong choice of integration method or tolerances)";
397 retval =
"error weight became zero during problem. (t = " + t_curr +
398 "; solution component i vanished, and atol or atol(i) == 0)";
402 retval =
"return requested in user-supplied function (t = "
407 retval =
"unknown error state";
422 if (n_out > 0 &&
n > 0)
437 retval.
elem (j, i) = x_next.
elem (i);
452 if (n_out > 0 &&
n > 0)
465 double next_crit = tcrit.
elem (0);
467 while (i_out < n_out)
469 bool do_restart =
false;
471 next_out = tout.
elem (i_out);
473 next_crit = tcrit.
elem (i_crit);
475 bool save_output =
false;
478 if (next_crit == next_out)
487 else if (next_crit < next_out)
521 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)
static bool user_jac_ignore_ml_mu
F77_INT(* lsode_fcn_ptr)(const F77_INT &, const double &, double *, double *, F77_INT &)
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_fcn
static ODEFunc::ODEJacFunc user_jac
F77_RET_T F77_FUNC(dlsode, DLSODE)(lsode_fcn_ptr
static F77_INT lsode_j(const F77_INT &neq, const double &time, double *, const F77_INT &ml, const F77_INT &mu, double *pd, const F77_INT &nrowpd)
static ColumnVector * tmp_x
OCTARRAY_OVERRIDABLE_FUNC_API bool isempty(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
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.
OCTARRAY_OVERRIDABLE_FUNC_API T & elem(octave_idx_type n)
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)
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