Mercurial > hg > octave-jordi
changeset 5552:bcc328604953
[project @ 2005-11-30 05:48:59 by jwe]
author | jwe |
---|---|
date | Wed, 30 Nov 2005 05:48:59 +0000 |
parents | 71cfd8fedd5d |
children | 87c9641d938f |
files | liboctave/ChangeLog liboctave/LSODE.cc scripts/general/blkdiag.m |
diffstat | 3 files changed, 24 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2005-11-30 John W. Eaton <jwe@octave.org> + + * LSODE.cc (LSODE::do_integrate (double)): Resize iwork and rwork + before setting any values in either array. + 2005-11-29 John W. Eaton <jwe@octave.org> * oct-uname.h, oct-uname.cc: New files.
--- a/liboctave/LSODE.cc +++ b/liboctave/LSODE.cc @@ -134,8 +134,8 @@ else method_flag = 22; - liw = 20 + n; - lrw = 22 + n * (9 + n); + liw = 20 + n + 10000; + lrw = 22 + n * (9 + n) + 10000; } else { @@ -149,6 +149,16 @@ maxord = maximum_order (); + iwork.resize (liw); + + for (octave_idx_type i = 4; i < 9; i++) + iwork(i) = 0; + + rwork.resize (lrw); + + for (octave_idx_type i = 4; i < 9; i++) + rwork(i) = 0; + if (maxord >= 0) { if (maxord > 0 && maxord <= max_maxord) @@ -165,16 +175,6 @@ } } - iwork.resize (liw); - - for (octave_idx_type i = 4; i < 9; i++) - iwork(i) = 0; - - rwork.resize (lrw); - - for (octave_idx_type i = 4; i < 9; i++) - rwork(i) = 0; - if (stop_time_set) { itask = 4;
--- a/scripts/general/blkdiag.m +++ b/scripts/general/blkdiag.m @@ -32,22 +32,21 @@ usage ("blkdiag (a, b, c, ...)"); endif - # isnumeric is not an option for cellfun if (! all (cell2mat (cellfun (@isnumeric, varargin)))) - error ("all of the arguments to blkdiag must be numeric"); + error ("blkdiag: all arguments must be numeric"); endif - # ndims is, so it's used here for speed - # note: trailing singletons are automatically (correctly) ignored - if (! all (cellfun ("ndims", varargin) == 2)) + ## Note: trailing singletons are automatically (correctly) ignored. + if (! all (cellfun (@ndims, varargin) == 2)) error ("all of the arguments to blkdiag must be two-dimensional matrices"); endif - # ignore empty matrices - notempty = ! cellfun ("isempty", varargin); + ## Ignore empty matrices. + notempty = ! cellfun (@isempty, varargin); varargin = varargin(notempty); - # size is, but it's a bit different from calling size directly + ## size is an option for cellfun, but it's a bit different from + ## calling size directly. csz = cumsum ([0 0; (cell2mat (cellfun (@size, varargin')))], 1); retval = zeros (csz(end,:)); for p = 1:(length (notempty(notempty)))