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