# HG changeset patch # User jwe # Date 948793457 0 # Node ID 64f8babb7b3de6ae9861569195cdf6b75046425e # Parent 9c509e1cbf494c373e2bc33562eed6d92f513a63 [project @ 2000-01-25 09:44:15 by jwe] diff -r 9c509e1cbf49 -r 64f8babb7b3d ChangeLog --- a/ChangeLog Mon Jan 24 05:05:50 2000 +0000 +++ b/ChangeLog Tue Jan 25 09:44:17 2000 +0000 @@ -1,3 +1,8 @@ +2000-01-24 John W. Eaton + + * emacs/octave-mod.el (octave-mode-syntax-table): + Make `%' a comment start character too. + 2000-01-20 John W. Eaton * configure.in: Check for strptime and localtime_r. diff -r 9c509e1cbf49 -r 64f8babb7b3d emacs/octave-mod.el --- a/emacs/octave-mod.el Mon Jan 24 05:05:50 2000 +0000 +++ b/emacs/octave-mod.el Tue Jan 25 09:44:17 2000 +0000 @@ -301,7 +301,7 @@ (modify-syntax-entry ?\" "\"" table) (modify-syntax-entry ?. "w" table) (modify-syntax-entry ?_ "w" table) - (modify-syntax-entry ?\% "." table) + (modify-syntax-entry ?\% "<" table) (modify-syntax-entry ?\# "<" table) (modify-syntax-entry ?\n ">" table) (setq octave-mode-syntax-table table))) diff -r 9c509e1cbf49 -r 64f8babb7b3d liboctave/Array2.cc --- a/liboctave/Array2.cc Mon Jan 24 05:05:50 2000 +0000 +++ b/liboctave/Array2.cc Tue Jan 25 09:44:17 2000 +0000 @@ -43,6 +43,51 @@ #include "lo-error.h" template +int +Array2::get_size (int r, int c) const +{ + // XXX KLUGE XXX + + // If an allocation of an array with r * c elements of type T + // would cause an overflow in the allocator when computing the + // size of the allocation, then return a value which, although + // not equivalent to the actual request, should be too large for + // most current hardware, but not so large to cause the + // allocator to barf on computing retval * sizeof (T). + + // A guess (should be quite conservative). + static const int MALLOC_OVERHEAD = 1024; + + static int nl; + static double dl + = frexp (static_cast + (INT_MAX - MALLOC_OVERHEAD) / sizeof (T), &nl); + + // This value should be an integer. If we return this value and + // things work the way we expect, we should be paying a visit to + // new_handler in no time flat. + static int max_items = static_cast (ldexp (dl, nl)); + + int nr, nc; + double dr = frexp (static_cast (r), &nr); + double dc = frexp (static_cast (c), &nc); + + int nt = nr + nc; + double dt = dr * dc; + + if (dt <= 0.5) + { + nt--; + dt *= 2; + + if (dt <= 0.5) + nt--; + } + + return (nt < nl || (nt == nl && dt < dl)) ? r * c : max_items; +} + +template T Array2::range_error (const char *fcn, int i, int j) const { @@ -84,7 +129,7 @@ int old_d2 = dim2 (); int old_len = length (); - rep = new ArrayRep (r*c); + rep = new ArrayRep (get_size (r, c)); d1 = r; d2 = c; @@ -124,7 +169,7 @@ int old_d2 = dim2 (); int old_len = length (); - rep = new ArrayRep (r*c); + rep = new ArrayRep (get_size (r, c)); d1 = r; d2 = c; diff -r 9c509e1cbf49 -r 64f8babb7b3d liboctave/Array2.h --- a/liboctave/Array2.h Mon Jan 24 05:05:50 2000 +0000 +++ b/liboctave/Array2.h Tue Jan 25 09:44:17 2000 +0000 @@ -29,6 +29,8 @@ #endif #include +#include +#include #include #include "Array.h" @@ -41,9 +43,13 @@ template class Array2 : public Array { +private: + + int get_size (int r, int c) const; + protected: - Array2 (T *d, int n, int m) : Array (d, n*m) + Array2 (T *d, int n, int m) : Array (d, get_size (n, m)) { d1 = n; d2 = m; @@ -66,14 +72,14 @@ set_max_indices (2); } - Array2 (int n, int m) : Array (n*m) + Array2 (int n, int m) : Array (get_size (n, m)) { d1 = n; d2 = m; set_max_indices (2); } - Array2 (int n, int m, const T& val) : Array (n*m, val) + Array2 (int n, int m, const T& val) : Array (get_size (n, m), val) { d1 = n; d2 = m; diff -r 9c509e1cbf49 -r 64f8babb7b3d liboctave/ChangeLog --- a/liboctave/ChangeLog Mon Jan 24 05:05:50 2000 +0000 +++ b/liboctave/ChangeLog Tue Jan 25 09:44:17 2000 +0000 @@ -1,3 +1,8 @@ +2000-01-25 John W. Eaton + + * Array2.cc (Array2::get_size): New function. + (Array2::Array2, Array2::resize): Use it. + 2000-01-23 John W. Eaton * Array2-idx.h (Array2::maybe_delete_elements (idx_vector&)): diff -r 9c509e1cbf49 -r 64f8babb7b3d scripts/ChangeLog --- a/scripts/ChangeLog Mon Jan 24 05:05:50 2000 +0000 +++ b/scripts/ChangeLog Tue Jan 25 09:44:17 2000 +0000 @@ -1,3 +1,7 @@ +2000-01-24 Cyril Humbert + + * statistics/distributions/weibull_pdf.m: Use correct formula. + 2000-01-22 Michael Reifenberger * audio/saveaudio.m: Also accept files with .ul extension. diff -r 9c509e1cbf49 -r 64f8babb7b3d scripts/statistics/distributions/weibull_pdf.m --- a/scripts/statistics/distributions/weibull_pdf.m Mon Jan 24 05:05:50 2000 +0000 +++ b/scripts/statistics/distributions/weibull_pdf.m Tue Jan 25 09:44:17 2000 +0000 @@ -58,7 +58,7 @@ k = find ((x > 0) & (x < Inf) & ok); if (any (k)) - pdf(k) = (shape(k) .* (scale(k) .^ shape(k)) + pdf(k) = (shape(k) .* (scale(k) .^ -shape(k)) .* (x(k) .^ (shape(k) - 1)) .* exp(- (x(k) ./ scale(k)) .^ shape(k))); endif