GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ov.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2026 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_ov_h)
27#define octave_ov_h 1
28
29#include "octave-config.h"
30
31#include <cstdlib>
32
33#include <iosfwd>
34#include <string>
35#include <list>
36#include <memory>
37#include <map>
38
39#include "panic.h"
40
41#include "data-conv.h"
42#include "idx-vector.h"
43#include "mach-info.h"
44#include "mx-base.h"
45#include "oct-sort.h"
46#include "oct-time.h"
47#include "str-vec.h"
48
50
51class stack_frame;
52class type_info;
53class scope_stack_frame;
54class base_value_stack_frame;
55
56OCTAVE_END_NAMESPACE(octave)
57
58class Cell;
59class float_format;
60class mxArray;
61class octave_map;
63class octave_function;
67class octave_fcn_cache;
68
69#include "mxtypes.h"
70
71#include "oct-stream.h"
72#include "ov-base.h"
73
74class OCTINTERP_API octave_value
75{
76public:
77
79 {
80 op_not, // not
81 op_uplus, // uplus
82 op_uminus, // uminus
83 op_transpose, // transpose
84 op_hermitian, // ctranspose
88 unknown_unary_op
89 };
90
92 {
93 op_add, // plus
94 op_sub, // minus
95 op_mul, // mtimes
96 op_div, // mrdivide
97 op_pow, // mpower
98 op_ldiv, // mldivide
99 op_lt, // lt
100 op_le, // le
101 op_eq, // eq
102 op_ge, // ge
103 op_gt, // gt
104 op_ne, // ne
105 op_el_mul, // times
106 op_el_div, // rdivide
107 op_el_pow, // power
108 op_el_ldiv, // ldivide
109 op_el_and, // and
110 op_el_or, // or
113 unknown_binary_op
114 };
115
132
151
152 static OCTINTERP_API binary_op assign_op_to_binary_op (assign_op);
153
154 static OCTINTERP_API assign_op binary_op_to_assign_op (binary_op);
155
156 static OCTINTERP_API std::string unary_op_as_string (unary_op);
157 static OCTINTERP_API std::string unary_op_fcn_name (unary_op);
158
159 static OCTINTERP_API std::string binary_op_as_string (binary_op);
160 static OCTINTERP_API std::string binary_op_fcn_name (binary_op);
161
162 static OCTINTERP_API std::string binary_op_fcn_name (compound_binary_op);
163
164 static OCTINTERP_API std::string assign_op_as_string (assign_op);
165
166 static OCTINTERP_API octave_value
167 empty_conv (const std::string& type,
168 const octave_value& rhs = octave_value ());
169
170 enum magic_colon { magic_colon_t };
171
173 : m_rep (nil_rep ())
174 {
175 m_rep->m_count++;
176 }
177
178 OCTINTERP_API octave_value (short int i);
179 OCTINTERP_API octave_value (unsigned short int i);
180 OCTINTERP_API octave_value (int i);
181 OCTINTERP_API octave_value (unsigned int i);
182 OCTINTERP_API octave_value (long int i);
183 OCTINTERP_API octave_value (unsigned long int i);
184
185 // FIXME: These are kluges. They turn into doubles internally, which will
186 // break for very large values. We just use them to store things like
187 // 64-bit ino_t, etc, and hope that those values are never actually larger
188 // than can be represented exactly in a double.
189
190#if defined (OCTAVE_HAVE_LONG_LONG_INT)
191 OCTINTERP_API octave_value (long long int i);
192#endif
193#if defined (OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT)
194 OCTINTERP_API octave_value (unsigned long long int i);
195#endif
196
197 OCTINTERP_API octave_value (octave::sys::time t);
198 OCTINTERP_API octave_value (double d);
199 OCTINTERP_API octave_value (float d);
200 OCTINTERP_API octave_value (const Cell& c, bool is_cs_list = false);
201 OCTINTERP_API octave_value (const Matrix& m,
202 const MatrixType& t = MatrixType ());
203 OCTINTERP_API octave_value (const FloatMatrix& m,
204 const MatrixType& t = MatrixType ());
205 OCTINTERP_API octave_value (const NDArray& nda);
206 OCTINTERP_API octave_value (const FloatNDArray& nda);
207 OCTINTERP_API octave_value (const Array<double>& m);
208 OCTINTERP_API octave_value (const Array<float>& m);
209 OCTINTERP_API octave_value (const DiagMatrix& d);
210 OCTINTERP_API octave_value (const DiagArray2<double>& d);
211 OCTINTERP_API octave_value (const DiagArray2<float>& d);
212 OCTINTERP_API octave_value (const DiagArray2<Complex>& d);
213 OCTINTERP_API octave_value (const DiagArray2<FloatComplex>& d);
214 OCTINTERP_API octave_value (const FloatDiagMatrix& d);
215 OCTINTERP_API octave_value (const RowVector& v);
216 OCTINTERP_API octave_value (const FloatRowVector& v);
217 OCTINTERP_API octave_value (const ColumnVector& v);
218 OCTINTERP_API octave_value (const FloatColumnVector& v);
219 OCTINTERP_API octave_value (const Complex& C);
220 OCTINTERP_API octave_value (const FloatComplex& C);
221 OCTINTERP_API octave_value (const ComplexMatrix& m,
222 const MatrixType& t = MatrixType ());
223 OCTINTERP_API octave_value (const FloatComplexMatrix& m,
224 const MatrixType& t = MatrixType ());
225 OCTINTERP_API octave_value (const ComplexNDArray& cnda);
226 OCTINTERP_API octave_value (const FloatComplexNDArray& cnda);
227 OCTINTERP_API octave_value (const Array<Complex>& m);
228 OCTINTERP_API octave_value (const Array<FloatComplex>& m);
229 OCTINTERP_API octave_value (const ComplexDiagMatrix& d);
230 OCTINTERP_API octave_value (const FloatComplexDiagMatrix& d);
231 OCTINTERP_API octave_value (const ComplexRowVector& v);
232 OCTINTERP_API octave_value (const FloatComplexRowVector& v);
233 OCTINTERP_API octave_value (const ComplexColumnVector& v);
234 OCTINTERP_API octave_value (const FloatComplexColumnVector& v);
235 OCTINTERP_API octave_value (const PermMatrix& p);
236 OCTINTERP_API octave_value (bool b);
237 OCTINTERP_API octave_value (const boolMatrix& bm,
238 const MatrixType& t = MatrixType ());
239 OCTINTERP_API octave_value (const boolNDArray& bnda);
240 OCTINTERP_API octave_value (const Array<bool>& bnda);
241 OCTINTERP_API octave_value (char c, char type = '\'');
242 OCTINTERP_API octave_value (const char *s, char type = '\'');
243 OCTINTERP_API octave_value (const std::string& s, char type = '\'');
244 OCTINTERP_API octave_value (const string_vector& s, char type = '\'');
245 OCTINTERP_API octave_value (const charMatrix& chm, char type = '\'');
246 OCTINTERP_API octave_value (const charNDArray& chnda, char type = '\'');
247 OCTINTERP_API octave_value (const Array<char>& chnda, char type = '\'');
248
249 OCTINTERP_API octave_value (const SparseMatrix& m,
250 const MatrixType& t = MatrixType ());
251 OCTINTERP_API octave_value (const Sparse<double>& m,
252 const MatrixType& t = MatrixType ());
253 OCTINTERP_API octave_value (const SparseComplexMatrix& m,
254 const MatrixType& t = MatrixType ());
255 OCTINTERP_API octave_value (const Sparse<Complex>& m,
256 const MatrixType& t = MatrixType ());
257 OCTINTERP_API octave_value (const SparseBoolMatrix& bm,
258 const MatrixType& t = MatrixType ());
259 OCTINTERP_API octave_value (const Sparse<bool>& m,
260 const MatrixType& t = MatrixType ());
261 OCTINTERP_API octave_value (const octave_int8& i);
262 OCTINTERP_API octave_value (const octave_int16& i);
263 OCTINTERP_API octave_value (const octave_int32& i);
264 OCTINTERP_API octave_value (const octave_int64& i);
265 OCTINTERP_API octave_value (const octave_uint8& i);
266 OCTINTERP_API octave_value (const octave_uint16& i);
267 OCTINTERP_API octave_value (const octave_uint32& i);
268 OCTINTERP_API octave_value (const octave_uint64& i);
269 OCTINTERP_API octave_value (const int8NDArray& inda);
270 OCTINTERP_API octave_value (const Array<octave_int8>& inda);
271 OCTINTERP_API octave_value (const int16NDArray& inda);
272 OCTINTERP_API octave_value (const Array<octave_int16>& inda);
273 OCTINTERP_API octave_value (const int32NDArray& inda);
274 OCTINTERP_API octave_value (const Array<octave_int32>& inda);
275 OCTINTERP_API octave_value (const int64NDArray& inda);
276 OCTINTERP_API octave_value (const Array<octave_int64>& inda);
277 OCTINTERP_API octave_value (const uint8NDArray& inda);
278 OCTINTERP_API octave_value (const Array<octave_uint8>& inda);
279 OCTINTERP_API octave_value (const uint16NDArray& inda);
280 OCTINTERP_API octave_value (const Array<octave_uint16>& inda);
281 OCTINTERP_API octave_value (const uint32NDArray& inda);
282 OCTINTERP_API octave_value (const Array<octave_uint32>& inda);
283 OCTINTERP_API octave_value (const uint64NDArray& inda);
284 OCTINTERP_API octave_value (const Array<octave_uint64>& inda);
285 OCTINTERP_API octave_value (const Array<octave_idx_type>& inda,
286 bool zero_based = false,
287 bool cache_index = false);
288 OCTINTERP_API octave_value (const Array<std::string>& cellstr);
289 OCTINTERP_API octave_value (const octave::idx_vector& idx, bool lazy = true);
290
291 OCTINTERP_API octave_value (const octave::range<double>& r,
292 bool force_range = false);
293
294 // For now, enable only range<double>.
295
296 OCTINTERP_API octave_value (const octave_map& m);
297 OCTINTERP_API octave_value (const octave_scalar_map& m);
298 OCTINTERP_API octave_value (const std::map<std::string, octave_value>&);
299 OCTINTERP_API octave_value (const octave_map& m, const std::string& id,
300 const std::list<std::string>& plist);
301 OCTINTERP_API octave_value (const octave_scalar_map& m, const std::string& id,
302 const std::list<std::string>& plist);
303
304 // This one is explicit because it can cause some trouble to
305 // accidentally create a cs-list when one was not intended.
306 explicit OCTINTERP_API octave_value (const octave_value_list& m);
307
309
310 octave_value (octave_base_value *new_rep, bool borrow = false)
311 : m_rep (new_rep)
312 {
313 if (borrow)
314 m_rep->m_count++;
315 }
316
317 // Copy constructor.
318
320 : m_rep (a.m_rep)
321 {
322 m_rep->m_count++;
323 }
324
326 : m_rep (a.m_rep)
327 {
328 a.m_rep = nullptr;
329 }
330
331 // This should only be called for derived types.
332
333 OCTINTERP_API octave_base_value * clone () const;
334
336 { return m_rep->empty_clone (); }
337
338 // Delete the representation of this constant if the count drops to zero.
339
341 {
342 // Because we define a move constructor and a move assignment
343 // operator, rep may be a nullptr here. We should only need to
344 // protect the move assignment operator in a similar way.
345
346 if (m_rep && --m_rep->m_count == 0 && m_rep != nil_rep ())
347 delete m_rep;
348 }
349
351 {
352 if (m_rep->m_count > 1)
353 {
354 octave_base_value *r = m_rep->unique_clone ();
355
356 if (--m_rep->m_count == 0 && m_rep != nil_rep ())
357 delete m_rep;
358
359 m_rep = r;
360 }
361 }
362
363 // This uniquifies the value if it is referenced by more than a certain
364 // number of shallow copies. This is useful for optimizations where we
365 // know a certain copy, typically within a cell array, to be obsolete.
366 void make_unique (int obsolete_copies)
367 {
368 if (m_rep->m_count > obsolete_copies + 1)
369 {
370 octave_base_value *r = m_rep->unique_clone ();
371
372 if (--m_rep->m_count == 0 && m_rep != nil_rep ())
373 delete m_rep;
374
375 m_rep = r;
376 }
377 }
378
379 // Convert any nested function handles in this object to use weak
380 // references to their enclosing stack frame context. Used to break
381 // shared_ptr reference cycles for handles to nested functions
382 // (closures).
383 void break_closure_cycles (const std::shared_ptr<octave::stack_frame>&);
384
385 // Simple assignment.
386
387 octave_value& operator = (const octave_value& a)
388 {
389 if (m_rep != a.m_rep)
390 {
391 if (--m_rep->m_count == 0 && m_rep != nil_rep ())
392 delete m_rep;
393
394 m_rep = a.m_rep;
395 m_rep->m_count++;
396 }
397
398 return *this;
399 }
400
401 octave_value& operator = (octave_value&& a)
402 {
403 // Because we define a move constructor and a move assignment
404 // operator, rep may be a nullptr here. We should only need to
405 // protect the destructor in a similar way.
406
407 if (this != &a)
408 {
409 if (m_rep && --m_rep->m_count == 0 && m_rep != nil_rep ())
410 delete m_rep;
411
412 m_rep = a.m_rep;
413 a.m_rep = nullptr;
414 }
415
416 return *this;
417 }
418
419 octave_idx_type get_count () const { return m_rep->m_count; }
420
422 { return m_rep->numeric_conversion_function (); }
423
425 { return m_rep->numeric_demotion_function (); }
426
427 OCTINTERP_API void maybe_mutate ();
428
430 { return m_rep->squeeze (); }
431
432 // The result of full().
434 { return m_rep->full_value (); }
435
436 // Type conversions.
437
438 // Returns a copy of a scalar (double), or makes a scalar
439 // for other types.
441 { return m_rep->as_double_or_copy (); }
442
443 octave_value as_double () const { return m_rep->as_double (); }
444 octave_value as_single () const { return m_rep->as_single (); }
445
446 octave_value as_int8 () const { return m_rep->as_int8 (); }
447 octave_value as_int16 () const { return m_rep->as_int16 (); }
448 octave_value as_int32 () const { return m_rep->as_int32 (); }
449 octave_value as_int64 () const { return m_rep->as_int64 (); }
450
451 octave_value as_uint8 () const { return m_rep->as_uint8 (); }
452 octave_value as_uint16 () const { return m_rep->as_uint16 (); }
453 octave_value as_uint32 () const { return m_rep->as_uint32 (); }
454 octave_value as_uint64 () const { return m_rep->as_uint64 (); }
455
458
459 // Close to dims (), but can be overloaded for classes.
461 { return m_rep->size (); }
462
463 // FIXME: should this function be deprecated and removed? It supports
464 // an undocumented feature of Matlab.
466 { return m_rep->xnumel (idx); }
467
468 // FIXME: Do we really need all these different versions of subsref
469 // and related functions?
470
471 OCTINTERP_API octave_value
472 single_subsref (const std::string& type, const octave_value_list& idx);
473
474 octave_value subsref (const std::string& type,
475 const std::list<octave_value_list>& idx)
476 { return m_rep->subsref (type, idx); }
477
478 octave_value subsref (const std::string& type,
479 const std::list<octave_value_list>& idx,
480 bool auto_add)
481 { return m_rep->subsref (type, idx, auto_add); }
482
483 OCTINTERP_API octave_value_list
484 subsref (const std::string& type, const std::list<octave_value_list>& idx,
485 int nargout);
486
488 simple_subsref (char type, octave_value_list& idx, int nargout);
489
490 OCTINTERP_API octave_value
491 next_subsref (const std::string& type,
492 const std::list<octave_value_list>& idx, std::size_t skip = 1);
493
494 OCTINTERP_API octave_value_list
495 next_subsref (int nargout, const std::string& type,
496 const std::list<octave_value_list>& idx, std::size_t skip = 1);
497
498 OCTINTERP_API octave_value
499 next_subsref (bool auto_add, const std::string& type,
500 const std::list<octave_value_list>& idx, std::size_t skip = 1);
501
502 octave_value index_op (const octave_value_list& idx, bool resize_ok = false)
503 {
504 return m_rep->do_index_op (idx, resize_ok);
505 }
506
507 OCTINTERP_API octave_idx_type
508 end_index (octave_idx_type index_position,
509 octave_idx_type num_indices) const;
510
511 OCTINTERP_API octave_value
512 subsasgn (const std::string& type, const std::list<octave_value_list>& idx,
513 const octave_value& rhs);
514
516 simple_subsasgn (char type, octave_value_list& idx, const octave_value& rhs)
517 {
518 return m_rep->simple_subsasgn (type, idx, rhs);
519 }
520
521 OCTINTERP_API octave_value
522 undef_subsasgn (const std::string& type,
523 const std::list<octave_value_list>& idx,
524 const octave_value& rhs);
525
526 OCTINTERP_API octave_value&
527 assign (assign_op op, const std::string& type,
528 const std::list<octave_value_list>& idx, const octave_value& rhs);
529
530 OCTINTERP_API octave_value& assign (assign_op, const octave_value& rhs);
531
532 octave::idx_vector index_vector (bool require_integers = false) const
533 {
534 return m_rep->index_vector (require_integers);
535 }
536
537 // Size.
538
539 dim_vector dims () const { return m_rep->dims (); }
540
541 OCTINTERP_API std::string get_dims_str () const;
542
543 octave_idx_type rows () const { return m_rep->rows (); }
544
545 octave_idx_type columns () const { return m_rep->columns (); }
546
547 OCTINTERP_API octave_idx_type length () const;
548
549 int ndims () const { return m_rep->ndims (); }
550
551 bool all_zero_dims () const { return dims ().all_zero (); }
552
553 // Are the dimensions of this constant zero by zero?
554 bool is_zero_by_zero () const
555 { return (ndims () == 2 && rows () == 0 && columns () == 0); }
556
558 { return m_rep->numel (); }
559
560 std::size_t byte_size () const
561 { return m_rep->byte_size (); }
562
563 octave_idx_type nnz () const { return m_rep->nnz (); }
564
565 octave_idx_type nzmax () const { return m_rep->nzmax (); }
566
567 octave_idx_type nfields () const { return m_rep->nfields (); }
568
570 { return m_rep->reshape (dv); }
571
572 octave_value permute (const Array<int>& vec, bool inv = false) const
573 { return m_rep->permute (vec, inv); }
574
576 { return m_rep->permute (vec, true); }
577
578 octave_value resize (const dim_vector& dv, bool fill = false) const
579 { return m_rep->resize (dv, fill);}
580
582 { return m_rep->matrix_type (); }
583
585 { return m_rep->matrix_type (typ); }
586
587 // Does this constant have a type? Both of these are provided since it is
588 // sometimes more natural to write is_undefined() instead of ! is_defined().
589
590 bool is_defined () const
591 { return m_rep->is_defined (); }
592
593 bool is_undefined () const
594 { return ! is_defined (); }
595
596 bool is_legacy_object () const
597 { return m_rep->is_legacy_object (); }
598
599 bool isempty () const
600 { return m_rep->isempty (); }
601
602 bool iscell () const
603 { return m_rep->iscell (); }
604
605 bool iscellstr () const
606 { return m_rep->iscellstr (); }
607
608 bool is_real_scalar () const
609 { return m_rep->is_real_scalar (); }
610
611 bool is_real_matrix () const
612 { return m_rep->is_real_matrix (); }
613
614 bool is_complex_scalar () const
615 { return m_rep->is_complex_scalar (); }
616
617 bool is_complex_matrix () const
618 { return m_rep->is_complex_matrix (); }
619
620 bool is_bool_scalar () const
621 { return m_rep->is_bool_scalar (); }
622
623 bool is_bool_matrix () const
624 { return m_rep->is_bool_matrix (); }
625
626 bool is_char_matrix () const
627 { return m_rep->is_char_matrix (); }
628
629 bool is_diag_matrix () const
630 { return m_rep->is_diag_matrix (); }
631
632 bool is_perm_matrix () const
633 { return m_rep->is_perm_matrix (); }
634
635 bool is_string () const
636 { return m_rep->is_string (); }
637
638 bool is_sq_string () const
639 { return m_rep->is_sq_string (); }
640
641 bool is_dq_string () const
642 { return m_rep->is_string () && ! m_rep->is_sq_string (); }
643
644 bool is_range () const
645 { return m_rep->is_range (); }
646
647 bool isstruct () const
648 { return m_rep->isstruct (); }
649
650 bool is_classdef_meta () const
651 { return m_rep->is_classdef_meta (); }
652
653 bool is_classdef_object () const
654 { return m_rep->is_classdef_object (); }
655
657 { return m_rep->is_classdef_superclass_ref (); }
658
659 bool is_package () const
660 { return m_rep->is_package (); }
661
662 bool isobject () const
663 { return m_rep->isobject (); }
664
665 bool isjava () const
666 { return m_rep->isjava (); }
667
668 bool is_cs_list () const
669 { return m_rep->is_cs_list (); }
670
671 bool is_magic_colon () const
672 { return m_rep->is_magic_colon (); }
673
674 bool is_magic_int () const
675 { return m_rep->is_magic_int (); }
676
677 bool isnull () const
678 { return m_rep->isnull (); }
679
680 // Are any or all of the elements in this constant nonzero?
681
682 octave_value all (int dim = 0) const
683 { return m_rep->all (dim); }
684
685 octave_value any (int dim = 0) const
686 { return m_rep->any (dim); }
687
689 { return m_rep->builtin_type (); }
690
691 // Floating point types.
692
693 bool is_double_type () const
694 { return m_rep->is_double_type (); }
695
696 bool is_single_type () const
697 { return m_rep->is_single_type (); }
698
699 bool isfloat () const
700 { return m_rep->isfloat (); }
701
702 // Integer types.
703
704 bool is_int8_type () const
705 { return m_rep->is_int8_type (); }
706
707 bool is_int16_type () const
708 { return m_rep->is_int16_type (); }
709
710 bool is_int32_type () const
711 { return m_rep->is_int32_type (); }
712
713 bool is_int64_type () const
714 { return m_rep->is_int64_type (); }
715
716 bool is_uint8_type () const
717 { return m_rep->is_uint8_type (); }
718
719 bool is_uint16_type () const
720 { return m_rep->is_uint16_type (); }
721
722 bool is_uint32_type () const
723 { return m_rep->is_uint32_type (); }
724
725 bool is_uint64_type () const
726 { return m_rep->is_uint64_type (); }
727
728 bool isinteger () const
729 { return m_rep->isinteger (); }
730
731 // Other type stuff.
732
733 bool islogical () const
734 { return m_rep->islogical (); }
735
736 bool isreal () const
737 { return m_rep->isreal (); }
738
739 bool iscomplex () const
740 { return m_rep->iscomplex (); }
741
742 bool is_scalar_type () const
743 { return m_rep->is_scalar_type (); }
744
745 bool is_matrix_type () const
746 { return m_rep->is_matrix_type (); }
747
748 bool isnumeric () const
749 { return m_rep->isnumeric (); }
750
751 bool issparse () const
752 { return m_rep->issparse (); }
753
754 // Does this constant correspond to a truth value?
755
756 bool is_true () const
757 { return m_rep->is_true (); }
758
759 // Do two constants match (in a switch statement)?
760
761 bool is_equal (const octave_value&) const;
762
763 bool is_constant () const
764 { return m_rep->is_constant (); }
765
766 bool is_function_handle () const
767 { return m_rep->is_function_handle (); }
768
770 { return m_rep->is_anonymous_function (); }
771
772 bool is_inline_function () const
773 { return m_rep->is_inline_function (); }
774
775 bool is_function () const
776 { return m_rep->is_function (); }
777
778 bool is_user_script () const
779 { return m_rep->is_user_script (); }
780
781 bool is_user_function () const
782 { return m_rep->is_user_function (); }
783
784 bool is_user_code () const
785 { return m_rep->is_user_code (); }
786
788 { return m_rep->is_builtin_function (); }
789
790 bool is_dld_function () const
791 { return m_rep->is_dld_function (); }
792
793 bool is_mex_function () const
794 { return m_rep->is_mex_function (); }
795
796 void erase_subfunctions () { m_rep->erase_subfunctions (); }
797
798 // Values.
799
800 octave_value eval () { return *this; }
801
802 short int
803 short_value (bool req_int = false, bool frc_str_conv = false) const
804 { return m_rep->short_value (req_int, frc_str_conv); }
805
806 unsigned short int
807 ushort_value (bool req_int = false, bool frc_str_conv = false) const
808 { return m_rep->ushort_value (req_int, frc_str_conv); }
809
810 int int_value (bool req_int = false, bool frc_str_conv = false) const
811 { return m_rep->int_value (req_int, frc_str_conv); }
812
813 int strict_int_value (bool frc_str_conv = false) const
814 { return m_rep->int_value (true, frc_str_conv); }
815
816 unsigned int
817 uint_value (bool req_int = false, bool frc_str_conv = false) const
818 { return m_rep->uint_value (req_int, frc_str_conv); }
819
820 int nint_value (bool frc_str_conv = false) const
821 { return m_rep->nint_value (frc_str_conv); }
822
823 long int
824 long_value (bool req_int = false, bool frc_str_conv = false) const
825 { return m_rep->long_value (req_int, frc_str_conv); }
826
827 unsigned long int
828 ulong_value (bool req_int = false, bool frc_str_conv = false) const
829 { return m_rep->ulong_value (req_int, frc_str_conv); }
830
831 int64_t
832 int64_value (bool req_int = false, bool frc_str_conv = false) const
833 { return m_rep->int64_value (req_int, frc_str_conv); }
834
835 uint64_t
836 uint64_value (bool req_int = false, bool frc_str_conv = false) const
837 { return m_rep->uint64_value (req_int, frc_str_conv); }
838
840 idx_type_value (bool req_int = false, bool frc_str_conv = false) const;
841
843 strict_idx_type_value (bool frc_str_conv = false) const;
844
845 double double_value (bool frc_str_conv = false) const
846 { return m_rep->double_value (frc_str_conv); }
847
848 float float_value (bool frc_str_conv = false) const
849 { return m_rep->float_value (frc_str_conv); }
850
851 double scalar_value (bool frc_str_conv = false) const
852 { return m_rep->scalar_value (frc_str_conv); }
853
854 float float_scalar_value (bool frc_str_conv = false) const
855 { return m_rep->float_scalar_value (frc_str_conv); }
856
857 Matrix matrix_value (bool frc_str_conv = false) const
858 { return m_rep->matrix_value (frc_str_conv); }
859
860 FloatMatrix float_matrix_value (bool frc_str_conv = false) const
861 { return m_rep->float_matrix_value (frc_str_conv); }
862
863 NDArray array_value (bool frc_str_conv = false) const
864 { return m_rep->array_value (frc_str_conv); }
865
866 FloatNDArray float_array_value (bool frc_str_conv = false) const
867 { return m_rep->float_array_value (frc_str_conv); }
868
869 Complex complex_value (bool frc_str_conv = false) const
870 { return m_rep->complex_value (frc_str_conv); }
871
872 FloatComplex float_complex_value (bool frc_str_conv = false) const
873 { return m_rep->float_complex_value (frc_str_conv); }
874
875 ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const
876 { return m_rep->complex_matrix_value (frc_str_conv); }
877
879 float_complex_matrix_value (bool frc_str_conv = false) const
880 { return m_rep->float_complex_matrix_value (frc_str_conv); }
881
882 ComplexNDArray complex_array_value (bool frc_str_conv = false) const
883 { return m_rep->complex_array_value (frc_str_conv); }
884
886 float_complex_array_value (bool frc_str_conv = false) const
887 { return m_rep->float_complex_array_value (frc_str_conv); }
888
889 bool bool_value (bool warn = false) const
890 { return m_rep->bool_value (warn); }
891
892 bool strict_bool_value () const
893 { return m_rep->bool_value (true); }
894
895 boolMatrix bool_matrix_value (bool warn = false) const
896 { return m_rep->bool_matrix_value (warn); }
897
898 boolNDArray bool_array_value (bool warn = false) const
899 { return m_rep->bool_array_value (warn); }
900
901 charMatrix char_matrix_value (bool frc_str_conv = false) const
902 { return m_rep->char_matrix_value (frc_str_conv); }
903
904 charNDArray char_array_value (bool frc_str_conv = false) const
905 { return m_rep->char_array_value (frc_str_conv); }
906
907 SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const
908 { return m_rep->sparse_matrix_value (frc_str_conv); }
909
911 sparse_complex_matrix_value (bool frc_str_conv = false) const
912 { return m_rep->sparse_complex_matrix_value (frc_str_conv); }
913
915 { return m_rep->sparse_bool_matrix_value (warn); }
916
917 DiagMatrix diag_matrix_value (bool force = false) const
918 { return m_rep->diag_matrix_value (force); }
919
920 FloatDiagMatrix float_diag_matrix_value (bool force = false) const
921 { return m_rep->float_diag_matrix_value (force); }
922
924 { return m_rep->complex_diag_matrix_value (force); }
925
927 float_complex_diag_matrix_value (bool force = false) const
928 { return m_rep->float_complex_diag_matrix_value (force); }
929
931 { return m_rep->perm_matrix_value (); }
932
934 { return m_rep->int8_scalar_value (); }
935
937 { return m_rep->int16_scalar_value (); }
938
940 { return m_rep->int32_scalar_value (); }
941
943 { return m_rep->int64_scalar_value (); }
944
946 { return m_rep->uint8_scalar_value (); }
947
949 { return m_rep->uint16_scalar_value (); }
950
952 { return m_rep->uint32_scalar_value (); }
953
955 { return m_rep->uint64_scalar_value (); }
956
958 { return m_rep->int8_array_value (); }
959
961 { return m_rep->int16_array_value (); }
962
964 { return m_rep->int32_array_value (); }
965
967 { return m_rep->int64_array_value (); }
968
970 { return m_rep->uint8_array_value (); }
971
973 { return m_rep->uint16_array_value (); }
974
976 { return m_rep->uint32_array_value (); }
977
979 { return m_rep->uint64_array_value (); }
980
981 std::string string_value (bool force = false) const
982 { return m_rep->string_value (force); }
983
984 string_vector string_vector_value (bool pad = false) const
985 { return m_rep->string_vector_value (pad); }
986
987 Cell cell_value () const;
988
990 { return m_rep->cellstr_value (); }
991
992 octave::range<double> range_value () const
993 { return m_rep->range_value (); }
994
995 // For now, enable only range<double>.
996
997 OCTINTERP_API octave_map map_value () const;
998
999 OCTINTERP_API octave_scalar_map scalar_map_value () const;
1000
1002 { return m_rep->map_keys (); }
1003
1004 bool isfield (const std::string& field_name) const
1005 { return m_rep->isfield (field_name); }
1006
1007 std::size_t nparents () const
1008 { return m_rep->nparents (); }
1009
1010 std::list<std::string> parent_class_name_list () const
1011 { return m_rep->parent_class_name_list (); }
1012
1014 { return m_rep->parent_class_names (); }
1015
1017 find_parent_class (const std::string& parent_class_name)
1018 { return m_rep->find_parent_class (parent_class_name); }
1019
1020 bool is_instance_of (const std::string& cls_name) const
1021 { return m_rep->is_instance_of (cls_name); }
1022
1023 OCTINTERP_API octave_classdef *
1024 classdef_object_value (bool silent = false) const;
1025
1026 OCTINTERP_API octave_function *
1027 function_value (bool silent = false) const;
1028
1029 OCTINTERP_API octave_user_function *
1030 user_function_value (bool silent = false) const;
1031
1032 OCTINTERP_API octave_user_script *
1033 user_script_value (bool silent = false) const;
1034
1035 OCTINTERP_API octave_user_code * user_code_value (bool silent = false) const;
1036
1037 OCTINTERP_API octave_fcn_handle *
1038 fcn_handle_value (bool silent = false) const;
1039
1040 OCTINTERP_API octave_value_list list_value () const;
1041
1042 OCTINTERP_API ColumnVector
1043 column_vector_value (bool frc_str_conv = false,
1044 bool frc_vec_conv = false) const;
1045
1046 OCTINTERP_API ComplexColumnVector
1047 complex_column_vector_value (bool frc_str_conv = false,
1048 bool frc_vec_conv = false) const;
1049
1050 OCTINTERP_API RowVector
1051 row_vector_value (bool frc_str_conv = false,
1052 bool frc_vec_conv = false) const;
1053
1054 OCTINTERP_API ComplexRowVector
1055 complex_row_vector_value (bool frc_str_conv = false,
1056 bool frc_vec_conv = false) const;
1057
1058 OCTINTERP_API FloatColumnVector
1059 float_column_vector_value (bool frc_str_conv = false,
1060 bool frc_vec_conv = false) const;
1061
1062 OCTINTERP_API FloatComplexColumnVector
1063 float_complex_column_vector_value (bool frc_str_conv = false,
1064 bool frc_vec_conv = false) const;
1065
1066 OCTINTERP_API FloatRowVector
1067 float_row_vector_value (bool frc_str_conv = false,
1068 bool frc_vec_conv = false) const;
1069
1070 OCTINTERP_API FloatComplexRowVector
1071 float_complex_row_vector_value (bool frc_str_conv = false,
1072 bool frc_vec_conv = false) const;
1073
1074 OCTINTERP_API Array<int>
1075 int_vector_value (bool req_int = false,
1076 bool frc_str_conv = false,
1077 bool frc_vec_conv = false) const;
1078
1079 OCTINTERP_API Array<octave_idx_type>
1080 octave_idx_type_vector_value (bool req_int = false,
1081 bool frc_str_conv = false,
1082 bool frc_vec_conv = false) const;
1083
1084 OCTINTERP_API Array<double>
1085 vector_value (bool frc_str_conv = false,
1086 bool frc_vec_conv = false) const;
1087
1088 OCTINTERP_API Array<Complex>
1089 complex_vector_value (bool frc_str_conv = false,
1090 bool frc_vec_conv = false) const;
1091
1092 OCTINTERP_API Array<float>
1093 float_vector_value (bool frc_str_conv = false,
1094 bool frc_vec_conv = false) const;
1095
1096 OCTINTERP_API Array<FloatComplex>
1097 float_complex_vector_value (bool frc_str_conv = false,
1098 bool frc_vec_conv = false) const;
1099
1100 // Extract values of specific types without any implicit type conversions.
1101 // Throw an error if an object is the wrong type for the requested value
1102 // extraction.
1103 //
1104 // These functions are intended to provide a simple way to extract values of
1105 // specific types and display error messages that are more meaningful than
1106 // the generic "error: wrong type argument 'cell'" message.
1107
1108 OCTINTERP_API short int xshort_value (const char *fmt, ...) const;
1109
1110 OCTINTERP_API unsigned short int xushort_value (const char *fmt, ...) const;
1111
1112 OCTINTERP_API int xint_value (const char *fmt, ...) const;
1113
1114 OCTINTERP_API int strict_int_value (const char *fmt, ...) const;
1115
1116 OCTINTERP_API unsigned int xuint_value (const char *fmt, ...) const;
1117
1118 OCTINTERP_API int xnint_value (const char *fmt, ...) const;
1119
1120 OCTINTERP_API long int xlong_value (const char *fmt, ...) const;
1121
1122 OCTINTERP_API unsigned long int xulong_value (const char *fmt, ...) const;
1123
1124 OCTINTERP_API int64_t xint64_value (const char *fmt, ...) const;
1125
1126 OCTINTERP_API uint64_t xuint64_value (const char *fmt, ...) const;
1127
1128 OCTINTERP_API octave_idx_type xidx_type_value (const char *fmt, ...) const;
1129
1130 OCTINTERP_API octave_idx_type strict_idx_type_value (const char *fmt, ...) const;
1131
1132 OCTINTERP_API double xdouble_value (const char *fmt, ...) const;
1133
1134 OCTINTERP_API float xfloat_value (const char *fmt, ...) const;
1135
1136 OCTINTERP_API double xscalar_value (const char *fmt, ...) const;
1137
1138 OCTINTERP_API float xfloat_scalar_value (const char *fmt, ...) const;
1139
1140 OCTINTERP_API Matrix xmatrix_value (const char *fmt, ...) const;
1141
1142 OCTINTERP_API FloatMatrix xfloat_matrix_value (const char *fmt, ...) const;
1143
1144 OCTINTERP_API NDArray xarray_value (const char *fmt, ...) const;
1145
1146 OCTINTERP_API FloatNDArray xfloat_array_value (const char *fmt, ...) const;
1147
1148 OCTINTERP_API Complex xcomplex_value (const char *fmt, ...) const;
1149
1150 OCTINTERP_API FloatComplex xfloat_complex_value (const char *fmt, ...) const;
1151
1152 OCTINTERP_API ComplexMatrix
1153 xcomplex_matrix_value (const char *fmt, ...) const;
1154
1155 OCTINTERP_API FloatComplexMatrix
1156 xfloat_complex_matrix_value (const char *fmt, ...) const;
1157
1158 OCTINTERP_API ComplexNDArray
1159 xcomplex_array_value (const char *fmt, ...) const;
1160
1161 OCTINTERP_API FloatComplexNDArray
1162 xfloat_complex_array_value (const char *fmt, ...) const;
1163
1164 OCTINTERP_API bool xbool_value (const char *fmt, ...) const;
1165
1166 OCTINTERP_API bool strict_bool_value (const char *fmt, ...) const;
1167
1168 OCTINTERP_API boolMatrix xbool_matrix_value (const char *fmt, ...) const;
1169
1170 OCTINTERP_API boolNDArray xbool_array_value (const char *fmt, ...) const;
1171
1172 OCTINTERP_API charMatrix xchar_matrix_value (const char *fmt, ...) const;
1173
1174 OCTINTERP_API charNDArray xchar_array_value (const char *fmt, ...) const;
1175
1176 OCTINTERP_API SparseMatrix xsparse_matrix_value (const char *fmt, ...) const;
1177
1178 OCTINTERP_API SparseComplexMatrix
1179 xsparse_complex_matrix_value (const char *fmt, ...) const;
1180
1181 OCTINTERP_API SparseBoolMatrix
1182 xsparse_bool_matrix_value (const char *fmt, ...) const;
1183
1184 OCTINTERP_API DiagMatrix xdiag_matrix_value (const char *fmt, ...) const;
1185
1186 OCTINTERP_API FloatDiagMatrix
1187 xfloat_diag_matrix_value (const char *fmt, ...) const;
1188
1189 OCTINTERP_API ComplexDiagMatrix
1190 xcomplex_diag_matrix_value (const char *fmt, ...) const;
1191
1192 OCTINTERP_API FloatComplexDiagMatrix
1193 xfloat_complex_diag_matrix_value (const char *fmt, ...) const;
1194
1195 OCTINTERP_API PermMatrix xperm_matrix_value (const char *fmt, ...) const;
1196
1197 OCTINTERP_API octave_int8 xint8_scalar_value (const char *fmt, ...) const;
1198
1199 OCTINTERP_API octave_int16 xint16_scalar_value (const char *fmt, ...) const;
1200
1201 OCTINTERP_API octave_int32 xint32_scalar_value (const char *fmt, ...) const;
1202
1203 OCTINTERP_API octave_int64 xint64_scalar_value (const char *fmt, ...) const;
1204
1205 OCTINTERP_API octave_uint8 xuint8_scalar_value (const char *fmt, ...) const;
1206
1207 OCTINTERP_API octave_uint16 xuint16_scalar_value (const char *fmt, ...) const;
1208
1209 OCTINTERP_API octave_uint32 xuint32_scalar_value (const char *fmt, ...) const;
1210
1211 OCTINTERP_API octave_uint64 xuint64_scalar_value (const char *fmt, ...) const;
1212
1213 OCTINTERP_API int8NDArray xint8_array_value (const char *fmt, ...) const;
1214
1215 OCTINTERP_API int16NDArray xint16_array_value (const char *fmt, ...) const;
1216
1217 OCTINTERP_API int32NDArray xint32_array_value (const char *fmt, ...) const;
1218
1219 OCTINTERP_API int64NDArray xint64_array_value (const char *fmt, ...) const;
1220
1221 OCTINTERP_API uint8NDArray xuint8_array_value (const char *fmt, ...) const;
1222
1223 OCTINTERP_API uint16NDArray xuint16_array_value (const char *fmt, ...) const;
1224
1225 OCTINTERP_API uint32NDArray xuint32_array_value (const char *fmt, ...) const;
1226
1227 OCTINTERP_API uint64NDArray xuint64_array_value (const char *fmt, ...) const;
1228
1229 OCTINTERP_API std::string xstring_value (const char *fmt, ...) const;
1230
1231 OCTINTERP_API string_vector xstring_vector_value (const char *fmt, ...) const;
1232
1233 OCTINTERP_API Cell xcell_value (const char *fmt, ...) const;
1234
1235 OCTINTERP_API Array<std::string> xcellstr_value (const char *fmt, ...) const;
1236
1237 OCTINTERP_API octave::range<double>
1238 xrange_value (const char *fmt, ...) const;
1239
1240 // For now, enable only range<double>.
1241
1242 OCTINTERP_API octave_map xmap_value (const char *fmt, ...) const;
1243
1244 OCTINTERP_API octave_scalar_map
1245 xscalar_map_value (const char *fmt, ...) const;
1246
1247 OCTINTERP_API ColumnVector xcolumn_vector_value (const char *fmt, ...) const;
1248
1249 OCTINTERP_API ComplexColumnVector
1250 xcomplex_column_vector_value (const char *fmt, ...) const;
1251
1252 OCTINTERP_API RowVector xrow_vector_value (const char *fmt, ...) const;
1253
1254 OCTINTERP_API ComplexRowVector
1255 xcomplex_row_vector_value (const char *fmt, ...) const;
1256
1257 OCTINTERP_API FloatColumnVector
1258 xfloat_column_vector_value (const char *fmt, ...) const;
1259
1260 OCTINTERP_API FloatComplexColumnVector
1261 xfloat_complex_column_vector_value (const char *fmt, ...) const;
1262
1263 OCTINTERP_API FloatRowVector
1264 xfloat_row_vector_value (const char *fmt, ...) const;
1265
1266 OCTINTERP_API FloatComplexRowVector
1267 xfloat_complex_row_vector_value (const char *fmt, ...) const;
1268
1269 OCTINTERP_API Array<int> xint_vector_value (const char *fmt, ...) const;
1270
1271 OCTINTERP_API Array<octave_idx_type>
1272 xoctave_idx_type_vector_value (const char *fmt, ...) const;
1273
1274 OCTINTERP_API Array<double> xvector_value (const char *fmt, ...) const;
1275
1276 OCTINTERP_API Array<Complex>
1277 xcomplex_vector_value (const char *fmt, ...) const;
1278
1279 OCTINTERP_API Array<float> xfloat_vector_value (const char *fmt, ...) const;
1280
1281 OCTINTERP_API Array<FloatComplex>
1282 xfloat_complex_vector_value (const char *fmt, ...) const;
1283
1284 OCTINTERP_API octave_function * xfunction_value (const char *fmt, ...) const;
1285
1286 OCTINTERP_API octave_user_function *
1287 xuser_function_value (const char *fmt, ...) const;
1288
1289 OCTINTERP_API octave_user_script *
1290 xuser_script_value (const char *fmt, ...) const;
1291
1292 OCTINTERP_API octave_user_code *
1293 xuser_code_value (const char *fmt, ...) const;
1294
1295 OCTINTERP_API octave_fcn_handle *
1296 xfcn_handle_value (const char *fmt, ...) const;
1297
1298 OCTINTERP_API octave_value_list xlist_value (const char *fmt, ...) const;
1299
1300 // Possibly economize a lazy-indexed value.
1301
1303 { m_rep->maybe_economize (); }
1304
1305 // The following two hook conversions are called on any octave_value prior to
1306 // storing it to a "permanent" location, like a named variable, a cell or a
1307 // struct component, or a return value of a function.
1308
1309 OCTINTERP_API octave_value storable_value () const;
1310
1311 // Ditto, but in place, i.e., equivalent to *this = this->storable_value (),
1312 // but possibly more efficient.
1313
1314 OCTINTERP_API void make_storable_value ();
1315
1316 // FIXME: These should probably be private.
1317 // Conversions. If a user of this class wants a certain kind of constant,
1318 // he should simply ask for it, and we should convert it if possible.
1319
1320 octave_value convert_to_str (bool pad = false, bool force = false,
1321 char type = '\'') const
1322 { return m_rep->convert_to_str (pad, force, type); }
1323
1325 convert_to_str_internal (bool pad, bool force, char type) const
1326 { return m_rep->convert_to_str_internal (pad, force, type); }
1327
1329 { m_rep->convert_to_row_or_column_vector (); }
1330
1331 bool print_as_scalar () const
1332 { return m_rep->print_as_scalar (); }
1333
1334 void print (std::ostream& os, bool pr_as_read_syntax = false)
1335 { m_rep->print (os, pr_as_read_syntax); }
1336
1337 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const
1338 { m_rep->print_raw (os, pr_as_read_syntax); }
1339
1340 bool print_name_tag (std::ostream& os, const std::string& name) const
1341 { return m_rep->print_name_tag (os, name); }
1342
1343 void print_with_name (std::ostream& os, const std::string& name) const
1344 { m_rep->print_with_name (os, name, true); }
1345
1346 void short_disp (std::ostream& os) const { m_rep->short_disp (os); }
1347
1349
1350 std::string edit_display (const float_display_format& fmt,
1352 {
1353 return m_rep->edit_display (fmt, i, j);
1354 }
1355
1356 int type_id () const { return m_rep->type_id (); }
1357
1358 std::string type_name () const { return m_rep->type_name (); }
1359
1360 std::string class_name () const { return m_rep->class_name (); }
1361
1362 // Unary operations that are member functions. There are also some
1363 // non-member functions for unary and binary operations declared
1364 // below, outside of the octave_value class declaration.
1365
1367
1368 OCTINTERP_API octave_value&
1369 non_const_unary_op (unary_op op, const std::string& type,
1370 const std::list<octave_value_list>& idx);
1371
1372 const octave_base_value& get_rep () const { return *m_rep; }
1373
1374 bool is_copy_of (const octave_value& val) const { return m_rep == val.m_rep; }
1375
1376 OCTINTERP_API void
1377 print_info (std::ostream& os, const std::string& prefix = "") const;
1378
1379 bool save_ascii (std::ostream& os) { return m_rep->save_ascii (os); }
1380
1381 OCTINTERP_API bool load_ascii (std::istream& is);
1382
1383 bool save_binary (std::ostream& os, bool save_as_floats)
1384 { return m_rep->save_binary (os, save_as_floats); }
1385
1386 OCTINTERP_API bool load_binary (std::istream& is, bool swap,
1387 octave::mach_info::float_format fmt);
1388
1389 bool save_hdf5 (octave_hdf5_id loc_id, const char *name,
1390 bool save_as_floats)
1391 { return m_rep->save_hdf5 (loc_id, name, save_as_floats); }
1392
1393 OCTINTERP_API bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
1394
1395 OCTINTERP_API int
1396 write (octave::stream& os, int block_size,
1397 oct_data_conv::data_type output_type, int skip,
1398 octave::mach_info::float_format flt_fmt) const;
1399
1400 octave_base_value * internal_rep () const { return m_rep; }
1401
1402 // These functions exist to support the MEX interface.
1403 // You should not use them anywhere else.
1404
1405 OCTINTERP_API const void *
1406 mex_get_data (mxClassID class_id = mxUNKNOWN_CLASS,
1407 mxComplexity complexity = mxREAL) const;
1408
1410 {
1411 return m_rep->mex_get_ir ();
1412 }
1413
1414 const octave_idx_type *
1415 mex_get_jc () const
1416 {
1417 return m_rep->mex_get_jc ();
1418 }
1419
1420 mxArray * as_mxArray (bool interleaved = false) const
1421 { return m_rep->as_mxArray (interleaved); }
1422
1424 { return m_rep->diag (k); }
1425
1427 { return m_rep->diag (m, n); }
1428
1430 { return m_rep->sort (dim, mode); }
1432 sortmode mode = ASCENDING) const
1433 { return m_rep->sort (sidx, dim, mode); }
1434
1436 { return m_rep->issorted (mode); }
1437
1439 { return m_rep->sort_rows_idx (mode); }
1440
1442 { return m_rep->is_sorted_rows (mode); }
1443
1444 void lock () { m_rep->lock (); }
1445
1446 void unlock () { m_rep->unlock (); }
1447
1448 bool islocked () const { return m_rep->islocked (); }
1449
1450 void call_object_destructor () { return m_rep->call_object_destructor (); }
1451
1452 octave_value dump () const { return m_rep->dump (); }
1453
1454#define MAPPER_FORWARD(F) \
1455 octave_value F () const \
1456 { \
1457 return m_rep->map (octave_base_value::umap_ ## F); \
1458 }
1459
1505
1506 // These functions are prefixed with X to avoid potential macro conflicts.
1507
1519 MAPPER_FORWARD (xisxdigit)
1523
1524#undef MAPPER_FORWARD
1525
1527 { return m_rep->map (umap); }
1528
1529 //! Extract the n-th element, aka 'val(n)'.
1530 //!
1531 //! @return Result is undefined if 'val' is not an array type
1532 //! or @p n is out of range.
1533 //!
1534 //! @warning Function calls should never error.
1535
1538 { return m_rep->fast_elem_extract (n); }
1539
1540 //! Assign the n-th element, aka 'val(n) = x'.
1541 //!
1542 //! @returns false if 'val' is not an array type,
1543 //! @p x is not a matching scalar type,
1544 //! or @p n is out of range.
1545 //!
1546 //! @warning Function calls should never error.
1547
1548 bool
1550 {
1551 make_unique ();
1552 return m_rep->fast_elem_insert (n, x);
1553 }
1554
1555protected:
1556
1557 //! The real representation.
1559
1560 static OCTINTERP_API octave_base_value * nil_rep ();
1561
1562private:
1563
1564 OCTINTERP_API assign_op unary_op_to_assign_op (unary_op op);
1565
1566 OCTINTERP_API binary_op op_eq_to_binary_op (assign_op op);
1567
1568 // This declaration protects against constructing octave_value from
1569 // const octave_base_value* which actually silently calls octave_value (bool).
1570 OCTINTERP_API octave_value (const octave_base_value *);
1571
1572};
1573
1574// Non-member unary and binary operations on octave_value objects.
1575
1577
1578extern OCTINTERP_API octave_value
1580 const octave_value& a);
1581
1582extern OCTINTERP_API octave_value
1584
1585extern OCTINTERP_API octave_value
1587 const octave_value& a, const octave_value& b);
1588
1589extern OCTINTERP_API octave_value
1591 const octave_value& a, const octave_value& b);
1592
1593extern OCTINTERP_API octave_value
1595 const octave_value& b);
1596
1597extern OCTINTERP_API octave_value
1599 const octave_value& b);
1600
1601extern OCTINTERP_API octave_value
1603 const octave_value& b, const Array<octave_idx_type>& ra_idx);
1604
1605extern OCTINTERP_API octave_value
1608
1609extern OCTINTERP_API octave_value
1610colon_op (const octave_value& base, const octave_value& increment,
1611 const octave_value& limit, bool is_for_cmd_expr = false);
1612
1613inline octave_value
1614colon_op (const octave_value& base, const octave_value& limit,
1615 bool is_for_cmd_expr = false)
1616{
1617 // Note, we need to pass an undefined octave_value object instead of
1618 // octave_value (1.0) so that we can properly detect the
1619 // two-argument case and correctly pass just two arguments to any
1620 // user-defined function that is provided if either base or limit is
1621 // an object.
1622
1623 return colon_op (base, octave_value (), limit, is_for_cmd_expr);
1624}
1625
1626OCTAVE_END_NAMESPACE(octave)
1627
1628#define OV_UNOP_FN(name) \
1629 inline octave_value \
1630 name (const octave_value& a) \
1631 { \
1632 return octave::unary_op (octave_value::name, a); \
1633 }
1634
1635#define OV_UNOP_OP(name, op) \
1636 inline octave_value \
1637 operator op (const octave_value& a) \
1638 { \
1639 return name (a); \
1640 }
1641
1642#define OV_UNOP_FN_OP(name, op) \
1643 OV_UNOP_FN (name) \
1644 OV_UNOP_OP (name, op)
1645
1649
1652
1653// No simple way to define these for prefix and suffix ops?
1654//
1655// incr
1656// decr
1657
1658#define OV_BINOP_FN(name) \
1659 inline octave_value \
1660 name (const octave_value& a1, const octave_value& a2) \
1661 { \
1662 return octave::binary_op (octave_value::name, a1, a2); \
1663 }
1664
1665#define OV_BINOP_OP(name, op) \
1666 inline octave_value \
1667 operator op (const octave_value& a1, const octave_value& a2) \
1668 { \
1669 return name (a1, a2); \
1670 }
1671
1672#define OV_BINOP_FN_OP(name, op) \
1673 OV_BINOP_FN (name) \
1674 OV_BINOP_OP (name, op)
1675
1680
1683
1690
1697
1699
1700#define OV_COMP_BINOP_FN(name) \
1701 inline octave_value \
1702 name (const octave_value& a1, const octave_value& a2) \
1703 { \
1704 return octave::binary_op (octave_value::name, a1, a2); \
1705 }
1706
1711
1712extern OCTINTERP_API void install_types (octave::type_info&);
1713
1714// Templated value extractors.
1715
1716template <typename Value>
1718{
1719 // We can't include error.h in ov.h. Is there anything better than
1720 // panic_impossible that we can do here?
1721
1723}
1724
1725#define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \
1726 template <> \
1727 inline VALUE octave_value_extract<VALUE> (const octave_value& v) \
1728 { \
1729 return v.MPREFIX ## _value (); \
1730 }
1731
1732DEF_VALUE_EXTRACTOR (double, scalar)
1733DEF_VALUE_EXTRACTOR (float, float_scalar)
1737
1746
1752
1762
1768
1772DEF_VALUE_EXTRACTOR (FloatComplexColumnVector, float_complex_column_vector)
1773
1778
1784
1788#undef DEF_VALUE_EXTRACTOR
1789
1790// We can't include error.h in ov.h. Is there anything better than
1791// panic_impossible that we can do here?
1792
1793#define DEF_DUMMY_VALUE_EXTRACTOR(VALUE,DEFVAL) \
1794 template <> \
1795 inline VALUE octave_value_extract<VALUE> (const octave_value&) \
1796 { \
1797 panic_impossible (); \
1798 return DEFVAL; \
1799 }
1800
1803#undef DEF_DUMMY_VALUE_EXTRACTOR
1804
1805#endif
ComplexColumnVector conj(const ComplexColumnVector &a)
#define C(a, b)
Definition Faddeeva.cc:256
N Dimensional Array with copy-on-write semantics.
Definition Array-base.h:130
size_type size(const size_type d) const
Size of the specified dimension.
Definition Array-base.h:518
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Sort by rows returns only indices.
Definition Cell.h:41
Vector representing the dimensions (size) of an Array.
Definition dim-vector.h:92
virtual octave_base_value * try_narrowing_conversion()
Definition ov-base.h:332
virtual octave_base_value * find_parent_class(const std::string &)
Definition ov-base.h:711
octave::refcount< octave_idx_type > m_count
Definition ov-base.h:958
virtual octave_base_value * unique_clone()
Definition ov-base.h:298
virtual octave_base_value * empty_clone() const
Definition ov-base.cc:118
octave_value(octave_value &&a)
Definition ov.h:325
bool is_function_handle() const
Definition ov.h:766
bool is_classdef_object() const
Definition ov.h:653
string_vector xstring_vector_value(const char *fmt,...) const
bool isfield(const std::string &field_name) const
Definition ov.h:1004
octave_value(const octave_uint64 &i)
octave_value(const Sparse< Complex > &m, const MatrixType &t=MatrixType())
octave_value as_uint64() const
Definition ov.h:454
SparseMatrix xsparse_matrix_value(const char *fmt,...) const
ColumnVector xcolumn_vector_value(const char *fmt,...) const
bool isfloat() const
Definition ov.h:699
octave_value sort(Array< octave_idx_type > &sidx, octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition ov.h:1431
octave_value_list list_value() const
octave_int8 xint8_scalar_value(const char *fmt,...) const
bool all_zero_dims() const
Definition ov.h:551
const octave_idx_type * mex_get_jc() const
Definition ov.h:1415
void make_unique(int obsolete_copies)
Definition ov.h:366
bool is_magic_int() const
Definition ov.h:674
bool strict_bool_value(const char *fmt,...) const
RowVector xrow_vector_value(const char *fmt,...) const
uint64_t uint64_value(bool req_int=false, bool frc_str_conv=false) const
Definition ov.h:836
octave_int8 int8_scalar_value() const
Definition ov.h:933
const octave_base_value & get_rep() const
Definition ov.h:1372
bool is_diag_matrix() const
Definition ov.h:629
bool is_undefined() const
Definition ov.h:593
bool is_uint32_type() const
Definition ov.h:722
octave_value(octave_base_value *new_rep, bool borrow=false)
Definition ov.h:310
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition ov.h:1337
bool isinteger() const
Definition ov.h:728
int64NDArray xint64_array_value(const char *fmt,...) const
boolNDArray bool_array_value(bool warn=false) const
Definition ov.h:898
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
Definition ov.h:907
octave_value simple_subsasgn(char type, octave_value_list &idx, const octave_value &rhs)
Definition ov.h:516
ComplexRowVector complex_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_uint64 uint64_scalar_value() const
Definition ov.h:954
void call_object_destructor()
Definition ov.h:1450
int8NDArray xint8_array_value(const char *fmt,...) const
Cell xcell_value(const char *fmt,...) const
std::string class_name() const
Definition ov.h:1360
bool bool_value(bool warn=false) const
Definition ov.h:889
int xnint_value(const char *fmt,...) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition ov.h:1325
bool is_inline_function() const
Definition ov.h:772
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition ov.h:474
octave_uint16 uint16_scalar_value() const
Definition ov.h:948
octave_function * function_value(bool silent=false) const
bool is_real_scalar() const
Definition ov.h:608
octave_idx_type strict_idx_type_value(const char *fmt,...) const
charMatrix char_matrix_value(bool frc_str_conv=false) const
Definition ov.h:901
octave_value(const Sparse< bool > &m, const MatrixType &t=MatrixType())
FloatComplexNDArray xfloat_complex_array_value(const char *fmt,...) const
octave_value as_int32() const
Definition ov.h:448
int32NDArray int32_array_value() const
Definition ov.h:963
uint16NDArray uint16_array_value() const
Definition ov.h:972
DiagMatrix diag_matrix_value(bool force=false) const
Definition ov.h:917
uint32NDArray xuint32_array_value(const char *fmt,...) const
octave_map xmap_value(const char *fmt,...) const
octave_value index_op(const octave_value_list &idx, bool resize_ok=false)
Definition ov.h:502
bool fast_elem_insert(octave_idx_type n, const octave_value &x)
Assign the n-th element, aka 'val(n) = x'.
Definition ov.h:1549
octave_value(const octave_int16 &i)
FloatComplexDiagMatrix xfloat_complex_diag_matrix_value(const char *fmt,...) const
unsigned long int xulong_value(const char *fmt,...) const
bool is_true() const
Definition ov.h:756
octave_classdef * classdef_object_value(bool silent=false) const
int16NDArray xint16_array_value(const char *fmt,...) const
octave_value as_int8() const
Definition ov.h:446
octave_value & assign(assign_op, const octave_value &rhs)
octave_value(const Array< octave_uint8 > &inda)
Array< std::string > xcellstr_value(const char *fmt,...) const
bool is_instance_of(const std::string &cls_name) const
Definition ov.h:1020
octave_value(const uint8NDArray &inda)
int16NDArray int16_array_value() const
Definition ov.h:960
void maybe_economize()
Definition ov.h:1302
octave_value_list xlist_value(const char *fmt,...) const
Cell cell_value() const
int int_value(bool req_int=false, bool frc_str_conv=false) const
Definition ov.h:810
void print_with_name(std::ostream &os, const std::string &name) const
Definition ov.h:1343
bool is_dq_string() const
Definition ov.h:641
octave_value(const octave_map &m, const std::string &id, const std::list< std::string > &plist)
@ op_hermitian
Definition ov.h:84
@ num_unary_ops
Definition ov.h:87
@ op_uminus
Definition ov.h:82
@ op_not
Definition ov.h:80
@ op_transpose
Definition ov.h:83
@ op_uplus
Definition ov.h:81
@ op_incr
Definition ov.h:85
@ op_decr
Definition ov.h:86
octave_value(const octave::range< double > &r, bool force_range=false)
int8NDArray int8_array_value() const
Definition ov.h:957
std::string get_dims_str() const
octave_int64 int64_scalar_value() const
Definition ov.h:942
octave_value(const char *s, char type='\'')
int ndims() const
Definition ov.h:549
octave_value()
Definition ov.h:172
void make_unique()
Definition ov.h:350
octave_idx_type rows() const
Definition ov.h:543
octave::idx_vector index_vector(bool require_integers=false) const
Definition ov.h:532
octave_value eval()
Definition ov.h:800
int64_t int64_value(bool req_int=false, bool frc_str_conv=false) const
Definition ov.h:832
bool is_scalar_type() const
Definition ov.h:742
octave_value diag(octave_idx_type m, octave_idx_type n) const
Definition ov.h:1426
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx, bool auto_add)
Definition ov.h:478
Array< float > float_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_sq_string() const
Definition ov.h:638
short int short_value(bool req_int=false, bool frc_str_conv=false) const
Definition ov.h:803
octave_scalar_map scalar_map_value() const
bool isreal() const
Definition ov.h:736
octave_value & non_const_unary_op(unary_op op, const std::string &type, const std::list< octave_value_list > &idx)
octave_idx_type nzmax() const
Definition ov.h:565
octave_idx_type strict_idx_type_value(bool frc_str_conv=false) const
bool is_classdef_meta() const
Definition ov.h:650
Array< std::string > cellstr_value() const
Definition ov.h:989
bool is_string() const
Definition ov.h:635
bool is_constant() const
Definition ov.h:763
octave_value permute(const Array< int > &vec, bool inv=false) const
Definition ov.h:572
bool isnumeric() const
Definition ov.h:748
int strict_int_value(bool frc_str_conv=false) const
Definition ov.h:813
FloatDiagMatrix float_diag_matrix_value(bool force=false) const
Definition ov.h:920
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
Definition ov.h:875
bool is_int8_type() const
Definition ov.h:704
bool is_user_script() const
Definition ov.h:778
void short_disp(std::ostream &os) const
Definition ov.h:1346
octave_value_list simple_subsref(char type, octave_value_list &idx, int nargout)
void erase_subfunctions()
Definition ov.h:796
octave_value_list next_subsref(int nargout, const std::string &type, const std::list< octave_value_list > &idx, std::size_t skip=1)
bool isjava() const
Definition ov.h:665
void lock()
Definition ov.h:1444
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_value(octave_value::magic_colon)
SparseBoolMatrix xsparse_bool_matrix_value(const char *fmt,...) const
octave_value dump() const
Definition ov.h:1452
double xscalar_value(const char *fmt,...) const
Complex complex_value(bool frc_str_conv=false) const
Definition ov.h:869
octave_value(const octave_uint16 &i)
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Definition ov.h:1438
octave_int32 xint32_scalar_value(const char *fmt,...) const
float xfloat_scalar_value(const char *fmt,...) const
octave_user_script * user_script_value(bool silent=false) const
octave_value(const uint32NDArray &inda)
FloatComplexDiagMatrix float_complex_diag_matrix_value(bool force=false) const
Definition ov.h:927
bool is_perm_matrix() const
Definition ov.h:632
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
octave_value as_uint8() const
Definition ov.h:451
FloatMatrix xfloat_matrix_value(const char *fmt,...) const
octave_idx_type idx_type_value(bool req_int=false, bool frc_str_conv=false) const
unsigned short int ushort_value(bool req_int=false, bool frc_str_conv=false) const
Definition ov.h:807
Matrix size()
Definition ov.h:460
Complex xcomplex_value(const char *fmt,...) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition ov.h:1389
octave::range< double > xrange_value(const char *fmt,...) const
octave_idx_type end_index(octave_idx_type index_position, octave_idx_type num_indices) const
octave_value(const octave_map &m)
MatrixType matrix_type() const
Definition ov.h:581
octave_value(const int32NDArray &inda)
octave_value(const Array< octave_int64 > &inda)
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition ov.h:1429
octave_value(const int8NDArray &inda)
octave_value ipermute(const Array< int > &vec) const
Definition ov.h:575
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
octave_value(const octave_int8 &i)
octave_value as_int16() const
Definition ov.h:447
Array< Complex > xcomplex_vector_value(const char *fmt,...) const
int type_id() const
Definition ov.h:1356
PermMatrix xperm_matrix_value(const char *fmt,...) const
octave_value(const octave_int64 &i)
octave_base_value * find_parent_class(const std::string &parent_class_name)
Definition ov.h:1017
ComplexMatrix xcomplex_matrix_value(const char *fmt,...) const
compound_binary_op
Definition ov.h:117
@ op_herm_ldiv
Definition ov.h:124
@ op_el_not_or
Definition ov.h:126
@ op_el_not_and
Definition ov.h:125
@ op_el_and_not
Definition ov.h:127
@ op_mul_trans
Definition ov.h:120
@ num_compound_binary_ops
Definition ov.h:129
@ op_mul_herm
Definition ov.h:122
@ op_trans_ldiv
Definition ov.h:123
@ op_el_or_not
Definition ov.h:128
@ op_herm_mul
Definition ov.h:121
@ op_trans_mul
Definition ov.h:119
bool xbool_value(const char *fmt,...) const
FloatComplexRowVector float_complex_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_complex_scalar() const
Definition ov.h:614
bool is_range() const
Definition ov.h:644
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
Definition ov.h:882
bool is_copy_of(const octave_value &val) const
Definition ov.h:1374
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, std::size_t skip=1)
Array< FloatComplex > float_complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_mex_function() const
Definition ov.h:793
string_vector parent_class_names() const
Definition ov.h:1013
octave_int16 xint16_scalar_value(const char *fmt,...) const
octave_value as_single() const
Definition ov.h:444
FloatRowVector float_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_single_type() const
Definition ov.h:696
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
Definition ov.h:1350
FloatComplexMatrix xfloat_complex_matrix_value(const char *fmt,...) const
FloatComplexRowVector xfloat_complex_row_vector_value(const char *fmt,...) const
octave_value(const SparseMatrix &m, const MatrixType &t=MatrixType())
bool is_dld_function() const
Definition ov.h:790
uint64NDArray xuint64_array_value(const char *fmt,...) const
bool is_defined() const
Definition ov.h:590
double xdouble_value(const char *fmt,...) const
bool save_binary(std::ostream &os, bool save_as_floats)
Definition ov.h:1383
charNDArray char_array_value(bool frc_str_conv=false) const
Definition ov.h:904
void make_storable_value()
bool isempty() const
Definition ov.h:599
octave_uint32 uint32_scalar_value() const
Definition ov.h:951
octave_base_value * try_narrowing_conversion()
Definition ov.h:456
FloatColumnVector float_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_legacy_object() const
Definition ov.h:596
bool save_ascii(std::ostream &os)
Definition ov.h:1379
Array< int > xint_vector_value(const char *fmt,...) const
string_vector map_keys() const
Definition ov.h:1001
float float_scalar_value(bool frc_str_conv=false) const
Definition ov.h:854
bool is_function() const
Definition ov.h:775
FloatComplex float_complex_value(bool frc_str_conv=false) const
Definition ov.h:872
void break_closure_cycles(const std::shared_ptr< octave::stack_frame > &)
bool is_equal(const octave_value &) const
std::size_t nparents() const
Definition ov.h:1007
octave_idx_type xnumel(const octave_value_list &idx)
Definition ov.h:465
@ op_pow_eq
Definition ov.h:141
@ op_asn_eq
Definition ov.h:135
@ op_add_eq
Definition ov.h:136
@ op_el_pow_eq
Definition ov.h:145
@ op_mul_eq
Definition ov.h:138
@ op_div_eq
Definition ov.h:139
@ op_el_and_eq
Definition ov.h:146
@ op_el_ldiv_eq
Definition ov.h:144
@ op_sub_eq
Definition ov.h:137
@ op_el_mul_eq
Definition ov.h:142
@ op_el_or_eq
Definition ov.h:147
@ op_el_div_eq
Definition ov.h:143
@ num_assign_ops
Definition ov.h:148
@ op_ldiv_eq
Definition ov.h:140
octave_value storable_value() const
bool is_uint8_type() const
Definition ov.h:716
bool is_uint64_type() const
Definition ov.h:725
float_display_format get_edit_display_format() const
octave_base_value::type_conv_info numeric_demotion_function() const
Definition ov.h:424
octave_value as_uint32() const
Definition ov.h:453
int64_t xint64_value(const char *fmt,...) const
bool is_zero_by_zero() const
Definition ov.h:554
octave_user_function * xuser_function_value(const char *fmt,...) const
bool is_uint16_type() const
Definition ov.h:719
uint64NDArray uint64_array_value() const
Definition ov.h:978
charMatrix xchar_matrix_value(const char *fmt,...) const
octave_value & non_const_unary_op(unary_op op)
short int xshort_value(const char *fmt,...) const
float float_value(bool frc_str_conv=false) const
Definition ov.h:848
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
SparseComplexMatrix xsparse_complex_matrix_value(const char *fmt,...) const
octave_user_script * xuser_script_value(const char *fmt,...) const
ComplexDiagMatrix xcomplex_diag_matrix_value(const char *fmt,...) const
bool is_magic_colon() const
Definition ov.h:671
const void * mex_get_data(mxClassID class_id=mxUNKNOWN_CLASS, mxComplexity complexity=mxREAL) const
FloatNDArray xfloat_array_value(const char *fmt,...) const
unsigned long int ulong_value(bool req_int=false, bool frc_str_conv=false) const
Definition ov.h:828
octave_value any(int dim=0) const
Definition ov.h:685
bool is_int16_type() const
Definition ov.h:707
octave_idx_type nfields() const
Definition ov.h:567
bool issparse() const
Definition ov.h:751
bool is_char_matrix() const
Definition ov.h:626
octave_value(const SparseBoolMatrix &bm, const MatrixType &t=MatrixType())
octave_value reshape(const dim_vector &dv) const
Definition ov.h:569
bool print_as_scalar() const
Definition ov.h:1331
octave_int64 xint64_scalar_value(const char *fmt,...) const
double scalar_value(bool frc_str_conv=false) const
Definition ov.h:851
void maybe_mutate()
bool iscell() const
Definition ov.h:602
FloatComplexColumnVector float_complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_value_list subsref(const std::string &type, const std::list< octave_value_list > &idx, int nargout)
const octave_idx_type * mex_get_ir() const
Definition ov.h:1409
octave_value(const octave::idx_vector &idx, bool lazy=true)
bool is_bool_matrix() const
Definition ov.h:623
ComplexRowVector xcomplex_row_vector_value(const char *fmt,...) const
octave_base_value::type_conv_info numeric_conversion_function() const
Definition ov.h:421
octave_idx_type numel() const
Definition ov.h:557
octave_value next_subsref(bool auto_add, const std::string &type, const std::list< octave_value_list > &idx, std::size_t skip=1)
bool load_ascii(std::istream &is)
octave_map map_value() const
void convert_to_row_or_column_vector()
Definition ov.h:1328
Array< int > int_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_real_matrix() const
Definition ov.h:611
boolMatrix bool_matrix_value(bool warn=false) const
Definition ov.h:895
bool isnull() const
Definition ov.h:677
octave_idx_type nnz() const
Definition ov.h:563
Array< float > xfloat_vector_value(const char *fmt,...) const
octave_value fast_elem_extract(octave_idx_type n) const
Extract the n-th element, aka 'val(n)'.
Definition ov.h:1537
octave_value(const Array< octave_uint16 > &inda)
octave_value(const SparseComplexMatrix &m, const MatrixType &t=MatrixType())
Array< Complex > complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
magic_colon
Definition ov.h:170
std::string string_value(bool force=false) const
Definition ov.h:981
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
octave_value(const octave_scalar_map &m, const std::string &id, const std::list< std::string > &plist)
ComplexDiagMatrix complex_diag_matrix_value(bool force=false) const
Definition ov.h:923
octave_uint8 uint8_scalar_value() const
Definition ov.h:945
int nint_value(bool frc_str_conv=false) const
Definition ov.h:820
octave_value(const Array< char > &chnda, char type='\'')
bool is_int64_type() const
Definition ov.h:713
octave_uint8 xuint8_scalar_value(const char *fmt,...) const
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
Definition ov.h:860
octave_scalar_map xscalar_map_value(const char *fmt,...) const
bool islocked() const
Definition ov.h:1448
void print_info(std::ostream &os, const std::string &prefix="") const
octave_idx_type xidx_type_value(const char *fmt,...) const
bool is_matrix_type() const
Definition ov.h:745
bool iscomplex() const
Definition ov.h:739
octave_value map(octave_base_value::unary_mapper_t umap) const
Definition ov.h:1526
octave_int16 int16_scalar_value() const
Definition ov.h:936
Array< double > xvector_value(const char *fmt,...) const
octave_base_value * clone() const
charNDArray xchar_array_value(const char *fmt,...) const
octave_value(const octave_uint8 &i)
Array< octave_idx_type > xoctave_idx_type_vector_value(const char *fmt,...) const
octave_value(const Array< octave_int32 > &inda)
long int long_value(bool req_int=false, bool frc_str_conv=false) const
Definition ov.h:824
ComplexNDArray xcomplex_array_value(const char *fmt,...) const
binary_op
Definition ov.h:92
@ op_ldiv
Definition ov.h:98
@ op_ne
Definition ov.h:104
@ op_el_or
Definition ov.h:110
@ op_el_ldiv
Definition ov.h:108
@ op_pow
Definition ov.h:97
@ op_ge
Definition ov.h:102
@ num_binary_ops
Definition ov.h:112
@ op_div
Definition ov.h:96
@ op_el_pow
Definition ov.h:107
@ op_mul
Definition ov.h:95
@ op_add
Definition ov.h:93
@ op_sub
Definition ov.h:94
@ op_el_mul
Definition ov.h:105
@ op_le
Definition ov.h:100
@ op_struct_ref
Definition ov.h:111
@ op_lt
Definition ov.h:99
@ op_gt
Definition ov.h:103
@ op_eq
Definition ov.h:101
@ op_el_and
Definition ov.h:109
@ op_el_div
Definition ov.h:106
string_vector string_vector_value(bool pad=false) const
Definition ov.h:984
octave_value(const Array< octave_int16 > &inda)
ComplexColumnVector xcomplex_column_vector_value(const char *fmt,...) const
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Definition ov.h:1441
mxArray * as_mxArray(bool interleaved=false) const
Definition ov.h:1420
bool is_user_function() const
Definition ov.h:781
octave_uint64 xuint64_scalar_value(const char *fmt,...) const
octave_value single_subsref(const std::string &type, const octave_value_list &idx)
bool is_anonymous_function() const
Definition ov.h:769
octave_fcn_handle * fcn_handle_value(bool silent=false) const
ComplexColumnVector complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_package() const
Definition ov.h:659
octave_value(const Array< octave_idx_type > &inda, bool zero_based=false, bool cache_index=false)
octave_uint32 xuint32_scalar_value(const char *fmt,...) const
int64NDArray int64_array_value() const
Definition ov.h:966
octave_idx_type get_count() const
Definition ov.h:419
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
Definition ov.h:914
NDArray array_value(bool frc_str_conv=false) const
Definition ov.h:863
FloatComplex xfloat_complex_value(const char *fmt,...) const
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_value(const uint64NDArray &inda)
int write(octave::stream &os, int block_size, oct_data_conv::data_type output_type, int skip, octave::mach_info::float_format flt_fmt) const
uint16NDArray xuint16_array_value(const char *fmt,...) const
bool strict_bool_value() const
Definition ov.h:892
octave_idx_type length() const
octave_value(const std::map< std::string, octave_value > &)
octave_value as_uint16() const
Definition ov.h:452
bool is_double_type() const
Definition ov.h:693
octave_value as_int64() const
Definition ov.h:449
bool is_builtin_function() const
Definition ov.h:787
bool is_int32_type() const
Definition ov.h:710
bool is_bool_scalar() const
Definition ov.h:620
octave_value(const octave_value_list &m)
octave_value(const Sparse< double > &m, const MatrixType &t=MatrixType())
FloatRowVector xfloat_row_vector_value(const char *fmt,...) const
octave_value(const octave_uint32 &i)
bool is_classdef_superclass_ref() const
Definition ov.h:656
bool is_cs_list() const
Definition ov.h:668
octave_value as_double() const
Definition ov.h:443
Array< octave_idx_type > octave_idx_type_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
Definition ov.h:1320
uint8NDArray uint8_array_value() const
Definition ov.h:969
bool print_name_tag(std::ostream &os, const std::string &name) const
Definition ov.h:1340
octave_value full_value() const
Definition ov.h:433
octave_uint16 xuint16_scalar_value(const char *fmt,...) const
sortmode issorted(sortmode mode=UNSORTED) const
Definition ov.h:1435
octave_user_function * user_function_value(bool silent=false) const
Array< FloatComplex > xfloat_complex_vector_value(const char *fmt,...) const
std::string type_name() const
Definition ov.h:1358
long int xlong_value(const char *fmt,...) const
octave_value all(int dim=0) const
Definition ov.h:682
bool is_user_code() const
Definition ov.h:784
std::list< std::string > parent_class_name_list() const
Definition ov.h:1010
octave_base_value * m_rep
The real representation.
Definition ov.h:1558
int xint_value(const char *fmt,...) const
std::string xstring_value(const char *fmt,...) const
uint64_t xuint64_value(const char *fmt,...) const
FloatComplexColumnVector xfloat_complex_column_vector_value(const char *fmt,...) const
FloatDiagMatrix xfloat_diag_matrix_value(const char *fmt,...) const
int strict_int_value(const char *fmt,...) const
boolNDArray xbool_array_value(const char *fmt,...) const
octave_int32 int32_scalar_value() const
Definition ov.h:939
std::size_t byte_size() const
Definition ov.h:560
octave_fcn_handle * xfcn_handle_value(const char *fmt,...) const
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
Definition ov.h:886
octave_value(const octave_int32 &i)
octave_function * xfunction_value(const char *fmt,...) const
ColumnVector column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
int32NDArray xint32_array_value(const char *fmt,...) const
octave_user_code * xuser_code_value(const char *fmt,...) const
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition ov.h:578
~octave_value()
Definition ov.h:340
float xfloat_value(const char *fmt,...) const
DiagMatrix xdiag_matrix_value(const char *fmt,...) const
bool iscellstr() const
Definition ov.h:605
FloatNDArray float_array_value(bool frc_str_conv=false) const
Definition ov.h:866
bool isstruct() const
Definition ov.h:647
octave_value(const octave_value &a)
Definition ov.h:319
Matrix xmatrix_value(const char *fmt,...) const
octave_user_code * user_code_value(bool silent=false) const
NDArray xarray_value(const char *fmt,...) const
uint32NDArray uint32_array_value() const
Definition ov.h:975
RowVector row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
MatrixType matrix_type(const MatrixType &typ) const
Definition ov.h:584
FloatColumnVector xfloat_column_vector_value(const char *fmt,...) const
octave_value(const int64NDArray &inda)
bool is_complex_matrix() const
Definition ov.h:617
octave_value(const Array< std::string > &cellstr)
octave_value(const octave_scalar_map &m)
octave_idx_type columns() const
Definition ov.h:545
octave_value(const uint16NDArray &inda)
Matrix matrix_value(bool frc_str_conv=false) const
Definition ov.h:857
octave_value(const Array< octave_int8 > &inda)
octave_value(const charNDArray &chnda, char type='\'')
builtin_type_t builtin_type() const
Definition ov.h:688
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
Definition ov.h:879
void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition ov.h:1334
octave_base_value * empty_clone() const
Definition ov.h:335
octave_value diag(octave_idx_type k=0) const
Definition ov.h:1423
octave_value(const Array< octave_uint32 > &inda)
octave::range< double > range_value() const
Definition ov.h:992
double double_value(bool frc_str_conv=false) const
Definition ov.h:845
unsigned int uint_value(bool req_int=false, bool frc_str_conv=false) const
Definition ov.h:817
boolMatrix xbool_matrix_value(const char *fmt,...) const
PermMatrix perm_matrix_value() const
Definition ov.h:930
octave_base_value * internal_rep() const
Definition ov.h:1400
unsigned int xuint_value(const char *fmt,...) const
octave_value(const int16NDArray &inda)
octave_value as_double_or_copy() const
Definition ov.h:440
bool isobject() const
Definition ov.h:662
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
Definition ov.h:911
bool islogical() const
Definition ov.h:733
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
unsigned short int xushort_value(const char *fmt,...) const
octave_value(const string_vector &s, char type='\'')
dim_vector dims() const
Definition ov.h:539
void unlock()
Definition ov.h:1446
uint8NDArray xuint8_array_value(const char *fmt,...) const
octave_value(const Array< octave_uint64 > &inda)
octave_value squeeze() const
Definition ov.h:429
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
function gamma(x)
Definition gamma.f:3
Complex log2(const Complex &x)
Definition mappers.cc:140
Complex asin(const Complex &x)
Definition mappers.cc:106
bool isna(double x)
Definition mappers.cc:46
Complex acos(const Complex &x)
Definition mappers.cc:84
std::complex< T > ceil(const std::complex< T > &x)
Definition mappers.h:115
Complex atan(const Complex &x)
Definition mappers.h:83
double roundb(double x)
Definition mappers.h:159
std::complex< T > floor(const std::complex< T > &x)
Definition mappers.h:142
bool isfinite(double x)
Definition mappers.h:229
bool isinf(double x)
Definition mappers.h:212
double signum(double x)
Definition mappers.h:255
double round(double x)
Definition mappers.h:148
bool isnan(bool)
Definition mappers.h:192
double fix(double x)
Definition mappers.h:130
std::complex< double > Complex
Definition oct-cmplx.h:33
std::complex< float > FloatComplex
Definition oct-cmplx.h:34
int64_t octave_hdf5_id
sortmode
Definition oct-sort.h:97
@ UNSORTED
Definition oct-sort.h:97
@ ASCENDING
Definition oct-sort.h:97
double erfinv(double x)
double erfi(double x)
double dawson(double x)
Complex erf(const Complex &x)
double erfcinv(double x)
double erfcx(double x)
Complex expm1(const Complex &x)
Complex log1p(const Complex &x)
Complex erfc(const Complex &x)
double cbrt(double x)
double asinh(double x)
Definition oct-specfun.h:57
double atanh(double x)
Definition oct-specfun.h:62
double acosh(double x)
Definition oct-specfun.h:39
double lgamma(double x)
const octave_base_value const Array< octave_idx_type > & ra_idx
builtin_type_t
Definition ov-base.h:83
octave_value op_ne(const octave_value &a1, const octave_value &a2)
Definition ov.h:1689
octave_value op_el_ldiv(const octave_value &a1, const octave_value &a2)
Definition ov.h:1694
octave_value op_uplus(const octave_value &a)
Definition ov.h:1647
octave_value op_add(const octave_value &a1, const octave_value &a2)
Definition ov.h:1676
octave_value op_gt(const octave_value &a1, const octave_value &a2)
Definition ov.h:1688
octave_value op_uminus(const octave_value &a)
Definition ov.h:1648
octave_value op_el_div(const octave_value &a1, const octave_value &a2)
Definition ov.h:1692
#define DEF_DUMMY_VALUE_EXTRACTOR(VALUE, DEFVAL)
Definition ov.h:1793
octave_value op_mul_herm(const octave_value &a1, const octave_value &a2)
Definition ov.h:1710
octave_value op_transpose(const octave_value &a)
Definition ov.h:1650
octave_value op_el_or(const octave_value &a1, const octave_value &a2)
Definition ov.h:1696
octave_value op_sub(const octave_value &a1, const octave_value &a2)
Definition ov.h:1677
octave_value op_mul(const octave_value &a1, const octave_value &a2)
Definition ov.h:1678
octave_value colon_op(const octave_value &base, const octave_value &increment, const octave_value &limit, bool is_for_cmd_expr=false)
void install_types(octave::type_info &)
octave_value op_hermitian(const octave_value &a)
Definition ov.h:1651
#define OV_COMP_BINOP_FN(name)
Definition ov.h:1700
octave_value op_le(const octave_value &a1, const octave_value &a2)
Definition ov.h:1685
octave_value op_el_and(const octave_value &a1, const octave_value &a2)
Definition ov.h:1695
octave_value cat_op(type_info &ti, const octave_value &a, const octave_value &b, const Array< octave_idx_type > &ra_idx)
octave_value binary_op(type_info &ti, octave_value::binary_op op, const octave_value &a, const octave_value &b)
octave_value op_herm_mul(const octave_value &a1, const octave_value &a2)
Definition ov.h:1709
#define MAPPER_FORWARD(F)
Definition ov.h:1454
octave_value op_eq(const octave_value &a1, const octave_value &a2)
Definition ov.h:1686
octave_value op_el_pow(const octave_value &a1, const octave_value &a2)
Definition ov.h:1693
#define OV_UNOP_FN_OP(name, op)
Definition ov.h:1642
#define DEF_VALUE_EXTRACTOR(VALUE, MPREFIX)
Definition ov.h:1725
octave_value op_struct_ref(const octave_value &a1, const octave_value &a2)
Definition ov.h:1698
octave_value op_not(const octave_value &a)
Definition ov.h:1646
#define OV_BINOP_FN(name)
Definition ov.h:1658
octave_value op_ldiv(const octave_value &a1, const octave_value &a2)
Definition ov.h:1682
#define OV_UNOP_FN(name)
Definition ov.h:1628
Value octave_value_extract(const octave_value &)
Definition ov.h:1717
octave_value unary_op(type_info &ti, octave_value::unary_op op, const octave_value &a)
octave_value op_pow(const octave_value &a1, const octave_value &a2)
Definition ov.h:1681
octave_value op_ge(const octave_value &a1, const octave_value &a2)
Definition ov.h:1687
octave_value op_el_mul(const octave_value &a1, const octave_value &a2)
Definition ov.h:1691
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition ov.h:1679
octave_value op_trans_mul(const octave_value &a1, const octave_value &a2)
Definition ov.h:1707
octave_value op_mul_trans(const octave_value &a1, const octave_value &a2)
Definition ov.h:1708
#define OV_BINOP_FN_OP(name, op)
Definition ov.h:1672
octave_value op_lt(const octave_value &a1, const octave_value &a2)
Definition ov.h:1684
#define panic_impossible()
Definition panic.h:54
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE * x