23 #if defined (HAVE_CONFIG_H)
38 const double*,
double*,
43 const double*,
double*,
44 const double&,
double*,
48 const double&,
const double*,
57 F77_DBLE&, F77_DBLE*, F77_DBLE*,
const F77_DBLE&,
58 F77_INT*,
const F77_DBLE*,
59 const F77_DBLE*, F77_INT&, F77_DBLE*,
60 const F77_INT&, F77_INT*,
61 const F77_INT&, F77_DBLE*,
77 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
84 tmp_state(
i) = state[
i];
85 tmp_deriv(
i) = deriv[
i];
88 ColumnVector tmp_fval = (*user_fsub) (tmp_state, tmp_deriv,
t, ires);
95 delta[
i] = tmp_fval(
i);
98 END_INTERRUPT_WITH_EXCEPTIONS;
107 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
116 tmp_deriv.
elem (
i) = deriv[
i];
117 tmp_state.
elem (
i) = state[
i];
120 Matrix tmp_pd = (*user_jsub) (tmp_state, tmp_deriv, time, cj);
124 pd[nn * j +
i] = tmp_pd.
elem (
i, j);
126 END_INTERRUPT_WITH_EXCEPTIONS;
135 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
141 tmp_state(
i) = state[
i];
146 gout[
i] = tmp_fval(
i);
148 END_INTERRUPT_WITH_EXCEPTIONS;
191 if (maxord > 0 && maxord < 6)
198 (*current_liboctave_error_handler)
199 (
"dassl: invalid value for maximum order");
206 lrw = 50 + 9*n + n*n + 3*
ng;
234 if (fval.
numel () != x.numel ())
236 (*current_liboctave_error_handler)
237 (
"dasrt: inconsistent sizes for state and residual vectors");
245 (*current_liboctave_error_handler)
246 (
"dasrt: no user supplied RHS subroutine!");
294 if (abs_tol_len == 1 && rel_tol_len == 1)
298 else if (abs_tol_len == n && rel_tol_len == n)
304 (*current_liboctave_error_handler)
305 (
"dasrt: inconsistent sizes for tolerance arrays");
378 (*current_liboctave_error_handler)
379 (
"unrecognized value of istate (= %d) returned from ddasrt",
397 if (n_out > 0 && n > 0)
400 xdot_out.
resize (n_out, n);
456 if (n_out > 0 && n > 0)
459 xdot_out.
resize (n_out, n);
467 double next_crit = tcrit(0);
469 while (i_out < n_out)
471 bool do_restart =
false;
473 next_out = tout(i_out);
475 next_crit = tcrit(i_crit);
480 if (next_crit == next_out)
489 else if (next_crit < next_out)
530 x_out(i_out-1,
i) =
x(
i);
531 xdot_out(i_out-1,
i) =
xdot(
i);
534 t_outs(i_out-1) = t_out;
539 xdot_out.
resize (i_out, n);
568 std::ostringstream buf;
575 retval =
"a step was successfully taken in intermediate-output mode.";
579 retval =
"integration completed by stepping exactly to TOUT";
583 retval =
"integration to tout completed by stepping past TOUT";
587 retval =
"integration completed by finding one or more roots of G at T";
591 retval =
std::string (
"a large amount of work has been expended (t =")
596 retval =
"the error tolerances are too stringent";
600 retval =
std::string (
"error weight became zero during problem. (t = ")
602 +
"; solution component i vanished, and atol or atol(i) == 0)";
606 retval =
std::string (
"repeated error test failures on the last attempted step (t = ")
611 retval =
std::string (
"the corrector could not converge (t = ")
616 retval =
std::string (
"the matrix of partial derivatives is singular (t = ")
621 retval =
std::string (
"the corrector could not converge (t = ")
622 + t_curr +
"; repeated test failures)";
626 retval =
std::string (
"corrector could not converge because IRES was -1 (t = ")
631 retval =
std::string (
"return requested in user-supplied function (t = ")
636 retval =
"failed to compute consistent initial conditions";
640 retval =
"unrecoverable error (see printed message)";
644 retval =
"unknown error state";
Array< octave_idx_type > iwork
double maximum_step_size(void) const
bool is_empty(void) const
subroutine ddasrt(RES, NEQ, T, Y, YPRIME, TOUT, INFO, RTOL, ATOL, IDID, RWORK, LRW, IWORK, LIW, RPAR, IPAR, JAC, G, NG, JROOT)
octave_idx_type size(void) const
F77_RET_T F77_FUNC(ddasrt, DDASRT)(dasrt_fcn_ptr
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
octave_idx_type numel(void) const
Number of elements in the array.
F77_RET_T const F77_INT F77_DBLE F77_DBLE F77_DBLE const F77_DBLE F77_INT const F77_DBLE const F77_DBLE F77_INT F77_DBLE const F77_INT F77_INT const F77_INT F77_DBLE F77_INT const F77_INT F77_INT *static DAEFunc::DAERHSFunc user_fsub
DAERTConstrFunc constraint_function(void) const
static DAERTFunc::DAERTConstrFunc user_csub
static octave_idx_type nn
DAERHSFunc function(void) const
Matrix(* DAEJacFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
T & elem(octave_idx_type n)
std::string error_message(void) const
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
#define F77_XFCN(f, F, args)
DAEJacFunc jacobian_function(void) const
octave_idx_type ddasrt_j(const double &time, const double *state, const double *deriv, double *pd, const double &cj, double *, octave_idx_type *)
octave_idx_type(* dasrt_constr_ptr)(const octave_idx_type &, const double &, const double *, const octave_idx_type &, double *, double *, octave_idx_type *)
static octave_idx_type ddasrt_f(const double &t, const double *state, const double *deriv, double *delta, octave_idx_type &ires, double *, octave_idx_type *)
virtual void force_restart(void)
void set_stop_time(double tt)
void resize(const dim_vector &dv, const T &rfv)
ColumnVector(* DAERTConstrFunc)(const ColumnVector &x, double t)
DASRT_result integrate(const ColumnVector &tout)
void clear_stop_time(void)
static uint32_t state[624]
octave_idx_type step_limit(void) const
Array< double > relative_tolerance(void) const
octave_idx_type(* dasrt_fcn_ptr)(const double &, const double *, const double *, double *, octave_idx_type &, double *, octave_idx_type *)
=val(i)}if ode{val(i)}occurs in table i
Array< double > absolute_tolerance(void) const
Array< octave_idx_type > info
Array< octave_idx_type > jroot
octave_idx_type maximum_order(void) const
static octave_idx_type ddasrt_g(const octave_idx_type &neq, const double &t, const double *state, const octave_idx_type &ng, double *gout, double *, octave_idx_type *)
double initial_step_size(void) const
ColumnVector(* DAERHSFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
octave_idx_type(* dasrt_jac_ptr)(const double &, const double *, const double *, double *, const double &, double *, octave_idx_type *)
const T * fortran_vec(void) const
Vector representing the dimensions (size) of an Array.
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
static DAEFunc::DAEJacFunc user_jsub
void resize(octave_idx_type n, const double &rfv=0)