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