# HG changeset patch # User jwe # Date 838244990 0 # Node ID 968a33af8b3d3310121dd957dd15b7cb8159a94e # Parent d7592de300ea3816376e75065c659cd423a0e9ab [project @ 1996-07-24 21:49:32 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -2,6 +2,7 @@ * LSODE.cc (do_integrate): Check to make sure that the state and derivative vectors are the same size. + * DASSL.cc (do_integrate): Likewise. Sun Jul 14 17:30:37 1996 John W. Eaton diff --git a/liboctave/DASSL.cc b/liboctave/DASSL.cc --- a/liboctave/DASSL.cc +++ b/liboctave/DASSL.cc @@ -62,6 +62,8 @@ liw = 0; lrw = 0; + sanity_checked = 0; + info.resize (15); for (int i = 0; i < 15; i++) @@ -79,6 +81,8 @@ liw = 20 + n; lrw = 40 + 9*n + n*n; + sanity_checked = 0; + info.resize (15); for (int i = 0; i < 15; i++) @@ -100,6 +104,8 @@ liw = 20 + n; lrw = 40 + 9*n + n*n; + sanity_checked = 0; + info.resize (15); for (int i = 0; i < 15; i++) @@ -213,6 +219,22 @@ user_fun = DAEFunc::fun; user_jac = DAEFunc::jac; + if (! sanity_checked) + { + ColumnVector res = (*user_fun) (x, xdot, t); + + if (res.length () != x.length ()) + { + (*current_liboctave_error_handler) + ("dassl: inconsistent sizes for state and residual vectors"); + + integration_error = 1; + return retval; + } + + sanity_checked = 1; + } + if (stop_time_set) { info.elem (3) = 1; diff --git a/liboctave/DASSL.h b/liboctave/DASSL.h --- a/liboctave/DASSL.h +++ b/liboctave/DASSL.h @@ -145,6 +145,7 @@ int liw; int lrw; int idid; + int sanity_checked; Array info; Array iwork; Array rwork; diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -2,6 +2,7 @@ * lsode.cc (Flsode): Don't set the return value if an error occurred during integration. + * dassl.cc (Fdassl): Likewise. * file-io.cc (symbols_of_file_io): Redefine values of SEEK_SET, SEEK_CUR, and SEEK_END for Matlab compatibility. diff --git a/src/dassl.cc b/src/dassl.cc --- a/src/dassl.cc +++ b/src/dassl.cc @@ -188,9 +188,14 @@ else output = dae.integrate (out_times, deriv_output); - retval.resize (2); - retval(0) = output; - retval(1) = deriv_output; + if (! error_state) + { + retval.resize (2); + + retval(0) = output; + retval(1) = deriv_output; + } + return retval; }