# HG changeset patch # User jwe # Date 1133329739 0 # Node ID bcc328604953305dd0fee0ec7ee61bc46960b9d1 # Parent 71cfd8fedd5decb3d2caaa2f8380bfcbc958f4c1 [project @ 2005-11-30 05:48:59 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2005-11-30 John W. Eaton + + * LSODE.cc (LSODE::do_integrate (double)): Resize iwork and rwork + before setting any values in either array. + 2005-11-29 John W. Eaton * oct-uname.h, oct-uname.cc: New files. diff --git a/liboctave/LSODE.cc b/liboctave/LSODE.cc --- 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; diff --git a/scripts/general/blkdiag.m b/scripts/general/blkdiag.m --- 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)))