comparison liboctave/array/idx-vector.h @ 28638:98192ec1621f

replace Range with range<double> * __magick_read__.cc, cellfun.cc, data.cc, ls-mat4.cc, max.cc, pr-output.cc, pr-output.h, rand.cc, tril.cc, xpow.cc, xpow.h, ov-base.cc, ov-base.h, ov-range.cc, ov-range.h, ov.cc, ov.h, jit-typeinfo.cc, jit-typeinfo.h, pt-eval.cc, pt-jit.cc, idx-vector.cc, idx-vector.h: Replace all uses of Range with range<double>. * Range.h: Deprecated Range constructors.
author John W. Eaton <jwe@octave.org>
date Thu, 06 Aug 2020 16:28:30 -0400
parents bd51beb6205e
children f8efd03a553e
comparison
equal deleted inserted replaced
28637:fb37f50d5ba8 28638:98192ec1621f
39 #include "oct-inttypes-fwd.h" 39 #include "oct-inttypes-fwd.h"
40 #include "oct-refcount.h" 40 #include "oct-refcount.h"
41 41
42 template <typename T> class Array; 42 template <typename T> class Array;
43 template <typename T> class Sparse; 43 template <typename T> class Sparse;
44 class Range; 44
45 namespace octave
46 {
47 template <typename T> class range;
48 }
45 49
46 // Design rationale: 50 // Design rationale:
47 // idx_vector is a reference-counting, polymorphic pointer, that can contain 51 //
48 // 4 types of index objects: a magic colon, a range, a scalar, or an index vector. 52 // idx_vector is a reference-counting, polymorphic pointer, that can
49 // Polymorphic methods for single element access are provided, as well as 53 // contain 4 types of index objects: a magic colon, a range, a scalar,
50 // templates implementing "early dispatch", i.e., hoisting the checks for index 54 // or an index vector.
51 // type out of loops. 55 //
56 // Polymorphic methods for single element access are provided, as well
57 // as templates implementing "early dispatch", i.e., hoisting the checks
58 // for index type out of loops.
52 59
53 class 60 class
54 OCTAVE_API 61 OCTAVE_API
55 idx_vector 62 idx_vector
56 { 63 {
171 178
172 // Zero-based constructor. 179 // Zero-based constructor.
173 idx_range_rep (octave_idx_type _start, octave_idx_type _limit, 180 idx_range_rep (octave_idx_type _start, octave_idx_type _limit,
174 octave_idx_type _step); 181 octave_idx_type _step);
175 182
176 idx_range_rep (const Range&); 183 idx_range_rep (const octave::range<double>&);
177 184
178 // No copying! 185 // No copying!
179 186
180 idx_range_rep (const idx_range_rep& idx) = delete; 187 idx_range_rep (const idx_range_rep& idx) = delete;
181 188
210 217
211 octave_idx_type get_step (void) const { return step; } 218 octave_idx_type get_step (void) const { return step; }
212 219
213 std::ostream& print (std::ostream& os) const; 220 std::ostream& print (std::ostream& os) const;
214 221
215 Range unconvert (void) const; 222 octave::range<double> unconvert (void) const;
216 223
217 Array<octave_idx_type> as_array (void); 224 Array<octave_idx_type> as_array (void);
218 225
219 private: 226 private:
220 227
523 idx_vector (const Array<float>& nda) : rep (new idx_vector_rep (nda)) 530 idx_vector (const Array<float>& nda) : rep (new idx_vector_rep (nda))
524 { chkerr (); } 531 { chkerr (); }
525 532
526 idx_vector (const Array<bool>& nda); 533 idx_vector (const Array<bool>& nda);
527 534
528 idx_vector (const Range& r) 535 idx_vector (const octave::range<double>& r)
529 : rep (new idx_range_rep (r)) 536 : rep (new idx_range_rep (r))
530 { chkerr (); } 537 { chkerr (); }
531 538
532 idx_vector (const Sparse<bool>& nda) : rep (new idx_vector_rep (nda)) 539 idx_vector (const Sparse<bool>& nda) : rep (new idx_vector_rep (nda))
533 { chkerr (); } 540 { chkerr (); }
1011 // If the index is a mask, convert it to index vector. 1018 // If the index is a mask, convert it to index vector.
1012 idx_vector unmask (void) const; 1019 idx_vector unmask (void) const;
1013 1020
1014 // Unconverts the index to a scalar, Range, double array or a mask. 1021 // Unconverts the index to a scalar, Range, double array or a mask.
1015 void unconvert (idx_class_type& iclass, 1022 void unconvert (idx_class_type& iclass,
1016 double& scalar, Range& range, 1023 double& scalar, octave::range<double>& range,
1017 Array<double>& array, Array<bool>& mask) const; 1024 Array<double>& array, Array<bool>& mask) const;
1018 1025
1019 Array<octave_idx_type> as_array (void) const; 1026 Array<octave_idx_type> as_array (void) const;
1020 1027
1021 // Raw pointer to index array. This is non-const because it may be 1028 // Raw pointer to index array. This is non-const because it may be