comparison 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
comparison
equal deleted inserted replaced
9985:43a29eeda994 9986:672e1b49e01e
75 Range sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0, 75 Range sort (Array<octave_idx_type>& sidx, octave_idx_type dim = 0,
76 sortmode mode = ASCENDING) const; 76 sortmode mode = ASCENDING) const;
77 77
78 sortmode is_sorted (sortmode mode = ASCENDING) const; 78 sortmode is_sorted (sortmode mode = ASCENDING) const;
79 79
80 // Support for single-index subscripting, without generating matrix cache.
81
82 double checkelem (octave_idx_type i) const;
83
84 double elem (octave_idx_type i) const
85 {
86 #if defined (BOUNDS_CHECKING)
87 return checkelem (i);
88 #else
89 return rng_base + rng_inc * i;
90 #endif
91 }
92
93 Array<double> index (const idx_vector& i) const;
94
80 void set_base (double b) 95 void set_base (double b)
81 { 96 {
82 if (rng_base != b) 97 if (rng_base != b)
83 { 98 {
84 rng_base = b; 99 rng_base = b;