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