# HG changeset patch # User jwe # Date 1078341873 0 # Node ID 198f3712c6925dab819b5c4bed45b5b7c27ee891 # Parent 72a6d410a14a42ff0593a75099ac8f50c2673b64 [project @ 2004-03-03 19:24:33 by jwe] diff -r 72a6d410a14a -r 198f3712c692 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Mar 03 18:49:39 2004 +0000 +++ b/liboctave/ChangeLog Wed Mar 03 19:24:33 2004 +0000 @@ -1,3 +1,17 @@ +2004-03-03 Hans Ekkehard Plesser + + * base-lu.cc (base_lu<>::L): Check bounds before setting diagonal + element. + +2004-03-03 John W. Eaton + + * Range.h (Range::Range): Add cache to member initialization list. + (Range::clear_cache): New private function. + + * Range.h (Range::set_base, Range::set_limit, Range::set_inc): + Use clear cache. Don't do anything if range does not change. + * Range.cc (Range::sort): Likewise. + 2004-03-02 Paul Kienzle * Range.cc (Range::matrix_value): Cache result. diff -r 72a6d410a14a -r 198f3712c692 liboctave/Range.cc --- a/liboctave/Range.cc Wed Mar 03 18:49:39 2004 +0000 +++ b/liboctave/Range.cc Wed Mar 03 19:24:33 2004 +0000 @@ -52,7 +52,7 @@ Matrix Range::matrix_value (void) const { - if (rng_nelem > 0 && cache.rows() == 0) + if (rng_nelem > 0 && cache.rows () == 0) { cache.resize (1, rng_nelem); double b = rng_base; @@ -129,7 +129,7 @@ rng_base = min (); rng_limit = tmp; rng_inc = -rng_inc; - cache.resize (0,0); + clear_cache (); } } diff -r 72a6d410a14a -r 198f3712c692 liboctave/Range.h --- a/liboctave/Range.h Wed Mar 03 18:49:39 2004 +0000 +++ b/liboctave/Range.h Wed Mar 03 19:24:33 2004 +0000 @@ -36,23 +36,23 @@ public: Range (void) - : rng_base (-1), rng_limit (-1), rng_inc (-1), rng_nelem (-1) { } + : rng_base (-1), rng_limit (-1), rng_inc (-1), rng_nelem (-1), cache () { } Range (const Range& r) : rng_base (r.rng_base), rng_limit (r.rng_limit), rng_inc (r.rng_inc), - rng_nelem (r.rng_nelem) { } + rng_nelem (r.rng_nelem), cache () { } Range (double b, double l) : rng_base (b), rng_limit (l), rng_inc (1), - rng_nelem (nelem_internal ()) { } + rng_nelem (nelem_internal ()), cache () { } Range (double b, double l, double i) : rng_base (b), rng_limit (l), rng_inc (i), - rng_nelem (nelem_internal ()) { } + rng_nelem (nelem_internal ()), cache () { } - double base (void) const { return rng_base; } + double base (void) const { return rng_base; } double limit (void) const { return rng_limit; } - double inc (void) const { return rng_inc; } + double inc (void) const { return rng_inc; } int nelem (void) const { return rng_nelem; } bool all_elements_are_ints (void) const; @@ -64,9 +64,32 @@ void sort (void); - void set_base (double b) { rng_base = b; cache.resize (0,0); } - void set_limit (double l) { rng_limit = l; cache.resize (0,0); } - void set_inc (double i) { rng_inc = i; cache.resize (0,0); } + void set_base (double b) + { + if (rng_base != b) + { + rng_base = b; + clear_cache (); + } + } + + void set_limit (double l) + { + if (rng_limit != l) + { + rng_limit = l; + clear_cache (); + } + } + + void set_inc (double i) + { + if (rng_inc != i) + { + rng_inc = i; + clear_cache (); + } + } friend std::ostream& operator << (std::ostream& os, const Range& r); friend std::istream& operator >> (std::istream& is, Range& r); @@ -75,14 +98,17 @@ private: - mutable Matrix cache; double rng_base; double rng_limit; double rng_inc; int rng_nelem; + mutable Matrix cache; + int nelem_internal (void) const; + + void clear_cache (void) const { cache.resize (0, 0); } }; extern Range operator - (const Range& r); diff -r 72a6d410a14a -r 198f3712c692 liboctave/base-lu.cc --- a/liboctave/base-lu.cc Wed Mar 03 18:49:39 2004 +0000 +++ b/liboctave/base-lu.cc Wed Mar 03 19:24:33 2004 +0000 @@ -42,7 +42,9 @@ for (int i = 0; i < a_nr; i++) { - l.xelem (i, i) = 1.0; + if (i < a_nc) + l.xelem (i, i) = 1.0; + for (int j = 0; j < (i < a_nc ? i : a_nc); j++) l.xelem (i, j) = a_fact.xelem (i, j); } diff -r 72a6d410a14a -r 198f3712c692 scripts/ChangeLog --- a/scripts/ChangeLog Wed Mar 03 18:49:39 2004 +0000 +++ b/scripts/ChangeLog Wed Mar 03 19:24:33 2004 +0000 @@ -1,3 +1,7 @@ +2004-03-03 Stefan van der Walt + + * plot/hist.m: Compute histogram correctly for n>=30. + 2004-03-02 Paul Kienzle * signal/sinc.m: Use i(:) instead of i when checking for any nonzeros. diff -r 72a6d410a14a -r 198f3712c692 scripts/plot/hist.m --- a/scripts/plot/hist.m Wed Mar 03 18:49:39 2004 +0000 +++ b/scripts/plot/hist.m Wed Mar 03 19:24:33 2004 +0000 @@ -95,7 +95,7 @@ ## Put cutoff elements between boundaries, integrate over all ## elements, keep totals at boundaries. [s, idx] = sort ([cutoff(:); y(:)]); - chist = cumsum(idx>n); + chist = cumsum(idx>=n); chist = [0; chist(idx