Mercurial > hg > octave-nkf
changeset 2344:968a33af8b3d
[project @ 1996-07-24 21:49:32 by jwe]
author | jwe |
---|---|
date | Wed, 24 Jul 1996 21:49:50 +0000 |
parents | d7592de300ea |
children | 0f441b4fefdb |
files | liboctave/ChangeLog liboctave/DASSL.cc liboctave/DASSL.h src/ChangeLog src/dassl.cc |
diffstat | 5 files changed, 33 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 <jwe@bevo.che.wisc.edu>
--- 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;
--- a/liboctave/DASSL.h +++ b/liboctave/DASSL.h @@ -145,6 +145,7 @@ int liw; int lrw; int idid; + int sanity_checked; Array<int> info; Array<int> iwork; Array<double> rwork;
--- 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.
--- 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; }