Mercurial > octave-nkf
annotate src/ov.h @ 9351:e2344f4af0cb
autocache indices returned from find et al.
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Mon, 15 Jun 2009 12:52:53 +0200 |
parents | 67fc970dad7d |
children | d9716e3ee0dd |
rev | line source |
---|---|
2376 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, |
8920 | 4 2006, 2007, 2008, 2009 John W. Eaton |
2376 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2376 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2376 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_value_h) | |
25 #define octave_value_h 1 | |
26 | |
27 #include <cstdlib> | |
28 | |
8950
d865363208d6
include <iosfwd> instead of <iostream> in header files
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
29 #include <iosfwd> |
2376 | 30 #include <string> |
4219 | 31 #include <list> |
2376 | 32 |
33 #include "Range.h" | |
5828 | 34 #include "data-conv.h" |
2376 | 35 #include "idx-vector.h" |
5828 | 36 #include "mach-info.h" |
5900 | 37 #include "mxarray.h" |
2376 | 38 #include "mx-base.h" |
2477 | 39 #include "oct-alloc.h" |
4254 | 40 #include "oct-time.h" |
2942 | 41 #include "str-vec.h" |
42 | |
8676 | 43 #include "oct-hdf5.h" |
7433 | 44 #include "oct-sort.h" |
45 | |
3351 | 46 class Cell; |
2376 | 47 class Octave_map; |
2903 | 48 class octave_stream; |
2974 | 49 class octave_function; |
4700 | 50 class octave_user_function; |
4342 | 51 class octave_fcn_handle; |
4933 | 52 class octave_fcn_inline; |
2376 | 53 class octave_value_list; |
2979 | 54 class octave_lvalue; |
2376 | 55 |
5759 | 56 #include "ov-base.h" |
2376 | 57 |
5759 | 58 // Constants. |
2376 | 59 |
2427 | 60 class octave_value; |
61 | |
2376 | 62 class |
6109 | 63 OCTINTERP_API |
2974 | 64 octave_value |
2376 | 65 { |
66 public: | |
67 | |
3203 | 68 enum unary_op |
69 { | |
6518 | 70 op_not, // not |
71 op_uplus, // uplus | |
72 op_uminus, // uminus | |
73 op_transpose, // transpose | |
74 op_hermitian, // ctranspose | |
3525 | 75 op_incr, |
76 op_decr, | |
3203 | 77 num_unary_ops, |
78 unknown_unary_op | |
79 }; | |
80 | |
2376 | 81 enum binary_op |
82 { | |
6518 | 83 op_add, // plus |
84 op_sub, // minus | |
85 op_mul, // mtimes | |
86 op_div, // mrdivide | |
87 op_pow, // mpower | |
88 op_ldiv, // mldivide | |
3525 | 89 op_lshift, |
90 op_rshift, | |
6518 | 91 op_lt, // lt |
92 op_le, // le | |
93 op_eq, // eq | |
94 op_ge, // ge | |
95 op_gt, // gt | |
96 op_ne, // ne | |
97 op_el_mul, // times | |
98 op_el_div, // rdivide | |
99 op_el_pow, // power | |
100 op_el_ldiv, // ldivide | |
101 op_el_and, // and | |
102 op_el_or, // or | |
3525 | 103 op_struct_ref, |
2376 | 104 num_binary_ops, |
105 unknown_binary_op | |
106 }; | |
107 | |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
108 enum compound_binary_op |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
109 { |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
110 // ** compound operations ** |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
111 op_trans_mul, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
112 op_mul_trans, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
113 op_herm_mul, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
114 op_mul_herm, |
8982
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8960
diff
changeset
|
115 op_el_not_and, |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8960
diff
changeset
|
116 op_el_not_or, |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8960
diff
changeset
|
117 op_el_and_not, |
dc6bda6f9994
implement compound logical ops
Jaroslav Hajek <highegg@gmail.com>
parents:
8960
diff
changeset
|
118 op_el_or_not, |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
119 num_compound_binary_ops, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
120 unknown_compound_binary_op |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
121 }; |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
122 |
2880 | 123 enum assign_op |
124 { | |
3525 | 125 op_asn_eq, |
126 op_add_eq, | |
127 op_sub_eq, | |
128 op_mul_eq, | |
129 op_div_eq, | |
130 op_ldiv_eq, | |
4018 | 131 op_pow_eq, |
3525 | 132 op_lshift_eq, |
133 op_rshift_eq, | |
134 op_el_mul_eq, | |
135 op_el_div_eq, | |
136 op_el_ldiv_eq, | |
4018 | 137 op_el_pow_eq, |
3525 | 138 op_el_and_eq, |
139 op_el_or_eq, | |
2880 | 140 num_assign_ops, |
141 unknown_assign_op | |
142 }; | |
143 | |
3523 | 144 static std::string unary_op_as_string (unary_op); |
7336 | 145 static std::string unary_op_fcn_name (unary_op); |
3203 | 146 |
3523 | 147 static std::string binary_op_as_string (binary_op); |
7336 | 148 static std::string binary_op_fcn_name (binary_op); |
2376 | 149 |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
150 static std::string binary_op_fcn_name (compound_binary_op); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
151 |
3523 | 152 static std::string assign_op_as_string (assign_op); |
2880 | 153 |
3933 | 154 static octave_value empty_conv (const std::string& type, |
155 const octave_value& rhs = octave_value ()); | |
156 | |
2376 | 157 enum magic_colon { magic_colon_t }; |
158 | |
8992
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
159 octave_value (void) |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
160 { |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
161 static octave_base_value nil_rep; |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
162 rep = &nil_rep; |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
163 rep->count++; |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
164 } |
d12f44a5dce3
implement fast octave_value constructor
Jaroslav Hajek <highegg@gmail.com>
parents:
8982
diff
changeset
|
165 |
4254 | 166 octave_value (short int i); |
167 octave_value (unsigned short int i); | |
4233 | 168 octave_value (int i); |
4254 | 169 octave_value (unsigned int i); |
170 octave_value (long int i); | |
171 octave_value (unsigned long int i); | |
4353 | 172 |
5775 | 173 // FIXME -- these are kluges. They turn into doubles |
4353 | 174 // internally, which will break for very large values. We just use |
175 // them to store things like 64-bit ino_t, etc, and hope that those | |
176 // values are never actually larger than can be represented exactly | |
177 // in a double. | |
178 | |
179 #if defined (HAVE_LONG_LONG_INT) | |
180 octave_value (long long int i); | |
181 #endif | |
4356 | 182 #if defined (HAVE_UNSIGNED_LONG_LONG_INT) |
4353 | 183 octave_value (unsigned long long int i); |
184 #endif | |
185 | |
4254 | 186 octave_value (octave_time t); |
2376 | 187 octave_value (double d); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
188 octave_value (float d); |
5147 | 189 octave_value (const ArrayN<octave_value>& a, bool is_cs_list = false); |
4532 | 190 octave_value (const Cell& c, bool is_cs_list = false); |
5785 | 191 octave_value (const Matrix& m, const MatrixType& t = MatrixType()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
192 octave_value (const FloatMatrix& m, const MatrixType& t = MatrixType()); |
4513 | 193 octave_value (const NDArray& nda); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
194 octave_value (const FloatNDArray& nda); |
4911 | 195 octave_value (const ArrayN<double>& m); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
196 octave_value (const ArrayN<float>& m); |
2376 | 197 octave_value (const DiagMatrix& d); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
198 octave_value (const FloatDiagMatrix& d); |
3418 | 199 octave_value (const RowVector& v); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
200 octave_value (const FloatRowVector& v); |
3418 | 201 octave_value (const ColumnVector& v); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
202 octave_value (const FloatColumnVector& v); |
2376 | 203 octave_value (const Complex& C); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
204 octave_value (const FloatComplex& C); |
5785 | 205 octave_value (const ComplexMatrix& m, const MatrixType& t = MatrixType()); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
206 octave_value (const FloatComplexMatrix& m, const MatrixType& t = MatrixType()); |
4513 | 207 octave_value (const ComplexNDArray& cnda); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
208 octave_value (const FloatComplexNDArray& cnda); |
4478 | 209 octave_value (const ArrayN<Complex>& m); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
210 octave_value (const ArrayN<FloatComplex>& m); |
2376 | 211 octave_value (const ComplexDiagMatrix& d); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
212 octave_value (const FloatComplexDiagMatrix& d); |
3418 | 213 octave_value (const ComplexRowVector& v); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
214 octave_value (const FloatComplexRowVector& v); |
3418 | 215 octave_value (const ComplexColumnVector& v); |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
216 octave_value (const FloatComplexColumnVector& v); |
8960
93f18f166aba
remove float perm matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8950
diff
changeset
|
217 octave_value (const PermMatrix& p); |
2825 | 218 octave_value (bool b); |
5785 | 219 octave_value (const boolMatrix& bm, const MatrixType& t = MatrixType()); |
4513 | 220 octave_value (const boolNDArray& bnda); |
7433 | 221 octave_value (const ArrayN<bool>& bnda); |
5279 | 222 octave_value (char c, char type = '"'); |
223 octave_value (const char *s, char type = '"'); | |
224 octave_value (const std::string& s, char type = '"'); | |
225 octave_value (const string_vector& s, char type = '"'); | |
226 octave_value (const charMatrix& chm, bool is_string = false, | |
227 char type = '"'); | |
228 octave_value (const charNDArray& chnda, bool is_string = false, | |
229 char type = '"'); | |
230 octave_value (const ArrayN<char>& chnda, bool is_string = false, | |
231 char type = '"'); | |
5785 | 232 octave_value (const SparseMatrix& m, const MatrixType& t = MatrixType ()); |
6863 | 233 octave_value (const Sparse<double>& m, const MatrixType& t = MatrixType ()); |
5164 | 234 octave_value (const SparseComplexMatrix& m, |
5785 | 235 const MatrixType& t = MatrixType ()); |
6863 | 236 octave_value (const Sparse<Complex>& m, const MatrixType& t = MatrixType ()); |
5164 | 237 octave_value (const SparseBoolMatrix& bm, |
5785 | 238 const MatrixType& t = MatrixType ()); |
7433 | 239 octave_value (const Sparse<bool>& m, const MatrixType& t = MatrixType ()); |
4901 | 240 octave_value (const octave_int8& i); |
4910 | 241 octave_value (const octave_int16& i); |
242 octave_value (const octave_int32& i); | |
243 octave_value (const octave_int64& i); | |
4901 | 244 octave_value (const octave_uint8& i); |
245 octave_value (const octave_uint16& i); | |
246 octave_value (const octave_uint32& i); | |
247 octave_value (const octave_uint64& i); | |
248 octave_value (const int8NDArray& inda); | |
7064 | 249 octave_value (const ArrayN<octave_int8>& inda); |
4910 | 250 octave_value (const int16NDArray& inda); |
7064 | 251 octave_value (const ArrayN<octave_int16>& inda); |
4910 | 252 octave_value (const int32NDArray& inda); |
7064 | 253 octave_value (const ArrayN<octave_int32>& inda); |
4910 | 254 octave_value (const int64NDArray& inda); |
7064 | 255 octave_value (const ArrayN<octave_int64>& inda); |
4901 | 256 octave_value (const uint8NDArray& inda); |
7064 | 257 octave_value (const ArrayN<octave_uint8>& inda); |
4901 | 258 octave_value (const uint16NDArray& inda); |
7064 | 259 octave_value (const ArrayN<octave_uint16>& inda); |
4901 | 260 octave_value (const uint32NDArray& inda); |
7064 | 261 octave_value (const ArrayN<octave_uint32>& inda); |
4901 | 262 octave_value (const uint64NDArray& inda); |
7064 | 263 octave_value (const ArrayN<octave_uint64>& inda); |
9351
e2344f4af0cb
autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents:
9329
diff
changeset
|
264 octave_value (const Array<octave_idx_type>& inda, |
e2344f4af0cb
autocache indices returned from find et al.
Jaroslav Hajek <highegg@gmail.com>
parents:
9329
diff
changeset
|
265 bool zero_based = false, bool cache_index = false); |
2376 | 266 octave_value (double base, double limit, double inc); |
267 octave_value (const Range& r); | |
268 octave_value (const Octave_map& m); | |
7336 | 269 octave_value (const Octave_map& m, const std::string& id); |
3977 | 270 octave_value (const octave_value_list& m, bool is_cs_list = false); |
2376 | 271 octave_value (octave_value::magic_colon); |
272 | |
5759 | 273 octave_value (octave_base_value *new_rep); |
7336 | 274 octave_value (octave_base_value *new_rep, int xcount); |
2376 | 275 |
276 // Copy constructor. | |
277 | |
278 octave_value (const octave_value& a) | |
279 { | |
280 rep = a.rep; | |
281 rep->count++; | |
282 } | |
283 | |
3933 | 284 // This should only be called for derived types. |
285 | |
5759 | 286 octave_base_value *clone (void) const; |
3933 | 287 |
5759 | 288 octave_base_value *empty_clone (void) const |
3933 | 289 { return rep->empty_clone (); } |
290 | |
2376 | 291 // Delete the representation of this constant if the count drops to |
292 // zero. | |
293 | |
6338 | 294 ~octave_value (void) |
295 { | |
296 if (--rep->count == 0) | |
297 delete rep; | |
298 } | |
2376 | 299 |
300 void make_unique (void) | |
301 { | |
302 if (rep->count > 1) | |
303 { | |
304 --rep->count; | |
305 rep = rep->clone (); | |
306 rep->count = 1; | |
307 } | |
308 } | |
309 | |
8546
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
310 // This uniquifies the value if it is referenced by more than a certain |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
311 // number of shallow copies. This is useful for optimizations where we |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
312 // know a certain copy, typically within a cell array, to be obsolete. |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
313 void make_unique (int obsolete_copies) |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
314 { |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
315 if (rep->count > obsolete_copies + 1) |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
316 { |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
317 --rep->count; |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
318 rep = rep->clone (); |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
319 rep->count = 1; |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
320 } |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
321 } |
3d8a914c580e
improve parser indexed assigment code
Jaroslav Hajek <highegg@gmail.com>
parents:
8531
diff
changeset
|
322 |
2376 | 323 // Simple assignment. |
324 | |
325 octave_value& operator = (const octave_value& a) | |
326 { | |
327 if (rep != a.rep) | |
328 { | |
329 if (--rep->count == 0) | |
330 delete rep; | |
331 | |
332 rep = a.rep; | |
333 rep->count++; | |
334 } | |
335 | |
336 return *this; | |
337 } | |
338 | |
3933 | 339 int get_count (void) const { return rep->count; } |
3239 | 340 |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
341 octave_base_value::type_conv_info numeric_conversion_function (void) const |
2376 | 342 { return rep->numeric_conversion_function (); } |
343 | |
8345
c777f3ce02d8
smarter conversion lookup
Jaroslav Hajek <highegg@gmail.com>
parents:
8150
diff
changeset
|
344 octave_base_value::type_conv_info numeric_demotion_function (void) const |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
345 { return rep->numeric_demotion_function (); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
346 |
2409 | 347 void maybe_mutate (void); |
348 | |
5759 | 349 octave_value squeeze (void) const |
4532 | 350 { return rep->squeeze (); } |
351 | |
8458
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8456
diff
changeset
|
352 // The result of full(). |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8456
diff
changeset
|
353 octave_value full_value (void) const |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8456
diff
changeset
|
354 { return rep->full_value (); } |
d254a21e0120
reimplement full as method of octave_base_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8456
diff
changeset
|
355 |
5759 | 356 octave_base_value *try_narrowing_conversion (void) |
2410 | 357 { return rep->try_narrowing_conversion (); } |
2409 | 358 |
9329
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
359 // Close to dims (), but can be overloaded for classes. |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
360 Matrix size (void) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
361 { return rep->size (); } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
362 |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
363 octave_idx_type numel (const octave_value_list& idx) |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
364 { return rep->numel (idx); } |
67fc970dad7d
improve indexed assignment using indexed numel
Jaroslav Hajek <highegg@gmail.com>
parents:
9151
diff
changeset
|
365 |
4271 | 366 octave_value single_subsref (const std::string& type, |
367 const octave_value_list& idx); | |
368 | |
5759 | 369 octave_value subsref (const std::string& type, |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
370 const std::list<octave_value_list>& idx) |
3933 | 371 { return rep->subsref (type, idx); } |
372 | |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
373 octave_value subsref (const std::string& type, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
374 const std::list<octave_value_list>& idx, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
375 bool auto_add) |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
376 { return rep->subsref (type, idx, auto_add); } |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
377 |
5759 | 378 octave_value_list subsref (const std::string& type, |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
379 const std::list<octave_value_list>& idx, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
380 int nargout); |
3933 | 381 |
4247 | 382 octave_value next_subsref (const std::string& type, const |
4219 | 383 std::list<octave_value_list>& idx, |
4233 | 384 size_t skip = 1); |
3933 | 385 |
4994 | 386 octave_value_list next_subsref (int nargout, |
387 const std::string& type, const | |
388 std::list<octave_value_list>& idx, | |
389 size_t skip = 1); | |
390 | |
8551
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
391 octave_value next_subsref (bool auto_add, const std::string& type, const |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
392 std::list<octave_value_list>& idx, |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
393 size_t skip = 1); |
906f976d35a8
further improve struct&cell indexing & indexed assignment
Jaroslav Hajek <highegg@gmail.com>
parents:
8546
diff
changeset
|
394 |
5759 | 395 octave_value do_index_op (const octave_value_list& idx, |
5885 | 396 bool resize_ok = false) |
3933 | 397 { return rep->do_index_op (idx, resize_ok); } |
398 | |
5759 | 399 octave_value_list |
3544 | 400 do_multi_index_op (int nargout, const octave_value_list& idx); |
2974 | 401 |
5759 | 402 octave_value subsasgn (const std::string& type, |
4219 | 403 const std::list<octave_value_list>& idx, |
3933 | 404 const octave_value& rhs); |
2376 | 405 |
4247 | 406 octave_value assign (assign_op op, const std::string& type, |
4219 | 407 const std::list<octave_value_list>& idx, |
3933 | 408 const octave_value& rhs); |
2948 | 409 |
3933 | 410 const octave_value& assign (assign_op, const octave_value& rhs); |
2948 | 411 |
5759 | 412 idx_vector index_vector (void) const |
2376 | 413 { return rep->index_vector (); } |
414 | |
415 // Size. | |
416 | |
5759 | 417 dim_vector dims (void) const |
4513 | 418 { return rep->dims (); } |
419 | |
5759 | 420 octave_idx_type rows (void) const { return rep->rows (); } |
4563 | 421 |
5759 | 422 octave_idx_type columns (void) const { return rep->columns (); } |
3195 | 423 |
5275 | 424 octave_idx_type length (void) const; |
4554 | 425 |
5759 | 426 int ndims (void) const { return rep->ndims (); } |
4563 | 427 |
5164 | 428 bool all_zero_dims (void) const { return dims().all_zero (); } |
429 | |
5759 | 430 octave_idx_type numel (void) const |
5080 | 431 { return rep->numel (); } |
4559 | 432 |
5759 | 433 octave_idx_type capacity (void) const |
5164 | 434 { return rep->capacity (); } |
435 | |
5759 | 436 size_t byte_size (void) const |
4791 | 437 { return rep->byte_size (); } |
438 | |
5759 | 439 octave_idx_type nnz (void) const { return rep->nnz (); } |
5602 | 440 |
5759 | 441 octave_idx_type nzmax (void) const { return rep->nzmax (); } |
5604 | 442 |
5900 | 443 octave_idx_type nfields (void) const { return rep->nfields (); } |
444 | |
5759 | 445 octave_value reshape (const dim_vector& dv) const |
4587 | 446 { return rep->reshape (dv); } |
4567 | 447 |
5759 | 448 octave_value permute (const Array<int>& vec, bool inv = false) const |
4593 | 449 { return rep->permute (vec, inv); } |
450 | |
451 octave_value ipermute (const Array<int>& vec) const | |
452 { return rep->permute (vec, true); } | |
453 | |
5759 | 454 octave_value resize (const dim_vector& dv, bool fill = false) const |
455 { return rep->resize (dv, fill);} | |
4915 | 456 |
5785 | 457 MatrixType matrix_type (void) const |
458 { return rep->matrix_type (); } | |
459 | |
460 MatrixType matrix_type (const MatrixType& typ) const | |
461 { return rep->matrix_type (typ); } | |
462 | |
2376 | 463 // Does this constant have a type? Both of these are provided since |
464 // it is sometimes more natural to write is_undefined() instead of | |
465 // ! is_defined(). | |
466 | |
5759 | 467 bool is_defined (void) const |
2376 | 468 { return rep->is_defined (); } |
469 | |
470 bool is_undefined (void) const | |
471 { return ! is_defined (); } | |
472 | |
4559 | 473 bool is_empty (void) const |
5759 | 474 { return rep->is_empty (); } |
4559 | 475 |
5759 | 476 bool is_cell (void) const |
3351 | 477 { return rep->is_cell (); } |
478 | |
6116 | 479 bool is_cellstr (void) const |
480 { return rep->is_cellstr (); } | |
481 | |
5759 | 482 bool is_real_scalar (void) const |
2376 | 483 { return rep->is_real_scalar (); } |
484 | |
5759 | 485 bool is_real_matrix (void) const |
2376 | 486 { return rep->is_real_matrix (); } |
487 | |
5759 | 488 bool is_real_nd_array (void) const |
4505 | 489 { return rep->is_real_nd_array (); } |
490 | |
5759 | 491 bool is_complex_scalar (void) const |
2376 | 492 { return rep->is_complex_scalar (); } |
493 | |
5759 | 494 bool is_complex_matrix (void) const |
2376 | 495 { return rep->is_complex_matrix (); } |
496 | |
5881 | 497 bool is_bool_scalar (void) const |
498 { return rep->is_bool_scalar (); } | |
499 | |
5759 | 500 bool is_bool_matrix (void) const |
4587 | 501 { return rep->is_bool_matrix (); } |
502 | |
5759 | 503 bool is_char_matrix (void) const |
2376 | 504 { return rep->is_char_matrix (); } |
505 | |
8366
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8346
diff
changeset
|
506 bool is_diag_matrix (void) const |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8346
diff
changeset
|
507 { return rep->is_diag_matrix (); } |
8b1a2555c4e2
implement diagonal matrix objects
Jaroslav Hajek <highegg@gmail.com>
parents:
8346
diff
changeset
|
508 |
8371
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
509 bool is_perm_matrix (void) const |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
510 { return rep->is_perm_matrix (); } |
c3f7e2549abb
make det & inv aware of diagonal & permutation matrices
Jaroslav Hajek <highegg@gmail.com>
parents:
8367
diff
changeset
|
511 |
5759 | 512 bool is_string (void) const |
2376 | 513 { return rep->is_string (); } |
514 | |
5759 | 515 bool is_sq_string (void) const |
5279 | 516 { return rep->is_sq_string (); } |
517 | |
5280 | 518 bool is_dq_string (void) const |
519 { return rep->is_string () && ! rep->is_sq_string (); } | |
520 | |
5759 | 521 bool is_range (void) const |
2376 | 522 { return rep->is_range (); } |
523 | |
5759 | 524 bool is_map (void) const |
2376 | 525 { return rep->is_map (); } |
526 | |
7336 | 527 bool is_object (void) const |
528 { return rep->is_object (); } | |
529 | |
5759 | 530 bool is_cs_list (void) const |
3977 | 531 { return rep->is_cs_list (); } |
532 | |
5759 | 533 bool is_list (void) const |
2880 | 534 { return rep->is_list (); } |
535 | |
5759 | 536 bool is_magic_colon (void) const |
2376 | 537 { return rep->is_magic_colon (); } |
538 | |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
539 bool is_null_value (void) const |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
540 { return rep->is_null_value (); } |
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
541 |
2376 | 542 // Are any or all of the elements in this constant nonzero? |
543 | |
5759 | 544 octave_value all (int dim = 0) const |
4015 | 545 { return rep->all (dim); } |
2376 | 546 |
5759 | 547 octave_value any (int dim = 0) const |
4015 | 548 { return rep->any (dim); } |
2376 | 549 |
5895 | 550 // Floating point types. |
551 | |
552 bool is_double_type (void) const | |
553 { return rep->is_double_type (); } | |
554 | |
555 bool is_single_type (void) const | |
556 { return rep->is_single_type (); } | |
557 | |
7576 | 558 bool is_float_type (void) const |
559 { return rep->is_float_type (); } | |
560 | |
5895 | 561 // Integer types. |
562 | |
563 bool is_int8_type (void) const | |
564 { return rep->is_int8_type (); } | |
565 | |
566 bool is_int16_type (void) const | |
567 { return rep->is_int16_type (); } | |
568 | |
569 bool is_int32_type (void) const | |
570 { return rep->is_int32_type (); } | |
571 | |
572 bool is_int64_type (void) const | |
573 { return rep->is_int64_type (); } | |
574 | |
575 bool is_uint8_type (void) const | |
576 { return rep->is_uint8_type (); } | |
577 | |
578 bool is_uint16_type (void) const | |
579 { return rep->is_uint16_type (); } | |
580 | |
581 bool is_uint32_type (void) const | |
582 { return rep->is_uint32_type (); } | |
583 | |
584 bool is_uint64_type (void) const | |
585 { return rep->is_uint64_type (); } | |
586 | |
2376 | 587 // Other type stuff. |
588 | |
5759 | 589 bool is_bool_type (void) const |
3209 | 590 { return rep->is_bool_type (); } |
591 | |
6223 | 592 bool is_integer_type (void) const |
593 { return rep->is_integer_type (); } | |
594 | |
5759 | 595 bool is_real_type (void) const |
2376 | 596 { return rep->is_real_type (); } |
597 | |
5759 | 598 bool is_complex_type (void) const |
2376 | 599 { return rep->is_complex_type (); } |
600 | |
5759 | 601 bool is_scalar_type (void) const |
2376 | 602 { return rep->is_scalar_type (); } |
603 | |
5759 | 604 bool is_matrix_type (void) const |
2376 | 605 { return rep->is_matrix_type (); } |
606 | |
5759 | 607 bool is_numeric_type (void) const |
2376 | 608 { return rep->is_numeric_type (); } |
609 | |
5759 | 610 bool is_sparse_type (void) const |
5631 | 611 { return rep->is_sparse_type (); } |
612 | |
2376 | 613 // Does this constant correspond to a truth value? |
614 | |
5759 | 615 bool is_true (void) const |
2376 | 616 { return rep->is_true (); } |
617 | |
8346
8302788f09db
fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
618 // Do two constants match (in a switch statement)? |
8302788f09db
fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
619 |
8302788f09db
fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
620 bool is_equal (const octave_value&) const; |
8302788f09db
fix empty matrix handling in switch statement
Jaroslav Hajek <highegg@gmail.com>
parents:
8345
diff
changeset
|
621 |
2376 | 622 // Are the dimensions of this constant zero by zero? |
623 | |
5759 | 624 bool is_zero_by_zero (void) const |
625 { return (rows () == 0 && columns () == 0); } | |
2376 | 626 |
5759 | 627 bool is_constant (void) const |
2974 | 628 { return rep->is_constant (); } |
629 | |
5759 | 630 bool is_function_handle (void) const |
4654 | 631 { return rep->is_function_handle (); } |
632 | |
5759 | 633 bool is_inline_function (void) const |
4954 | 634 { return rep->is_inline_function (); } |
635 | |
5759 | 636 bool is_function (void) const |
2974 | 637 { return rep->is_function (); } |
2891 | 638 |
7336 | 639 bool is_user_script (void) const |
640 { return rep->is_user_script (); } | |
641 | |
642 bool is_user_function (void) const | |
643 { return rep->is_user_function (); } | |
644 | |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
645 bool is_user_code (void) const |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
646 { return rep->is_user_code (); } |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
647 |
5759 | 648 bool is_builtin_function (void) const |
3325 | 649 { return rep->is_builtin_function (); } |
650 | |
5759 | 651 bool is_dld_function (void) const |
3325 | 652 { return rep->is_dld_function (); } |
653 | |
5864 | 654 bool is_mex_function (void) const |
655 { return rep->is_mex_function (); } | |
656 | |
7876
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7800
diff
changeset
|
657 void erase_subfunctions (void) { rep->erase_subfunctions (); } |
8447a5024650
clear subfunctions when clearing parent function
John W. Eaton <jwe@octave.org>
parents:
7800
diff
changeset
|
658 |
2376 | 659 // Values. |
660 | |
2891 | 661 octave_value eval (void) { return *this; } |
662 | |
5759 | 663 short int |
4254 | 664 short_value (bool req_int = false, bool frc_str_conv = false) const |
665 { return rep->short_value (req_int, frc_str_conv); } | |
666 | |
5759 | 667 unsigned short int |
4254 | 668 ushort_value (bool req_int = false, bool frc_str_conv = false) const |
669 { return rep->ushort_value (req_int, frc_str_conv); } | |
670 | |
5759 | 671 int int_value (bool req_int = false, bool frc_str_conv = false) const |
3202 | 672 { return rep->int_value (req_int, frc_str_conv); } |
673 | |
5759 | 674 unsigned int |
4254 | 675 uint_value (bool req_int = false, bool frc_str_conv = false) const |
676 { return rep->uint_value (req_int, frc_str_conv); } | |
677 | |
5759 | 678 int nint_value (bool frc_str_conv = false) const |
3202 | 679 { return rep->nint_value (frc_str_conv); } |
680 | |
5759 | 681 long int |
4254 | 682 long_value (bool req_int = false, bool frc_str_conv = false) const |
683 { return rep->long_value (req_int, frc_str_conv); } | |
684 | |
5759 | 685 unsigned long int |
4254 | 686 ulong_value (bool req_int = false, bool frc_str_conv = false) const |
687 { return rep->ulong_value (req_int, frc_str_conv); } | |
688 | |
6133 | 689 octave_idx_type |
8017
260294a5520f
octave_value::idx_type_value: move definition to ov.cc from ov.h
John W. Eaton <jwe@octave.org>
parents:
7885
diff
changeset
|
690 idx_type_value (bool req_int = false, bool frc_str_conv = false) const; |
6133 | 691 |
5759 | 692 double double_value (bool frc_str_conv = false) const |
2376 | 693 { return rep->double_value (frc_str_conv); } |
694 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
695 float float_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
696 { return rep->float_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
697 |
5759 | 698 double scalar_value (bool frc_str_conv = false) const |
2916 | 699 { return rep->scalar_value (frc_str_conv); } |
700 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
701 float float_scalar_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
702 { return rep->float_scalar_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
703 |
5759 | 704 Cell cell_value (void) const; |
3351 | 705 |
5759 | 706 Matrix matrix_value (bool frc_str_conv = false) const |
2376 | 707 { return rep->matrix_value (frc_str_conv); } |
708 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
709 FloatMatrix float_matrix_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
710 { return rep->float_matrix_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
711 |
5759 | 712 NDArray array_value (bool frc_str_conv = false) const |
4550 | 713 { return rep->array_value (frc_str_conv); } |
4505 | 714 |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
715 FloatNDArray float_array_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
716 { return rep->float_array_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
717 |
5759 | 718 Complex complex_value (bool frc_str_conv = false) const |
2376 | 719 { return rep->complex_value (frc_str_conv); } |
720 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
721 FloatComplex float_complex_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
722 { return rep->float_complex_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
723 |
5759 | 724 ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const |
2376 | 725 { return rep->complex_matrix_value (frc_str_conv); } |
726 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
727 FloatComplexMatrix float_complex_matrix_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
728 { return rep->float_complex_matrix_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
729 |
5759 | 730 ComplexNDArray complex_array_value (bool frc_str_conv = false) const |
4550 | 731 { return rep->complex_array_value (frc_str_conv); } |
732 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
733 FloatComplexNDArray float_complex_array_value (bool frc_str_conv = false) const |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
734 { return rep->float_complex_array_value (frc_str_conv); } |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
735 |
5943 | 736 bool bool_value (bool warn = false) const |
737 { return rep->bool_value (warn); } | |
4550 | 738 |
5943 | 739 boolMatrix bool_matrix_value (bool warn = false) const |
740 { return rep->bool_matrix_value (warn); } | |
4550 | 741 |
5943 | 742 boolNDArray bool_array_value (bool warn = false) const |
743 { return rep->bool_array_value (warn); } | |
4550 | 744 |
5759 | 745 charMatrix char_matrix_value (bool frc_str_conv = false) const |
2376 | 746 { return rep->char_matrix_value (frc_str_conv); } |
747 | |
5759 | 748 charNDArray char_array_value (bool frc_str_conv = false) const |
4550 | 749 { return rep->char_array_value (frc_str_conv); } |
750 | |
5759 | 751 SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const |
752 { return rep->sparse_matrix_value (frc_str_conv); } | |
5164 | 753 |
5759 | 754 SparseComplexMatrix sparse_complex_matrix_value (bool frc_str_conv = false) const |
755 { return rep->sparse_complex_matrix_value (frc_str_conv); } | |
5164 | 756 |
5759 | 757 SparseBoolMatrix sparse_bool_matrix_value (bool frc_str_conv = false) const |
758 { return rep->sparse_bool_matrix_value (frc_str_conv); } | |
5164 | 759 |
8916
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
760 DiagMatrix diag_matrix_value (bool force = false) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
761 { return rep->diag_matrix_value (force); } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
762 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
763 FloatDiagMatrix float_diag_matrix_value (bool force = false) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
764 { return rep->float_diag_matrix_value (force); } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
765 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
766 ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
767 { return rep->complex_diag_matrix_value (force); } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
768 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
769 FloatComplexDiagMatrix float_complex_diag_matrix_value (bool force = false) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
770 { return rep->float_complex_diag_matrix_value (force); } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
771 |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
772 PermMatrix perm_matrix_value (void) const |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
773 { return rep->perm_matrix_value (); } |
a2878ba31a9e
add diag & perm matrix query methods to octave_value
Jaroslav Hajek <highegg@gmail.com>
parents:
8811
diff
changeset
|
774 |
5759 | 775 octave_int8 int8_scalar_value (void) const |
4910 | 776 { return rep->int8_scalar_value (); } |
777 | |
5759 | 778 octave_int16 int16_scalar_value (void) const |
4910 | 779 { return rep->int16_scalar_value (); } |
780 | |
5759 | 781 octave_int32 int32_scalar_value (void) const |
4910 | 782 { return rep->int32_scalar_value (); } |
783 | |
5759 | 784 octave_int64 int64_scalar_value (void) const |
4910 | 785 { return rep->int64_scalar_value (); } |
786 | |
5759 | 787 octave_uint8 uint8_scalar_value (void) const |
4910 | 788 { return rep->uint8_scalar_value (); } |
789 | |
5759 | 790 octave_uint16 uint16_scalar_value (void) const |
4910 | 791 { return rep->uint16_scalar_value (); } |
792 | |
5759 | 793 octave_uint32 uint32_scalar_value (void) const |
4910 | 794 { return rep->uint32_scalar_value (); } |
795 | |
5759 | 796 octave_uint64 uint64_scalar_value (void) const |
4910 | 797 { return rep->uint64_scalar_value (); } |
798 | |
5759 | 799 int8NDArray int8_array_value (void) const |
4906 | 800 { return rep->int8_array_value (); } |
801 | |
5759 | 802 int16NDArray int16_array_value (void) const |
4906 | 803 { return rep->int16_array_value (); } |
804 | |
5759 | 805 int32NDArray int32_array_value (void) const |
4906 | 806 { return rep->int32_array_value (); } |
807 | |
5759 | 808 int64NDArray int64_array_value (void) const |
4906 | 809 { return rep->int64_array_value (); } |
810 | |
5759 | 811 uint8NDArray uint8_array_value (void) const |
4906 | 812 { return rep->uint8_array_value (); } |
813 | |
5759 | 814 uint16NDArray uint16_array_value (void) const |
4906 | 815 { return rep->uint16_array_value (); } |
816 | |
5759 | 817 uint32NDArray uint32_array_value (void) const |
4906 | 818 { return rep->uint32_array_value (); } |
819 | |
5759 | 820 uint64NDArray uint64_array_value (void) const |
4906 | 821 { return rep->uint64_array_value (); } |
822 | |
5759 | 823 string_vector all_strings (bool pad = false) const |
5715 | 824 { return rep->all_strings (pad); } |
2376 | 825 |
5759 | 826 std::string string_value (bool force = false) const |
4665 | 827 { return rep->string_value (force); } |
2376 | 828 |
8732 | 829 Array<std::string> cellstr_value (void) const |
830 { return rep->cellstr_value (); } | |
831 | |
5759 | 832 Range range_value (void) const |
2376 | 833 { return rep->range_value (); } |
834 | |
5759 | 835 Octave_map map_value (void) const; |
2376 | 836 |
5759 | 837 string_vector map_keys (void) const |
3933 | 838 { return rep->map_keys (); } |
839 | |
9151 | 840 size_t nparents (void) const |
841 { return rep->nparents (); } | |
842 | |
843 std::list<std::string> parent_class_name_list (void) const | |
844 { return rep->parent_class_name_list (); } | |
845 | |
9010
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
846 string_vector parent_class_names (void) const |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
847 { return rep->parent_class_names (); } |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
848 |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
849 octave_base_value * |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
850 find_parent_class (const std::string& parent_class_name) |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
851 { return rep->find_parent_class (parent_class_name); } |
f914834836e7
Partial implementation of derived classes using the old form with "@" files.
rtshort@smoketree.phaselocked.com
parents:
8992
diff
changeset
|
852 |
5759 | 853 octave_function *function_value (bool silent = false); |
2974 | 854 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
855 const octave_function *function_value (bool silent = false) const; |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
856 |
5759 | 857 octave_user_function *user_function_value (bool silent = false); |
4700 | 858 |
7719
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
859 octave_user_script *user_script_value (bool silent = false); |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
860 |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
861 octave_user_code *user_code_value (bool silent = false); |
87eda1f8faaa
octave_user_code: new base class for octave_user_script and octave_user_function
John W. Eaton <jwe@octave.org>
parents:
7638
diff
changeset
|
862 |
5759 | 863 octave_fcn_handle *fcn_handle_value (bool silent = false); |
4343 | 864 |
5759 | 865 octave_fcn_inline *fcn_inline_value (bool silent = false); |
4933 | 866 |
5759 | 867 octave_value_list list_value (void) const; |
2880 | 868 |
3419 | 869 ColumnVector column_vector_value (bool frc_str_conv = false, |
2376 | 870 bool frc_vec_conv = false) const; |
871 | |
872 ComplexColumnVector | |
3419 | 873 complex_column_vector_value (bool frc_str_conv = false, |
2376 | 874 bool frc_vec_conv = false) const; |
875 | |
3419 | 876 RowVector row_vector_value (bool frc_str_conv = false, |
877 bool frc_vec_conv = false) const; | |
878 | |
879 ComplexRowVector | |
880 complex_row_vector_value (bool frc_str_conv = false, | |
881 bool frc_vec_conv = false) const; | |
882 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
883 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
884 FloatColumnVector float_column_vector_value (bool frc_str_conv = false, |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
885 bool frc_vec_conv = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
886 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
887 FloatComplexColumnVector |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
888 float_complex_column_vector_value (bool frc_str_conv = false, |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
889 bool frc_vec_conv = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
890 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
891 FloatRowVector float_row_vector_value (bool frc_str_conv = false, |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
892 bool frc_vec_conv = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
893 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
894 FloatComplexRowVector |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
895 float_complex_row_vector_value (bool frc_str_conv = false, |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
896 bool frc_vec_conv = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
897 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
898 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
899 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
900 |
4044 | 901 Array<int> int_vector_value (bool req_int = false, |
902 bool frc_str_conv = false, | |
903 bool frc_vec_conv = false) const; | |
904 | |
8811 | 905 Array<octave_idx_type> |
906 octave_idx_type_vector_value (bool req_int = false, | |
907 bool frc_str_conv = false, | |
908 bool frc_vec_conv = false) const; | |
909 | |
3419 | 910 Array<double> vector_value (bool frc_str_conv = false, |
911 bool frc_vec_conv = false) const; | |
912 | |
913 Array<Complex> complex_vector_value (bool frc_str_conv = false, | |
914 bool frc_vec_conv = false) const; | |
915 | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
916 Array<float> float_vector_value (bool frc_str_conv = false, |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
917 bool frc_vec_conv = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
918 |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
919 Array<FloatComplex> float_complex_vector_value (bool frc_str_conv = false, |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
920 bool frc_vec_conv = false) const; |
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
921 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
922 // Possibly economize a lazy-indexed value. |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
923 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
924 void maybe_economize (void) |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
925 { rep->maybe_economize (); } |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
926 |
8531
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
927 // The following two hook conversions are called on any octave_value prior to |
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
928 // storing it to a "permanent" location, like a named variable, a cell or a |
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
929 // struct component, or a return value of a function. |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
930 |
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
931 octave_value storable_value (void) const; |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
932 |
8531
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
933 // Ditto, but in place, i.e. equivalent to *this = this->storable_value (), |
b01fef323c24
add some explaining comments
Jaroslav Hajek <highegg@gmail.com>
parents:
8523
diff
changeset
|
934 // but possibly more efficient. |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
935 |
8523
ad3afaaa19c1
implement non-copying contiguous range indexing
Jaroslav Hajek <highegg@gmail.com>
parents:
8458
diff
changeset
|
936 void make_storable_value (void); |
8150
283989f2da9b
make null assignment matlab compatible
Jaroslav Hajek <highegg@gmail.com>
parents:
8017
diff
changeset
|
937 |
2376 | 938 // Conversions. These should probably be private. If a user of this |
939 // class wants a certain kind of constant, he should simply ask for | |
940 // it, and we should convert it if possible. | |
941 | |
5279 | 942 octave_value convert_to_str (bool pad = false, bool force = false, |
5759 | 943 char type = '"') const |
944 { return rep->convert_to_str (pad, force, type); } | |
4452 | 945 |
5759 | 946 octave_value |
5279 | 947 convert_to_str_internal (bool pad, bool force, char type) const |
948 { return rep->convert_to_str_internal (pad, force, type); } | |
2376 | 949 |
5759 | 950 void convert_to_row_or_column_vector (void) |
2376 | 951 { rep->convert_to_row_or_column_vector (); } |
952 | |
5759 | 953 bool print_as_scalar (void) const |
4604 | 954 { return rep->print_as_scalar (); } |
955 | |
5759 | 956 void print (std::ostream& os, bool pr_as_read_syntax = false) const |
2466 | 957 { rep->print (os, pr_as_read_syntax); } |
2376 | 958 |
5759 | 959 void print_raw (std::ostream& os, |
4457 | 960 bool pr_as_read_syntax = false) const |
2903 | 961 { rep->print_raw (os, pr_as_read_syntax); } |
962 | |
5759 | 963 bool print_name_tag (std::ostream& os, const std::string& name) const |
2903 | 964 { return rep->print_name_tag (os, name); } |
2376 | 965 |
3523 | 966 void print_with_name (std::ostream& os, const std::string& name, |
5759 | 967 bool print_padding = true) const |
968 { rep->print_with_name (os, name, print_padding); } | |
2376 | 969 |
5759 | 970 int type_id (void) const { return rep->type_id (); } |
2376 | 971 |
5759 | 972 std::string type_name (void) const { return rep->type_name (); } |
973 | |
974 std::string class_name (void) const { return rep->class_name (); } | |
4612 | 975 |
3203 | 976 // Unary and binary operations. |
977 | |
6109 | 978 friend OCTINTERP_API octave_value do_unary_op (unary_op op, |
3933 | 979 const octave_value& a); |
3203 | 980 |
3933 | 981 const octave_value& do_non_const_unary_op (unary_op op); |
982 | |
983 void do_non_const_unary_op (unary_op op, const octave_value_list& idx); | |
2376 | 984 |
4247 | 985 octave_value do_non_const_unary_op (unary_op op, const std::string& type, |
4219 | 986 const std::list<octave_value_list>& idx); |
3205 | 987 |
6109 | 988 friend OCTINTERP_API octave_value do_binary_op (binary_op op, |
3933 | 989 const octave_value& a, |
990 const octave_value& b); | |
2376 | 991 |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
992 friend OCTINTERP_API octave_value do_binary_op (compound_binary_op op, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
993 const octave_value& a, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
994 const octave_value& b); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
995 |
6109 | 996 friend OCTINTERP_API octave_value do_cat_op (const octave_value& a, |
4915 | 997 const octave_value& b, |
6867 | 998 const Array<octave_idx_type>& ra_idx); |
4915 | 999 |
5759 | 1000 const octave_base_value& get_rep (void) const { return *rep; } |
3301 | 1001 |
8456
c1709a45b45b
optimize structure components access
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
1002 bool is_copy_of (const octave_value &val) const { return rep == val.rep; } |
c1709a45b45b
optimize structure components access
Jaroslav Hajek <highegg@gmail.com>
parents:
8437
diff
changeset
|
1003 |
5759 | 1004 void print_info (std::ostream& os, |
3933 | 1005 const std::string& prefix = std::string ()) const; |
1006 | |
6974 | 1007 bool save_ascii (std::ostream& os) { return rep->save_ascii (os); } |
4687 | 1008 |
6974 | 1009 bool load_ascii (std::istream& is) { return rep->load_ascii (is); } |
4687 | 1010 |
5759 | 1011 bool save_binary (std::ostream& os, bool& save_as_floats) |
4687 | 1012 { return rep->save_binary (os, save_as_floats); } |
1013 | |
5759 | 1014 bool load_binary (std::istream& is, bool swap, |
4687 | 1015 oct_mach_info::float_format fmt) |
1016 { return rep->load_binary (is, swap, fmt); } | |
1017 | |
1018 #if defined (HAVE_HDF5) | |
5759 | 1019 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats) |
4687 | 1020 { return rep->save_hdf5 (loc_id, name, save_as_floats); } |
1021 | |
5759 | 1022 bool load_hdf5 (hid_t loc_id, const char *name, |
4687 | 1023 bool have_h5giterate_bug) |
1024 { return rep->load_hdf5 (loc_id, name, have_h5giterate_bug); } | |
1025 #endif | |
1026 | |
5759 | 1027 int write (octave_stream& os, int block_size, |
4944 | 1028 oct_data_conv::data_type output_type, int skip, |
1029 oct_mach_info::float_format flt_fmt) const; | |
1030 | |
5759 | 1031 octave_base_value *internal_rep (void) const { return rep; } |
4901 | 1032 |
5900 | 1033 // Unsafe. These functions exist to support the MEX interface. |
1034 // You should not use them anywhere else. | |
1035 void *mex_get_data (void) const { return rep->mex_get_data (); } | |
1036 | |
1037 octave_idx_type *mex_get_ir (void) const { return rep->mex_get_ir (); } | |
1038 | |
1039 octave_idx_type *mex_get_jc (void) const { return rep->mex_get_jc (); } | |
1040 | |
1041 mxArray *as_mxArray (void) const { return rep->as_mxArray (); } | |
1042 | |
7620
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
1043 octave_value diag (octave_idx_type k = 0) const |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
1044 { return rep->diag (k); } |
36594d5bbe13
Move diag function into the octave_value class
David Bateman <dbateman@free.fr>
parents:
7576
diff
changeset
|
1045 |
7463
2467639bd8c0
eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1046 octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const |
7433 | 1047 { return rep->sort (dim, mode); } |
1048 octave_value sort (Array<octave_idx_type> &sidx, octave_idx_type dim = 0, | |
7463
2467639bd8c0
eliminate UNDEFINED sort mode
John W. Eaton <jwe@octave.org>
parents:
7433
diff
changeset
|
1049 sortmode mode = ASCENDING) const |
7433 | 1050 { return rep->sort (sidx, dim, mode); } |
1051 | |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1052 sortmode is_sorted (sortmode mode = UNSORTED) const |
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1053 { return rep->is_sorted (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
1054 |
8733
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1055 Array<octave_idx_type> sort_rows_idx (sortmode mode = ASCENDING) const |
3ef774603887
rename all uses of sortrows_idx to sort_rows_idx
John W. Eaton <jwe@octave.org>
parents:
8732
diff
changeset
|
1056 { return rep->sort_rows_idx (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
1057 |
8734
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1058 sortmode is_sorted_rows (sortmode mode = UNSORTED) const |
767ed8cc6634
rename internal issorted and issorted_rows functions to is_sorted and is_sorted_rows
John W. Eaton <jwe@octave.org>
parents:
8733
diff
changeset
|
1059 { return rep->is_sorted_rows (mode); } |
8721
e9cb742df9eb
imported patch sort3.diff
Jaroslav Hajek <highegg@gmail.com>
parents:
8676
diff
changeset
|
1060 |
7489
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1061 void lock (void) { rep->lock (); } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1062 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1063 void unlock (void) { rep->unlock (); } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1064 |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1065 bool islocked (void) const { return rep->islocked (); } |
8e4592e49fa7
don't clear locked functions
John W. Eaton <jwe@octave.org>
parents:
7463
diff
changeset
|
1066 |
7761
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1067 void dump (std::ostream& os) const { rep->dump (os); } |
5adeea5de26c
symbol table reporting functions
John W. Eaton <jwe@octave.org>
parents:
7740
diff
changeset
|
1068 |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1069 #define MAPPER_FORWARD(F) \ |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1070 octave_value F (void) const { return rep->F (); } |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1071 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1072 MAPPER_FORWARD (abs) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1073 MAPPER_FORWARD (acos) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1074 MAPPER_FORWARD (acosh) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1075 MAPPER_FORWARD (angle) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1076 MAPPER_FORWARD (arg) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1077 MAPPER_FORWARD (asin) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1078 MAPPER_FORWARD (asinh) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1079 MAPPER_FORWARD (atan) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1080 MAPPER_FORWARD (atanh) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1081 MAPPER_FORWARD (ceil) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1082 MAPPER_FORWARD (conj) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1083 MAPPER_FORWARD (cos) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1084 MAPPER_FORWARD (cosh) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1085 MAPPER_FORWARD (erf) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1086 MAPPER_FORWARD (erfc) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1087 MAPPER_FORWARD (exp) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1088 MAPPER_FORWARD (expm1) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1089 MAPPER_FORWARD (finite) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1090 MAPPER_FORWARD (fix) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1091 MAPPER_FORWARD (floor) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1092 MAPPER_FORWARD (gamma) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1093 MAPPER_FORWARD (imag) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1094 MAPPER_FORWARD (isinf) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1095 MAPPER_FORWARD (isna) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1096 MAPPER_FORWARD (isnan) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1097 MAPPER_FORWARD (lgamma) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1098 MAPPER_FORWARD (log) |
7740 | 1099 MAPPER_FORWARD (log2) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1100 MAPPER_FORWARD (log10) |
7638
2df457529cfa
implement expm1 and log1p functions
Jaroslav Hajek <highegg@gmail.com>
parents:
7636
diff
changeset
|
1101 MAPPER_FORWARD (log1p) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1102 MAPPER_FORWARD (real) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1103 MAPPER_FORWARD (round) |
7636
99c410f7f0b0
implement mapper function for banker's rounding
Jaroslav Hajek <highegg@gmail.com>
parents:
7620
diff
changeset
|
1104 MAPPER_FORWARD (roundb) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1105 MAPPER_FORWARD (signum) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1106 MAPPER_FORWARD (sin) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1107 MAPPER_FORWARD (sinh) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1108 MAPPER_FORWARD (sqrt) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1109 MAPPER_FORWARD (tan) |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1110 MAPPER_FORWARD (tanh) |
7528
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1111 |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1112 // These functions are prefixed with X to avoid potential macro |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1113 // conflicts. |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1114 |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1115 MAPPER_FORWARD (xisalnum) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1116 MAPPER_FORWARD (xisalpha) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1117 MAPPER_FORWARD (xisascii) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1118 MAPPER_FORWARD (xiscntrl) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1119 MAPPER_FORWARD (xisdigit) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1120 MAPPER_FORWARD (xisgraph) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1121 MAPPER_FORWARD (xislower) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1122 MAPPER_FORWARD (xisprint) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1123 MAPPER_FORWARD (xispunct) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1124 MAPPER_FORWARD (xisspace) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1125 MAPPER_FORWARD (xisupper) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1126 MAPPER_FORWARD (xisxdigit) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1127 MAPPER_FORWARD (xtoascii) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1128 MAPPER_FORWARD (xtolower) |
26d8a92644de
try to avoid ctype macro problems
John W. Eaton <jwe@octave.org>
parents:
7503
diff
changeset
|
1129 MAPPER_FORWARD (xtoupper) |
7503
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1130 |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1131 #undef MAPPER_FORWARD |
8c32f95c2639
convert mapper functions to new format
David Bateman <dbateman@free.fr>
parents:
7489
diff
changeset
|
1132 |
2376 | 1133 protected: |
1134 | |
5759 | 1135 // The real representation. |
1136 octave_base_value *rep; | |
2413 | 1137 |
3933 | 1138 private: |
2903 | 1139 |
3205 | 1140 assign_op unary_op_to_assign_op (unary_op op); |
1141 | |
3204 | 1142 binary_op op_eq_to_binary_op (assign_op op); |
1143 | |
3219 | 1144 DECLARE_OCTAVE_ALLOCATOR |
2376 | 1145 }; |
1146 | |
5508 | 1147 // Publish externally used friend functions. |
1148 | |
6109 | 1149 extern OCTINTERP_API octave_value |
5508 | 1150 do_unary_op (octave_value::unary_op op, const octave_value& a); |
1151 | |
6109 | 1152 extern OCTINTERP_API octave_value |
5508 | 1153 do_binary_op (octave_value::binary_op op, |
1154 const octave_value& a, const octave_value& b); | |
1155 | |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1156 extern OCTINTERP_API octave_value |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1157 do_binary_op (octave_value::compound_binary_op op, |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1158 const octave_value& a, const octave_value& b); |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1159 |
3203 | 1160 #define OV_UNOP_FN(name) \ |
1161 inline octave_value \ | |
1162 name (const octave_value& a) \ | |
1163 { \ | |
1164 return do_unary_op (octave_value::name, a); \ | |
1165 } | |
1166 | |
1167 #define OV_UNOP_OP(name, op) \ | |
1168 inline octave_value \ | |
1169 operator op (const octave_value& a) \ | |
1170 { \ | |
1171 return name (a); \ | |
1172 } | |
1173 | |
1174 #define OV_UNOP_FN_OP(name, op) \ | |
1175 OV_UNOP_FN (name) \ | |
1176 OV_UNOP_OP (name, op) | |
1177 | |
3525 | 1178 OV_UNOP_FN_OP (op_not, !) |
6518 | 1179 OV_UNOP_FN_OP (op_uplus, +) |
3525 | 1180 OV_UNOP_FN_OP (op_uminus, -) |
3203 | 1181 |
3525 | 1182 OV_UNOP_FN (op_transpose) |
1183 OV_UNOP_FN (op_hermitian) | |
3203 | 1184 |
1185 // No simple way to define these for prefix and suffix ops? | |
1186 // | |
1187 // incr | |
1188 // decr | |
1189 | |
1190 #define OV_BINOP_FN(name) \ | |
1191 inline octave_value \ | |
1192 name (const octave_value& a1, const octave_value& a2) \ | |
1193 { \ | |
1194 return do_binary_op (octave_value::name, a1, a2); \ | |
1195 } | |
1196 | |
1197 #define OV_BINOP_OP(name, op) \ | |
1198 inline octave_value \ | |
1199 operator op (const octave_value& a1, const octave_value& a2) \ | |
1200 { \ | |
1201 return name (a1, a2); \ | |
1202 } | |
1203 | |
1204 #define OV_BINOP_FN_OP(name, op) \ | |
1205 OV_BINOP_FN (name) \ | |
1206 OV_BINOP_OP (name, op) | |
1207 | |
3525 | 1208 OV_BINOP_FN_OP (op_add, +) |
1209 OV_BINOP_FN_OP (op_sub, -) | |
1210 OV_BINOP_FN_OP (op_mul, *) | |
1211 OV_BINOP_FN_OP (op_div, /) | |
3203 | 1212 |
3525 | 1213 OV_BINOP_FN (op_pow) |
1214 OV_BINOP_FN (op_ldiv) | |
1215 OV_BINOP_FN (op_lshift) | |
1216 OV_BINOP_FN (op_rshift) | |
3203 | 1217 |
3525 | 1218 OV_BINOP_FN_OP (op_lt, <) |
1219 OV_BINOP_FN_OP (op_le, <=) | |
1220 OV_BINOP_FN_OP (op_eq, ==) | |
1221 OV_BINOP_FN_OP (op_ge, >=) | |
1222 OV_BINOP_FN_OP (op_gt, >) | |
1223 OV_BINOP_FN_OP (op_ne, !=) | |
3203 | 1224 |
3525 | 1225 OV_BINOP_FN (op_el_mul) |
1226 OV_BINOP_FN (op_el_div) | |
1227 OV_BINOP_FN (op_el_pow) | |
1228 OV_BINOP_FN (op_el_ldiv) | |
1229 OV_BINOP_FN (op_el_and) | |
1230 OV_BINOP_FN (op_el_or) | |
3203 | 1231 |
3525 | 1232 OV_BINOP_FN (op_struct_ref) |
3203 | 1233 |
7800
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1234 #define OV_COMP_BINOP_FN(name) \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1235 inline octave_value \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1236 name (const octave_value& a1, const octave_value& a2) \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1237 { \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1238 return do_binary_op (octave_value::name, a1, a2); \ |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1239 } |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1240 |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1241 OV_COMP_BINOP_FN (op_trans_mul) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1242 OV_COMP_BINOP_FN (op_mul_trans) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1243 OV_COMP_BINOP_FN (op_herm_mul) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1244 OV_COMP_BINOP_FN (op_mul_herm) |
5861b95e9879
support for compound operators, implement trans_mul, mul_trans, herm_mul and mul_herm
Jaroslav Hajek <highegg@gmail.com>
parents:
7789
diff
changeset
|
1245 |
6109 | 1246 extern OCTINTERP_API void install_types (void); |
2376 | 1247 |
5775 | 1248 // FIXME -- these trait classes probably belong somehwere else... |
4946 | 1249 |
1250 template <typename T> | |
1251 class | |
1252 octave_type_traits | |
1253 { | |
1254 public: | |
1255 typedef T val_type; | |
1256 }; | |
1257 | |
1258 #define OCTAVE_TYPE_TRAIT(T, VAL_T) \ | |
1259 template <> \ | |
1260 class \ | |
1261 octave_type_traits<T> \ | |
1262 { \ | |
1263 public: \ | |
1264 typedef VAL_T val_type; \ | |
1265 } | |
1266 | |
1267 OCTAVE_TYPE_TRAIT (octave_int8, octave_int8::val_type); | |
1268 OCTAVE_TYPE_TRAIT (octave_uint8, octave_uint8::val_type); | |
1269 OCTAVE_TYPE_TRAIT (octave_int16, octave_int16::val_type); | |
1270 OCTAVE_TYPE_TRAIT (octave_uint16, octave_uint16::val_type); | |
1271 OCTAVE_TYPE_TRAIT (octave_int32, octave_int32::val_type); | |
1272 OCTAVE_TYPE_TRAIT (octave_uint32, octave_uint32::val_type); | |
1273 OCTAVE_TYPE_TRAIT (octave_int64, octave_int64::val_type); | |
1274 OCTAVE_TYPE_TRAIT (octave_uint64, octave_uint64::val_type); | |
1275 | |
1276 template <typename T> | |
1277 class octave_array_type_traits | |
1278 { | |
1279 public: | |
1280 typedef T element_type; | |
1281 }; | |
1282 | |
1283 #define OCTAVE_ARRAY_TYPE_TRAIT(T, ELT_T) \ | |
1284 template <> \ | |
1285 class \ | |
1286 octave_array_type_traits<T> \ | |
1287 { \ | |
1288 public: \ | |
1289 typedef ELT_T element_type; \ | |
1290 } | |
1291 | |
1292 OCTAVE_ARRAY_TYPE_TRAIT (charNDArray, char); | |
4970 | 1293 OCTAVE_ARRAY_TYPE_TRAIT (boolNDArray, bool); |
4946 | 1294 OCTAVE_ARRAY_TYPE_TRAIT (int8NDArray, octave_int8); |
1295 OCTAVE_ARRAY_TYPE_TRAIT (uint8NDArray, octave_uint8); | |
1296 OCTAVE_ARRAY_TYPE_TRAIT (int16NDArray, octave_int16); | |
1297 OCTAVE_ARRAY_TYPE_TRAIT (uint16NDArray, octave_uint16); | |
1298 OCTAVE_ARRAY_TYPE_TRAIT (int32NDArray, octave_int32); | |
1299 OCTAVE_ARRAY_TYPE_TRAIT (uint32NDArray, octave_uint32); | |
1300 OCTAVE_ARRAY_TYPE_TRAIT (int64NDArray, octave_int64); | |
1301 OCTAVE_ARRAY_TYPE_TRAIT (uint64NDArray, octave_uint64); | |
1302 OCTAVE_ARRAY_TYPE_TRAIT (NDArray, double); | |
7789
82be108cc558
First attempt at single precision tyeps
David Bateman <dbateman@free.fr>
parents:
7761
diff
changeset
|
1303 OCTAVE_ARRAY_TYPE_TRAIT (FloatNDArray, float); |
4946 | 1304 |
5759 | 1305 // This will eventually go away, but for now it can be used to |
1306 // simplify the transition to the new octave_value class hierarchy, | |
1307 // which uses octave_base_value instead of octave_value for the type | |
1308 // of octave_value::rep. | |
1309 #define OV_REP_TYPE octave_base_value | |
1310 | |
2376 | 1311 #endif |
1312 | |
1313 /* | |
6705 | 1314 ;;; Local Variables: *** |
1315 ;;; mode: C++ *** | |
1316 ;;; End: *** | |
2376 | 1317 */ |