Mercurial > hg > octave-nkf
diff liboctave/Range.h @ 9986:672e1b49e01e
optimize indexing of ranges by single subscripts
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 15 Dec 2009 10:04:34 +0100 |
parents | 967a692ddfe2 |
children | 4c0cdbe0acca |
line wrap: on
line diff
--- a/liboctave/Range.h +++ b/liboctave/Range.h @@ -77,6 +77,21 @@ sortmode is_sorted (sortmode mode = ASCENDING) const; + // Support for single-index subscripting, without generating matrix cache. + + double checkelem (octave_idx_type i) const; + + double elem (octave_idx_type i) const + { +#if defined (BOUNDS_CHECKING) + return checkelem (i); +#else + return rng_base + rng_inc * i; +#endif + } + + Array<double> index (const idx_vector& i) const; + void set_base (double b) { if (rng_base != b)