38 const double*,
double*,
43 const double*,
double*,
44 const double&,
double*,
51 double&,
double*,
double*,
double&,
52 const octave_idx_type*,
const double*,
53 const double*, octave_idx_type&,
54 double*,
const octave_idx_type&,
55 octave_idx_type*,
const octave_idx_type&,
56 const double*,
const octave_idx_type*,
69 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
79 tmp_deriv.
elem (i) = deriv[i];
80 tmp_state.
elem (i) = state[i];
83 tmp_delta =
user_fun (tmp_state, tmp_deriv, time, ires);
87 if (tmp_delta.
length () == 0)
92 delta[i] = tmp_delta.
elem (i);
96 END_INTERRUPT_WITH_EXCEPTIONS;
105 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
114 tmp_deriv.
elem (i) = deriv[i];
115 tmp_state.
elem (i) = state[i];
122 pd[nn * j + i] = tmp_pd.
elem (i, j);
124 END_INTERRUPT_WITH_EXCEPTIONS;
148 lrw = 40 + 9*n + n*n;
178 if (res.
length () != x.length ())
180 (*current_liboctave_error_handler)
181 (
"dassl: inconsistent sizes for state and residual vectors");
189 (*current_liboctave_error_handler)
190 (
"dassl: no user supplied RHS subroutine!");
231 if (maxord > 0 && maxord < 6)
238 (*current_liboctave_error_handler)
239 (
"dassl: invalid value for maximum order: %d", maxord);
246 info(9) = enc ? 1 : 0;
249 info(10) = ccic ? 1 : 0;
257 if (abs_tol_len == 1 && rel_tol_len == 1)
261 else if (abs_tol_len == n && rel_tol_len == n)
267 (*current_liboctave_error_handler)
268 (
"dassl: inconsistent sizes for tolerance arrays");
335 (*current_liboctave_error_handler)
336 (
"unrecognized value of istate (= %d) returned from ddassl",
359 if (n_out > 0 && n > 0)
362 xdot_out.
resize (n_out, n);
379 retval.
elem (j, i) = x_next.
elem (i);
404 if (n_out > 0 && n > 0)
407 xdot_out.
resize (n_out, n);
421 double next_crit = tcrit.
elem (0);
423 while (i_out < n_out)
425 bool do_restart =
false;
427 next_out = tout.
elem (i_out);
429 next_crit = tcrit.
elem (i_crit);
434 if (next_crit == next_out)
443 else if (next_crit < next_out)
478 retval.
elem (i_out-1, i) = x_next.
elem (i);
504 std::ostringstream buf;
506 std::string t_curr = buf.str ();
511 retval =
"a step was successfully taken in intermediate-output mode.";
515 retval =
"integration completed by stepping exactly to TOUT";
519 retval =
"integration to tout completed by stepping past TOUT";
523 retval = std::string (
"a large amount of work has been expended (t =")
528 retval =
"the error tolerances are too stringent";
532 retval = std::string (
"error weight became zero during problem. (t = ")
534 +
"; solution component i vanished, and atol or atol(i) == 0)";
538 retval = std::string (
"repeated error test failures on the last attempted step (t = ")
543 retval = std::string (
"the corrector could not converge (t = ")
548 retval = std::string (
"the matrix of partial derivatives is singular (t = ")
553 retval = std::string (
"the corrector could not converge (t = ")
554 + t_curr +
"; repeated test failures)";
558 retval = std::string (
"corrector could not converge because IRES was -1 (t = ")
563 retval = std::string (
"return requested in user-supplied function (t = ")
568 retval =
"failed to compute consistent initial conditions";
572 retval =
"unrecoverable error (see printed message)";
576 retval =
"unknown error state";
std::string error_message(void) const
ColumnVector do_integrate(double t)
octave_idx_type size(void) const
subroutine ddassl(RES, NEQ, T, Y, YPRIME, TOUT, INFO, RTOL, ATOL, IDID, RWORK, LRW, IWORK, LIW, RPAR, IPAR, JAC)
octave_idx_type maximum_order(void) const
static DAEFunc::DAEJacFunc user_jac
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
static DAEFunc::DAERHSFunc user_fun
Matrix integrate(const ColumnVector &tout, Matrix &xdot_out)
Array< double > absolute_tolerance(void) const
static uint32_t state[624]
Array< double > relative_tolerance(void) const
DAERHSFunc function(void) const
Matrix(* DAEJacFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
static octave_idx_type nn
T & elem(octave_idx_type n)
#define F77_XFCN(f, F, args)
DAEJacFunc jacobian_function(void) const
octave_idx_type compute_consistent_initial_condition(void) const
virtual void force_restart(void)
void set_stop_time(double tt)
void resize(const dim_vector &dv, const T &rfv)
octave_idx_type enforce_nonnegativity_constraints(void) const
octave_idx_type capacity(void) const
Number of elements in the array.
octave_idx_type(* dassl_jac_ptr)(const double &, const double *, const double *, double *, const double &, double *, octave_idx_type *)
octave_idx_type(* dassl_fcn_ptr)(const double &, const double *, const double *, double *, octave_idx_type &, double *, octave_idx_type *)
void clear_stop_time(void)
octave_idx_type length(void) const
Number of elements in the array.
static octave_idx_type ddassl_f(const double &time, const double *state, const double *deriv, double *delta, octave_idx_type &ires, double *, octave_idx_type *)
octave_idx_type step_limit(void) const
double initial_step_size(void) const
static octave_idx_type ddassl_j(const double &time, const double *state, const double *deriv, double *pd, const double &cj, double *, octave_idx_type *)
Array< octave_idx_type > iwork
double maximum_step_size(void) const
ColumnVector(* DAERHSFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
const T * fortran_vec(void) const
Array< octave_idx_type > info
F77_RET_T F77_FUNC(ddassl, DDASSL)(dassl_fcn_ptr