Mercurial > hg > octave-nkf
changeset 5766:f3be83cff153
[project @ 2006-04-18 15:17:34 by jwe]
author | jwe |
---|---|
date | Tue, 18 Apr 2006 15:18:22 +0000 |
parents | 7ba9ad1fec11 |
children | 26f92fb8ba33 |
files | liboctave/ChangeLog liboctave/Sparse.cc liboctave/randmtzig.c |
diffstat | 3 files changed, 22 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,11 @@ +2006-04-18 John W. Eaton <jwe@octave.org> + + * randmtzig.c (randmt, randi53, randi54, randi64, randu32, randu53): + Omit inline from decl. + + * Sparse.cc (Sparse<T>::index): Use std::vector<bool> to avoid + local array with variable dimension. + 2006-04-16 John W. Eaton <jwe@octave.org> * lo-sstream.h: Delete.
--- a/liboctave/Sparse.cc +++ b/liboctave/Sparse.cc @@ -1894,9 +1894,7 @@ retval = Sparse<T> (n, m, nnz ()); octave_idx_type *ri = retval.xridx (); - // Can't use OCTAVE_LOCAL_BUFFER with bool, and so - // can't with T either - T X [n]; + std::vector<T> X (n); for (octave_idx_type i = 0; i < nr; i++) itmp [i] = -1; for (octave_idx_type i = 0; i < n; i++)
--- a/liboctave/randmtzig.c +++ b/liboctave/randmtzig.c @@ -98,15 +98,15 @@ void oct_init_by_entropy(void) random initial state void oct_get_state(uint32_t save[MT_N+1]) saves state in array void oct_set_state(uint32_t save[MT_N+1]) restores state from array - static inline uint32_t randmt(void) returns 32-bit unsigned int + static uint32_t randmt(void) returns 32-bit unsigned int === inline generators === - static inline uint32_t randi32(void) returns 32-bit unsigned int - static inline uint64_t randi53(void) returns 53-bit unsigned int - static inline uint64_t randi54(void) returns 54-bit unsigned int - static inline uint64_t randi64(void) returns 64-bit unsigned int - static inline double randu32(void) returns 32-bit uniform in (0,1) - static inline double randu53(void) returns 53-bit uniform in (0,1) + static uint32_t randi32(void) returns 32-bit unsigned int + static uint64_t randi53(void) returns 53-bit unsigned int + static uint64_t randi54(void) returns 54-bit unsigned int + static uint64_t randi64(void) returns 64-bit unsigned int + static double randu32(void) returns 32-bit uniform in (0,1) + static double randu53(void) returns 53-bit uniform in (0,1) double oct_randu(void) returns M-bit uniform in (0,1) double oct_randn(void) returns M-bit standard normal @@ -303,7 +303,7 @@ } /* generates a random number on [0,0xffffffff]-interval */ -static inline uint32_t +static uint32_t randmt (void) { register uint32_t y; @@ -324,7 +324,7 @@ /* Select which 32 bit generator to use */ #define randi32 randmt -static inline uint64_t +static uint64_t randi53 (void) { const uint32_t lo = randi32(); @@ -340,7 +340,7 @@ #endif } -static inline uint64_t +static uint64_t randi54 (void) { const uint32_t lo = randi32(); @@ -356,7 +356,7 @@ #endif } -static inline uint64_t +static uint64_t randi64 (void) { const uint32_t lo = randi32(); @@ -373,7 +373,7 @@ } /* generates a random number on (0,1)-real-interval */ -static inline double +static double randu32 (void) { return ((double)randi32() + 0.5) * (1.0/4294967296.0); @@ -381,7 +381,7 @@ } /* generates a random number on (0,1) with 53-bit resolution */ -static inline double +static double randu53 (void) { const uint32_t a=randi32()>>5;