23 #if defined (HAVE_CONFIG_H) 38 double*,
const double&,
double*,
F77_INT*);
66 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
74 tmp_deriv(
i) = deriv[
i];
79 ColumnVector tmp_fval = (*user_fsub) (tmp_state, tmp_deriv,
t, tmp_ires);
81 ires = octave::to_f77_int (tmp_ires);
88 delta[
i] = tmp_fval(
i);
91 END_INTERRUPT_WITH_EXCEPTIONS;
98 double *pd,
const double& cj,
double *,
F77_INT *)
100 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
109 tmp_deriv.
elem (
i) = deriv[
i];
113 Matrix tmp_pd = (*user_jsub) (tmp_state, tmp_deriv, time, cj);
117 pd[
nn * j +
i] = tmp_pd.
elem (
i, j);
119 END_INTERRUPT_WITH_EXCEPTIONS;
128 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
139 gout[
i] = tmp_fval(
i);
141 END_INTERRUPT_WITH_EXCEPTIONS;
176 ng = octave::to_f77_int (
tmp.numel ());
181 F77_INT maxord = octave::to_f77_int (maximum_order ());
184 if (maxord > 0 && maxord < 6)
191 (*current_liboctave_error_handler)
192 (
"dassl: invalid value for maximum order");
199 lrw = 50 + 9*n + n*n + 3*
ng;
229 (*current_liboctave_error_handler)
230 (
"dasrt: inconsistent sizes for state and residual vectors");
238 (*current_liboctave_error_handler)
239 (
"dasrt: no user supplied RHS subroutine!");
255 double mss = maximum_step_size ();
264 double iss = initial_step_size ();
273 F77_INT sl = octave::to_f77_int (step_limit ());
282 abs_tol = absolute_tolerance ();
283 rel_tol = relative_tolerance ();
288 if (abs_tol_len == 1 && rel_tol_len == 1)
292 else if (abs_tol_len == n && rel_tol_len == n)
298 (*current_liboctave_error_handler)
299 (
"dasrt: inconsistent sizes for tolerance arrays");
305 DASRT_options::reset =
false;
321 double *dummy =
nullptr;
327 prel_tol, pabs_tol, tmp_istate, prwork,
lrw,
376 (*current_liboctave_error_handler)
377 (
"unrecognized value of istate (= %d) returned from ddasrt",
395 if (n_out > 0 && n > 0)
398 xdot_out.
resize (n_out, n);
454 if (n_out > 0 && n > 0)
457 xdot_out.
resize (n_out, n);
465 double next_crit = tcrit(0);
467 while (i_out < n_out)
469 bool do_restart =
false;
471 next_out = tout(i_out);
473 next_crit = tcrit(i_crit);
475 bool save_output =
false;
478 if (next_crit == next_out)
487 else if (next_crit < next_out)
528 x_out(i_out-1,
i) =
x(
i);
529 xdot_out(i_out-1,
i) =
xdot(
i);
532 t_outs(i_out-1) = t_out;
537 xdot_out.
resize (i_out, n);
566 std::ostringstream buf;
573 retval =
"a step was successfully taken in intermediate-output mode.";
577 retval =
"integration completed by stepping exactly to TOUT";
581 retval =
"integration to tout completed by stepping past TOUT";
585 retval =
"integration completed by finding one or more roots of G at T";
589 retval =
"a large amount of work has been expended (t =" + t_curr +
')';
593 retval =
"the error tolerances are too stringent";
597 retval =
"error weight became zero during problem. (t = " + t_curr +
598 "; solution component i vanished, and atol or atol(i) == 0)";
602 retval =
"repeated error test failures on the last attempted step (t = " 607 retval =
"the corrector could not converge (t = " + t_curr +
')';
611 retval =
"the matrix of partial derivatives is singular (t = " + t_curr +
616 retval =
"the corrector could not converge (t = " + t_curr +
617 "; repeated test failures)";
621 retval =
"corrector could not converge because IRES was -1 (t = " 626 retval =
"return requested in user-supplied function (t = " + t_curr +
631 retval =
"failed to compute consistent initial conditions";
635 retval =
"unrecoverable error (see printed message)";
639 retval =
"unknown error state";
std::string error_message(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)
Array< octave_f77_int_type > iwork
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
const T * fortran_vec(void) const
static DAERTFunc::DAERTConstrFunc user_csub
Array< octave_f77_int_type > jroot
static F77_INT ddasrt_g(const F77_INT &neq, const double &t, const double *state, const F77_INT &ng, double *gout, double *, F77_INT *)
T & elem(octave_idx_type n)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Array< octave_f77_int_type > info
DAERTConstrFunc constraint_function(void) const
#define F77_XFCN(f, F, args)
subroutine DDASRT(RES, NEQ, T, Y, YPRIME, TOUT, INFO, RTOL, ATOL, IDID, RWORK, LRW, IWORK, LIW, RPAR, IPAR, JAC, G, NG, JROOT)
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_INT ddasrt_j(const double &time, const double *state, const double *deriv, double *pd, const double &cj, double *, F77_INT *)
octave_idx_type size(void) const
Matrix(* DAEJacFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, double cj)
virtual void force_restart(void)
void set_stop_time(double tt)
DAEJacFunc jacobian_function(void) const
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
ColumnVector(* DAERTConstrFunc)(const ColumnVector &x, double t)
DASRT_result integrate(const ColumnVector &tout)
static F77_INT ddasrt_f(const double &t, const double *state, const double *deriv, double *delta, F77_INT &ires, double *, F77_INT *)
void clear_stop_time(void)
static uint32_t state[624]
octave_f77_int_type F77_INT
F77_INT(* dasrt_constr_ptr)(const F77_INT &, const double &, const double *, const F77_INT &, double *, double *, F77_INT *)
DAERHSFunc function(void) const
ColumnVector(* DAERHSFunc)(const ColumnVector &x, const ColumnVector &xdot, double t, octave_idx_type &ires)
F77_INT(* dasrt_fcn_ptr)(const double &, const double *, const double *, double *, F77_INT &, double *, F77_INT *)
octave_idx_type numel(void) const
Number of elements in the array.
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
F77_INT(* dasrt_jac_ptr)(const double &, const double *, const double *, double *, const double &, double *, F77_INT *)
void resize(octave_idx_type n, const double &rfv=0)