38 const double*,
const double&,
43 const double*,
double*,
44 const double&,
double*,
48 const double&,
const double*,
49 const double*,
const double*,
50 const double&,
const double*,
52 double*,
const double&,
60 double&,
double*,
double*,
double&,
61 const octave_idx_type*,
const double*,
62 const double*, octave_idx_type&,
63 double*,
const octave_idx_type&,
64 octave_idx_type*,
const octave_idx_type&,
65 const double*,
const octave_idx_type*,
78 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
86 tmp_deriv.
elem (i) = deriv[i];
87 tmp_state.
elem (i) = state[i];
90 tmp_delta =
user_fun (tmp_state, tmp_deriv, time, ires);
94 if (tmp_delta.
length () == 0)
99 delta[i] = tmp_delta.
elem (i);
103 END_INTERRUPT_WITH_EXCEPTIONS;
113 const double *,
const double *,
const double&,
117 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
121 END_INTERRUPT_WITH_EXCEPTIONS;
131 BEGIN_INTERRUPT_WITH_EXCEPTIONS;
140 tmp_deriv.
elem (i) = deriv[i];
141 tmp_state.
elem (i) = state[i];
148 pd[nn * j + i] = tmp_pd.
elem (i, j);
150 END_INTERRUPT_WITH_EXCEPTIONS;
199 if (res.
length () != x.length ())
201 (*current_liboctave_error_handler)
202 (
"daspk: inconsistent sizes for state and residual vectors");
210 (*current_liboctave_error_handler)
211 (
"daspk: no user supplied RHS subroutine!");
226 if (eiq == 1 || eiq == 3)
228 if (ccic == 1 || eavfet == 1)
231 lrw = 50 + 9*n + n*n;
246 if (abs_tol_len == 1 && rel_tol_len == 1)
250 else if (abs_tol_len == n && rel_tol_len == n)
256 (*current_liboctave_error_handler)
257 (
"daspk: inconsistent sizes for tolerance arrays");
284 if (maxord > 0 && maxord < 6)
291 (*current_liboctave_error_handler)
292 (
"daspk: invalid value for maximum order");
310 if (val < -2 || val > 2)
312 (*current_liboctave_error_handler)
313 (
"daspk: invalid value for inequality constraint type");
322 (*current_liboctave_error_handler)
323 (
"daspk: inequality constraint types size mismatch");
336 (*current_liboctave_error_handler)
337 (
"daspk: invalid value for enforce inequality constraints option");
353 if (eiq == 0 || eiq == 2)
355 else if (eiq == 1 || eiq == 3)
361 iwork(lid+i) = av(i) ? -1 : 1;
365 (*current_liboctave_error_handler)
366 (
"daspk: algebraic variables size mismatch");
373 (*current_liboctave_error_handler)
374 (
"daspk: invalid value for compute consistent initial condition option");
393 if (eiq == 0 || eiq == 2)
395 else if (eiq == 1 || eiq == 3)
401 iwork(lid+i) = av(i) ? -1 : 1;
421 (*current_liboctave_error_handler)
422 (
"daspk: invalid initial condition heuristics option");
440 (*current_liboctave_error_handler)
441 (
"daspk: invalid value for print initial condition info option");
520 (*current_liboctave_error_handler)
521 (
"unrecognized value of istate (= %d) returned from ddaspk",
544 if (n_out > 0 && n > 0)
547 xdot_out.
resize (n_out, n);
564 retval.
elem (j, i) = x_next.
elem (i);
589 if (n_out > 0 && n > 0)
592 xdot_out.
resize (n_out, n);
606 double next_crit = tcrit.
elem (0);
608 while (i_out < n_out)
610 bool do_restart =
false;
612 next_out = tout.
elem (i_out);
614 next_crit = tcrit.
elem (i_crit);
619 if (next_crit == next_out)
628 else if (next_crit < next_out)
663 retval.
elem (i_out-1, i) = x_next.
elem (i);
689 std::ostringstream buf;
691 std::string t_curr = buf.str ();
696 retval =
"a step was successfully taken in intermediate-output mode.";
700 retval =
"integration completed by stepping exactly to TOUT";
704 retval =
"integration to tout completed by stepping past TOUT";
708 retval =
"initial condition calculation completed successfully";
712 retval = std::string (
"a large amount of work has been expended (t =")
717 retval =
"the error tolerances are too stringent";
721 retval = std::string (
"error weight became zero during problem. (t = ")
723 +
"; solution component i vanished, and atol or atol(i) == 0)";
727 retval = std::string (
"repeated error test failures on the last attempted step (t = ")
732 retval = std::string (
"the corrector could not converge (t = ")
737 retval = std::string (
"the matrix of partial derivatives is singular (t = ")
742 retval = std::string (
"the corrector could not converge (t = ")
743 + t_curr +
"; repeated test failures)";
747 retval = std::string (
"corrector could not converge because IRES was -1 (t = ")
752 retval = std::string (
"return requested in user-supplied function (t = ")
757 retval =
"failed to compute consistent initial conditions";
761 retval = std::string (
"unrecoverable error encountered inside user's PSOL function (t = ")
766 retval = std::string (
"the Krylov linear system solver failed to converge (t = ")
771 retval =
"unrecoverable error (see printed message)";
775 retval =
"unknown error state";