# HG changeset patch # User jwe # Date 1052161256 0 # Node ID 16e8acbd19d5adf374bbc2ec9efd05a8da1eef77 # Parent 28f1efef88f778531ed42d780c24748f90ebba6f [project @ 2003-05-05 19:00:56 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2003-05-04 John W. Eaton + + * kpse.cc (dir_list_add): Ensure that directory ends with a + directory separator. + 2003-04-30 John W. Eaton * pathsearch.cc: Include kpse.cc here. diff --git a/liboctave/kpse.cc b/liboctave/kpse.cc --- a/liboctave/kpse.cc +++ b/liboctave/kpse.cc @@ -2588,8 +2588,10 @@ dir_list_add (str_llist_type *l, const std::string& dir) { char last_char = dir[dir.length () - 1]; + std::string saved_dir = dir; - if (IS_DIR_SEP (last_char) || IS_DEVICE_SEP (last_char)) + + if (! (IS_DIR_SEP (last_char) || IS_DEVICE_SEP (last_char))) saved_dir += DIR_SEP_STRING; str_llist_add (l, saved_dir); diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2003-05-05 Andy Adler + + * plot/hist.m: Improve performance by using different algorithms + depending on number of bins. + 2003-05-01 John W. Eaton * control/system/sysadd.m: If systems are not "tf", convert before diff --git a/scripts/plot/hist.m b/scripts/plot/hist.m --- a/scripts/plot/hist.m +++ b/scripts/plot/hist.m @@ -77,26 +77,32 @@ warning ("hist: bin values not sorted on input"); x = tmp; endif - n = length (x); - cutoff = zeros (1, n-1); - for i = 1:n-1 - cutoff (i) = (x (i) + x (i+1)) / 2; - endfor + cutoff = (x(1:end-1) + x(2:end)) / 2; else error ("hist: second argument must be a scalar or a vector"); endif endif - freq = zeros (1, n); - freq (1) = sum (y < cutoff (1)); - for i = 2:n-1 - freq (i) = sum (y >= cutoff (i-1) & y < cutoff (i)); - endfor - freq (n) = sum (y >= cutoff (n-1)); + if (n < 30) + ## The following algorithm works fastest for n less than about 30. + chist = [zeros(n,1); length(y)]; + for i = 1:n-1 + chist(i+1) = sum (y < cutoff(i)); + endfor + else + ## The following algorithm works fastest for n greater than about 30. + ## Put cutoff elements between boundaries, integrate over all + ## elements, keep totals at boundaries. + [s, idx] = sort ([cutoff(:); y(:)]); + chist = cumsum(idx>n); + chist = [0; chist(idx 0)