26 #if defined (HAVE_CONFIG_H)
40 const double *,
double *,
F77_INT&,
44 const double *,
double *,
const double&,
75 tmp_deriv.
elem (i) = deriv[i];
81 tmp_delta =
user_fcn (tmp_state, tmp_deriv,
time, tmp_ires);
83 ires = octave::to_f77_int (tmp_ires);
92 delta[i] = tmp_delta.
elem (i);
101 double *pd,
const double& cj,
double *,
F77_INT *)
110 tmp_deriv.
elem (i) = deriv[i];
118 pd[
nn * j + i] = tmp_pd.
elem (i, j);
129 || DASSL_options::m_reset)
137 for (
F77_INT i = 0; i < 15; i++)
175 (*current_liboctave_error_handler)
176 (
"dassl: inconsistent sizes for state and residual vectors");
184 (*current_liboctave_error_handler)
185 (
"dassl: no user supplied RHS subroutine!");
197 double hmax = maximum_step_size ();
206 double h0 = initial_step_size ();
215 F77_INT sl = octave::to_f77_int (step_limit ());
225 F77_INT maxord = octave::to_f77_int (maximum_order ());
228 if (maxord > 0 && maxord < 6)
235 (*current_liboctave_error_handler)
236 (
"dassl: invalid value for maximum order: %"
237 OCTAVE_F77_INT_TYPE_FORMAT, maxord);
243 F77_INT enc = octave::to_f77_int (enforce_nonnegativity_constraints ());
244 m_info(9) = (enc ? 1 : 0);
246 F77_INT ccic = octave::to_f77_int (compute_consistent_initial_condition ());
247 m_info(10) = (ccic ? 1 : 0);
255 if (abs_tol_len == 1 && rel_tol_len == 1)
259 else if (abs_tol_len ==
n && rel_tol_len ==
n)
265 (*current_liboctave_error_handler)
266 (
"dassl: inconsistent sizes for tolerance arrays");
272 DASSL_options::m_reset =
false;
286 double *dummy =
nullptr;
292 prel_tol, pabs_tol, tmp_istate, prwork,
m_lrw,
337 (*current_liboctave_error_handler)
338 (
"unrecognized value of istate (= %" OCTAVE_IDX_TYPE_FORMAT
") "
361 if (n_out > 0 &&
n > 0)
381 retval.
elem (j, i) = x_next.
elem (i);
406 if (n_out > 0 &&
n > 0)
423 double next_crit = tcrit.
elem (0);
425 while (i_out < n_out)
427 bool do_restart =
false;
429 next_out = tout.
elem (i_out);
431 next_crit = tcrit.
elem (i_crit);
436 if (next_crit == next_out)
445 else if (next_crit < next_out)
480 retval.
elem (i_out-1, i) = x_next.
elem (i);
506 std::ostringstream buf;
508 std::string t_curr = buf.str ();
513 retval =
"a step was successfully taken in intermediate-output mode.";
517 retval =
"integration completed by stepping exactly to TOUT";
521 retval =
"integration to tout completed by stepping past TOUT";
525 retval =
"a large amount of work has been expended (t =" + t_curr +
')';
529 retval =
"the error tolerances are too stringent";
533 retval =
"error weight became zero during problem. (t = " + t_curr +
534 "; solution component i vanished, and atol or atol(i) == 0)";
538 retval =
"repeated error test failures on the last attempted step (t = "
543 retval =
"the corrector could not converge (t = " + t_curr +
')';
547 retval =
"the matrix of partial derivatives is singular (t = " + t_curr +
552 retval =
"the corrector could not converge (t = " + t_curr +
553 "; repeated test failures)";
557 retval =
"corrector could not converge because IRES was -1 (t = "
562 retval =
"return requested in user-supplied function (t = " + t_curr +
567 retval =
"failed to compute consistent initial conditions";
571 retval =
"unrecoverable error (see printed message)";
575 retval =
"unknown error state";
static F77_INT ddassl_j(const double &time, const double *state, const double *deriv, double *pd, const double &cj, double *, F77_INT *)
F77_INT(* dassl_fcn_ptr)(const double &, const double *, const double *, double *, F77_INT &, double *, F77_INT *)
F77_INT(* dassl_jac_ptr)(const double &, const double *, const double *, double *, const double &, double *, F77_INT *)
static DAEFunc::DAEJacFunc user_jac
static F77_INT ddassl_f(const double &time, const double *state, const double *deriv, double *delta, F77_INT &ires, double *, F77_INT *)
static DAEFunc::DAERHSFunc user_fcn
F77_RET_T F77_FUNC(ddassl, DDASSL)(dassl_fcn_ptr
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.
DAEJacFunc jacobian_function(void) const
Matrix(* DAEJacFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
ColumnVector(* DAERHSFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
DAERHSFunc function(void) const
Array< octave_f77_int_type > m_iwork
std::string error_message(void) const
Matrix integrate(const ColumnVector &tout, Matrix &xdot_out)
Array< octave_f77_int_type > m_info
Array< double > m_abs_tol
octave_f77_int_type m_liw
ColumnVector do_integrate(double t)
Array< double > m_rel_tol
octave_f77_int_type m_lrw
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
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 ddassl(RES, NEQ, T, Y, YPRIME, TOUT, INFO, RTOL, ATOL, IDID, RWORK, LRW, IWORK, LIW, RPAR, IPAR, JAC)
#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)
static uint32_t state[624]