Mercurial > hg > octave-lyh
diff liboctave/LSODE.cc @ 3952:945e8c160191
[project @ 2002-05-23 17:18:12 by jwe]
author | jwe |
---|---|
date | Thu, 23 May 2002 17:18:13 +0000 |
parents | 7da18459c08b |
children | 3a8de88328af |
line wrap: on
line diff
--- a/liboctave/LSODE.cc +++ b/liboctave/LSODE.cc @@ -46,9 +46,9 @@ extern "C" int F77_FUNC (lsode, LSODE) (lsode_fcn_ptr, int&, double*, double&, - double&, int&, double&, double&, int&, - int&, int&, double*, int&, int*, int&, - lsode_jac_ptr, int&); + double&, int&, double&, const double*, int&, + int&, int&, double*, int&, int*, int&, + lsode_jac_ptr, int&); static ODEFunc::ODERHSFunc user_fun; static ODEFunc::ODEJacFunc user_jac; @@ -65,7 +65,6 @@ restart = 1; istate = 1; - itol = 1; itask = 1; iopt = 0; @@ -87,7 +86,6 @@ restart = 1; istate = 1; - itol = 1; itask = 1; iopt = 0; @@ -229,9 +227,27 @@ itask = 1; } - double abs_tol = absolute_tolerance (); double rel_tol = relative_tolerance (); + const Array<double> abs_tol = absolute_tolerance (); + + int abs_tol_len = abs_tol.length (); + + int itol; + + if (abs_tol_len == 1) + itol = 1; + else if (abs_tol_len == n) + itol == 2; + else + { + (*current_liboctave_error_handler) + ("lsode: inconsistent sizes for state and absolute tolerance vectors"); + + integration_error = 1; + return retval; + } + if (initial_step_size () >= 0.0) { rwork.elem (4) = initial_step_size (); @@ -256,11 +272,12 @@ iopt = 1; } + const double *pabs_tol = abs_tol.fortran_vec (); int *piwork = iwork.fortran_vec (); double *prwork = rwork.fortran_vec (); F77_XFCN (lsode, LSODE, (lsode_f, n, xp, t, tout, itol, rel_tol, - abs_tol, itask, istate, iopt, prwork, lrw, + pabs_tol, itask, istate, iopt, prwork, lrw, piwork, liw, lsode_j, method_flag)); if (f77_exception_encountered)