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