Mercurial > hg > octave-nkf
changeset 2343:d7592de300ea
[project @ 1996-07-24 21:42:44 by jwe]
author | jwe |
---|---|
date | Wed, 24 Jul 1996 21:44:51 +0000 |
parents | 95e511896bf5 |
children | 968a33af8b3d |
files | liboctave/ChangeLog liboctave/LSODE.cc liboctave/LSODE.h src/ChangeLog src/lsode.cc |
diffstat | 5 files changed, 36 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 24 16:39:16 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + + * LSODE.cc (do_integrate): Check to make sure that the state and + derivative vectors are the same size. + Sun Jul 14 17:30:37 1996 John W. Eaton <jwe@bevo.che.wisc.edu> * dMatrix.cc (Matrix::read, Matrix::write): Convert to use
--- a/liboctave/LSODE.cc +++ b/liboctave/LSODE.cc @@ -71,6 +71,8 @@ liw = 20 + n; lrw = 22 + n * (9 + n); + + sanity_checked = 0; } LSODE::LSODE (const ColumnVector& state, double time, const ODEFunc& f) @@ -91,6 +93,8 @@ liw = 20 + n; lrw = 22 + n * (9 + n); + + sanity_checked = 0; } void @@ -116,7 +120,7 @@ lsode_f (const int& neq, const double& time, double *, double *deriv, int& ierr) { - ColumnVector tmp_deriv (neq); + ColumnVector tmp_deriv; // NOTE: this won't work if LSODE passes copies of the state vector. // In that case we have to create a temporary vector object @@ -198,6 +202,22 @@ user_fun = function (); user_jac = jacobian_function (); + if (! sanity_checked) + { + ColumnVector xdot = (*user_fun) (x, t); + + if (x.length () != xdot.length ()) + { + (*current_liboctave_error_handler) + ("lsode: inconsistent sizes for state and derivative vectors"); + + integration_error = 1; + return retval; + } + + sanity_checked = 1; + } + // Try 5000 steps before giving up. iwork.elem (5) = 5000;
--- a/liboctave/LSODE.h +++ b/liboctave/LSODE.h @@ -165,6 +165,7 @@ int liw; int lrw; int working_too_hard; + int sanity_checked; friend int lsode_f (int *neq, double *t, double *y, double *ydot);
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ Wed Jul 24 05:08:07 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + * lsode.cc (Flsode): Don't set the return value if an error + occurred during integration. + * file-io.cc (symbols_of_file_io): Redefine values of SEEK_SET, SEEK_CUR, and SEEK_END for Matlab compatibility. * oct-stream.cc (seek): Check for compatible values of ORIGIN arg.