GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2024 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 "data-conv.h"
40 #include "idx-vector.h"
41 #include "mach-info.h"
42 #include "mx-base.h"
43 #include "oct-sort.h"
44 #include "oct-time.h"
45 #include "str-vec.h"
46 
48 
49 class stack_frame;
50 class type_info;
51 class scope_stack_frame;
52 class base_value_stack_frame;
53 
54 OCTAVE_END_NAMESPACE(octave)
55 
56 class Cell;
57 class float_format;
58 class mxArray;
59 class octave_map;
60 class octave_scalar_map;
61 class octave_function;
63 class octave_fcn_handle;
64 class octave_value_list;
65 class octave_fcn_cache;
66 
67 #include "mxtypes.h"
68 
69 #include "oct-stream.h"
70 #include "ov-base.h"
71 
72 class
73 OCTINTERP_API
75 {
76 public:
77 
78  enum unary_op
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 
91  enum binary_op
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 
117  {
118  // ** compound operations **
130  unknown_compound_binary_op
131  };
132 
134  {
149  unknown_assign_op
150  };
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 
352  void make_unique ()
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 
459  { return m_rep->try_narrowing_conversion (); }
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 
571  octave_value reshape (const dim_vector& dv) const
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 
577  octave_value ipermute (const Array<int>& vec) const
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 
586  MatrixType matrix_type (const MatrixType& typ) const
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 
771  bool is_anonymous_function () const
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 
789  bool is_builtin_function () const
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  unsigned int
816  uint_value (bool req_int = false, bool frc_str_conv = false) const
817  { return m_rep->uint_value (req_int, frc_str_conv); }
818 
819  int nint_value (bool frc_str_conv = false) const
820  { return m_rep->nint_value (frc_str_conv); }
821 
822  long int
823  long_value (bool req_int = false, bool frc_str_conv = false) const
824  { return m_rep->long_value (req_int, frc_str_conv); }
825 
826  unsigned long int
827  ulong_value (bool req_int = false, bool frc_str_conv = false) const
828  { return m_rep->ulong_value (req_int, frc_str_conv); }
829 
830  int64_t
831  int64_value (bool req_int = false, bool frc_str_conv = false) const
832  { return m_rep->int64_value (req_int, frc_str_conv); }
833 
834  uint64_t
835  uint64_value (bool req_int = false, bool frc_str_conv = false) const
836  { return m_rep->uint64_value (req_int, frc_str_conv); }
837 
839  idx_type_value (bool req_int = false, bool frc_str_conv = false) const;
840 
841  double double_value (bool frc_str_conv = false) const
842  { return m_rep->double_value (frc_str_conv); }
843 
844  float float_value (bool frc_str_conv = false) const
845  { return m_rep->float_value (frc_str_conv); }
846 
847  double scalar_value (bool frc_str_conv = false) const
848  { return m_rep->scalar_value (frc_str_conv); }
849 
850  float float_scalar_value (bool frc_str_conv = false) const
851  { return m_rep->float_scalar_value (frc_str_conv); }
852 
853  Matrix matrix_value (bool frc_str_conv = false) const
854  { return m_rep->matrix_value (frc_str_conv); }
855 
856  FloatMatrix float_matrix_value (bool frc_str_conv = false) const
857  { return m_rep->float_matrix_value (frc_str_conv); }
858 
859  NDArray array_value (bool frc_str_conv = false) const
860  { return m_rep->array_value (frc_str_conv); }
861 
862  FloatNDArray float_array_value (bool frc_str_conv = false) const
863  { return m_rep->float_array_value (frc_str_conv); }
864 
865  Complex complex_value (bool frc_str_conv = false) const
866  { return m_rep->complex_value (frc_str_conv); }
867 
868  FloatComplex float_complex_value (bool frc_str_conv = false) const
869  { return m_rep->float_complex_value (frc_str_conv); }
870 
871  ComplexMatrix complex_matrix_value (bool frc_str_conv = false) const
872  { return m_rep->complex_matrix_value (frc_str_conv); }
873 
875  float_complex_matrix_value (bool frc_str_conv = false) const
876  { return m_rep->float_complex_matrix_value (frc_str_conv); }
877 
878  ComplexNDArray complex_array_value (bool frc_str_conv = false) const
879  { return m_rep->complex_array_value (frc_str_conv); }
880 
882  float_complex_array_value (bool frc_str_conv = false) const
883  { return m_rep->float_complex_array_value (frc_str_conv); }
884 
885  bool bool_value (bool warn = false) const
886  { return m_rep->bool_value (warn); }
887 
888  boolMatrix bool_matrix_value (bool warn = false) const
889  { return m_rep->bool_matrix_value (warn); }
890 
891  boolNDArray bool_array_value (bool warn = false) const
892  { return m_rep->bool_array_value (warn); }
893 
894  charMatrix char_matrix_value (bool frc_str_conv = false) const
895  { return m_rep->char_matrix_value (frc_str_conv); }
896 
897  charNDArray char_array_value (bool frc_str_conv = false) const
898  { return m_rep->char_array_value (frc_str_conv); }
899 
900  SparseMatrix sparse_matrix_value (bool frc_str_conv = false) const
901  { return m_rep->sparse_matrix_value (frc_str_conv); }
902 
904  sparse_complex_matrix_value (bool frc_str_conv = false) const
905  { return m_rep->sparse_complex_matrix_value (frc_str_conv); }
906 
907  SparseBoolMatrix sparse_bool_matrix_value (bool warn = false) const
908  { return m_rep->sparse_bool_matrix_value (warn); }
909 
910  DiagMatrix diag_matrix_value (bool force = false) const
911  { return m_rep->diag_matrix_value (force); }
912 
913  FloatDiagMatrix float_diag_matrix_value (bool force = false) const
914  { return m_rep->float_diag_matrix_value (force); }
915 
916  ComplexDiagMatrix complex_diag_matrix_value (bool force = false) const
917  { return m_rep->complex_diag_matrix_value (force); }
918 
920  float_complex_diag_matrix_value (bool force = false) const
921  { return m_rep->float_complex_diag_matrix_value (force); }
922 
924  { return m_rep->perm_matrix_value (); }
925 
927  { return m_rep->int8_scalar_value (); }
928 
930  { return m_rep->int16_scalar_value (); }
931 
933  { return m_rep->int32_scalar_value (); }
934 
936  { return m_rep->int64_scalar_value (); }
937 
939  { return m_rep->uint8_scalar_value (); }
940 
942  { return m_rep->uint16_scalar_value (); }
943 
945  { return m_rep->uint32_scalar_value (); }
946 
948  { return m_rep->uint64_scalar_value (); }
949 
951  { return m_rep->int8_array_value (); }
952 
954  { return m_rep->int16_array_value (); }
955 
957  { return m_rep->int32_array_value (); }
958 
960  { return m_rep->int64_array_value (); }
961 
963  { return m_rep->uint8_array_value (); }
964 
966  { return m_rep->uint16_array_value (); }
967 
969  { return m_rep->uint32_array_value (); }
970 
972  { return m_rep->uint64_array_value (); }
973 
974  std::string string_value (bool force = false) const
975  { return m_rep->string_value (force); }
976 
977  string_vector string_vector_value (bool pad = false) const
978  { return m_rep->string_vector_value (pad); }
979 
980  Cell cell_value () const;
981 
983  { return m_rep->cellstr_value (); }
984 
985  octave::range<double> range_value () const
986  { return m_rep->range_value (); }
987 
988  // For now, enable only range<double>.
989 
990  OCTINTERP_API octave_map map_value () const;
991 
992  OCTINTERP_API octave_scalar_map scalar_map_value () const;
993 
995  { return m_rep->map_keys (); }
996 
997  bool isfield (const std::string& field_name) const
998  { return m_rep->isfield (field_name); }
999 
1000  std::size_t nparents () const
1001  { return m_rep->nparents (); }
1002 
1003  std::list<std::string> parent_class_name_list () const
1004  { return m_rep->parent_class_name_list (); }
1005 
1007  { return m_rep->parent_class_names (); }
1008 
1010  find_parent_class (const std::string& parent_class_name)
1011  { return m_rep->find_parent_class (parent_class_name); }
1012 
1013  bool is_instance_of (const std::string& cls_name) const
1014  { return m_rep->is_instance_of (cls_name); }
1015 
1016  OCTINTERP_API octave_classdef *
1017  classdef_object_value (bool silent = false) const;
1018 
1019  OCTINTERP_API octave_function *
1020  function_value (bool silent = false) const;
1021 
1022  OCTINTERP_API octave_user_function *
1023  user_function_value (bool silent = false) const;
1024 
1025  OCTINTERP_API octave_user_script *
1026  user_script_value (bool silent = false) const;
1027 
1028  OCTINTERP_API octave_user_code * user_code_value (bool silent = false) const;
1029 
1030  OCTINTERP_API octave_fcn_handle *
1031  fcn_handle_value (bool silent = false) const;
1032 
1033  OCTINTERP_API octave_value_list list_value () const;
1034 
1035  OCTINTERP_API ColumnVector
1036  column_vector_value (bool frc_str_conv = false,
1037  bool frc_vec_conv = false) const;
1038 
1039  OCTINTERP_API ComplexColumnVector
1040  complex_column_vector_value (bool frc_str_conv = false,
1041  bool frc_vec_conv = false) const;
1042 
1043  OCTINTERP_API RowVector
1044  row_vector_value (bool frc_str_conv = false,
1045  bool frc_vec_conv = false) const;
1046 
1047  OCTINTERP_API ComplexRowVector
1048  complex_row_vector_value (bool frc_str_conv = false,
1049  bool frc_vec_conv = false) const;
1050 
1051  OCTINTERP_API FloatColumnVector
1052  float_column_vector_value (bool frc_str_conv = false,
1053  bool frc_vec_conv = false) const;
1054 
1055  OCTINTERP_API FloatComplexColumnVector
1056  float_complex_column_vector_value (bool frc_str_conv = false,
1057  bool frc_vec_conv = false) const;
1058 
1059  OCTINTERP_API FloatRowVector
1060  float_row_vector_value (bool frc_str_conv = false,
1061  bool frc_vec_conv = false) const;
1062 
1063  OCTINTERP_API FloatComplexRowVector
1064  float_complex_row_vector_value (bool frc_str_conv = false,
1065  bool frc_vec_conv = false) const;
1066 
1067  OCTINTERP_API Array<int>
1068  int_vector_value (bool req_int = false,
1069  bool frc_str_conv = false,
1070  bool frc_vec_conv = false) const;
1071 
1072  OCTINTERP_API Array<octave_idx_type>
1073  octave_idx_type_vector_value (bool req_int = false,
1074  bool frc_str_conv = false,
1075  bool frc_vec_conv = false) const;
1076 
1077  OCTINTERP_API Array<double>
1078  vector_value (bool frc_str_conv = false,
1079  bool frc_vec_conv = false) const;
1080 
1081  OCTINTERP_API Array<Complex>
1082  complex_vector_value (bool frc_str_conv = false,
1083  bool frc_vec_conv = false) const;
1084 
1085  OCTINTERP_API Array<float>
1086  float_vector_value (bool frc_str_conv = false,
1087  bool frc_vec_conv = false) const;
1088 
1089  OCTINTERP_API Array<FloatComplex>
1090  float_complex_vector_value (bool frc_str_conv = false,
1091  bool frc_vec_conv = false) const;
1092 
1093  // Extract values of specific types without any implicit type conversions.
1094  // Throw an error if an object is the wrong type for the requested value
1095  // extraction.
1096  //
1097  // These functions are intended to provide a simple way to extract values of
1098  // specific types and display error messages that are more meaningful than
1099  // the generic "error: wrong type argument 'cell'" message.
1100 
1101  OCTINTERP_API short int xshort_value (const char *fmt, ...) const;
1102 
1103  OCTINTERP_API unsigned short int xushort_value (const char *fmt, ...) const;
1104 
1105  OCTINTERP_API int xint_value (const char *fmt, ...) const;
1106 
1107  OCTINTERP_API unsigned int xuint_value (const char *fmt, ...) const;
1108 
1109  OCTINTERP_API int xnint_value (const char *fmt, ...) const;
1110 
1111  OCTINTERP_API long int xlong_value (const char *fmt, ...) const;
1112 
1113  OCTINTERP_API unsigned long int xulong_value (const char *fmt, ...) const;
1114 
1115  OCTINTERP_API int64_t xint64_value (const char *fmt, ...) const;
1116 
1117  OCTINTERP_API uint64_t xuint64_value (const char *fmt, ...) const;
1118 
1119  OCTINTERP_API octave_idx_type xidx_type_value (const char *fmt, ...) const;
1120 
1121  OCTINTERP_API double xdouble_value (const char *fmt, ...) const;
1122 
1123  OCTINTERP_API float xfloat_value (const char *fmt, ...) const;
1124 
1125  OCTINTERP_API double xscalar_value (const char *fmt, ...) const;
1126 
1127  OCTINTERP_API float xfloat_scalar_value (const char *fmt, ...) const;
1128 
1129  OCTINTERP_API Matrix xmatrix_value (const char *fmt, ...) const;
1130 
1131  OCTINTERP_API FloatMatrix xfloat_matrix_value (const char *fmt, ...) const;
1132 
1133  OCTINTERP_API NDArray xarray_value (const char *fmt, ...) const;
1134 
1135  OCTINTERP_API FloatNDArray xfloat_array_value (const char *fmt, ...) const;
1136 
1137  OCTINTERP_API Complex xcomplex_value (const char *fmt, ...) const;
1138 
1139  OCTINTERP_API FloatComplex xfloat_complex_value (const char *fmt, ...) const;
1140 
1141  OCTINTERP_API ComplexMatrix
1142  xcomplex_matrix_value (const char *fmt, ...) const;
1143 
1144  OCTINTERP_API FloatComplexMatrix
1145  xfloat_complex_matrix_value (const char *fmt, ...) const;
1146 
1147  OCTINTERP_API ComplexNDArray
1148  xcomplex_array_value (const char *fmt, ...) const;
1149 
1150  OCTINTERP_API FloatComplexNDArray
1151  xfloat_complex_array_value (const char *fmt, ...) const;
1152 
1153  OCTINTERP_API bool xbool_value (const char *fmt, ...) const;
1154 
1155  OCTINTERP_API boolMatrix xbool_matrix_value (const char *fmt, ...) const;
1156 
1157  OCTINTERP_API boolNDArray xbool_array_value (const char *fmt, ...) const;
1158 
1159  OCTINTERP_API charMatrix xchar_matrix_value (const char *fmt, ...) const;
1160 
1161  OCTINTERP_API charNDArray xchar_array_value (const char *fmt, ...) const;
1162 
1163  OCTINTERP_API SparseMatrix xsparse_matrix_value (const char *fmt, ...) const;
1164 
1165  OCTINTERP_API SparseComplexMatrix
1166  xsparse_complex_matrix_value (const char *fmt, ...) const;
1167 
1168  OCTINTERP_API SparseBoolMatrix
1169  xsparse_bool_matrix_value (const char *fmt, ...) const;
1170 
1171  OCTINTERP_API DiagMatrix xdiag_matrix_value (const char *fmt, ...) const;
1172 
1173  OCTINTERP_API FloatDiagMatrix
1174  xfloat_diag_matrix_value (const char *fmt, ...) const;
1175 
1176  OCTINTERP_API ComplexDiagMatrix
1177  xcomplex_diag_matrix_value (const char *fmt, ...) const;
1178 
1179  OCTINTERP_API FloatComplexDiagMatrix
1180  xfloat_complex_diag_matrix_value (const char *fmt, ...) const;
1181 
1182  OCTINTERP_API PermMatrix xperm_matrix_value (const char *fmt, ...) const;
1183 
1184  OCTINTERP_API octave_int8 xint8_scalar_value (const char *fmt, ...) const;
1185 
1186  OCTINTERP_API octave_int16 xint16_scalar_value (const char *fmt, ...) const;
1187 
1188  OCTINTERP_API octave_int32 xint32_scalar_value (const char *fmt, ...) const;
1189 
1190  OCTINTERP_API octave_int64 xint64_scalar_value (const char *fmt, ...) const;
1191 
1192  OCTINTERP_API octave_uint8 xuint8_scalar_value (const char *fmt, ...) const;
1193 
1194  OCTINTERP_API octave_uint16 xuint16_scalar_value (const char *fmt, ...) const;
1195 
1196  OCTINTERP_API octave_uint32 xuint32_scalar_value (const char *fmt, ...) const;
1197 
1198  OCTINTERP_API octave_uint64 xuint64_scalar_value (const char *fmt, ...) const;
1199 
1200  OCTINTERP_API int8NDArray xint8_array_value (const char *fmt, ...) const;
1201 
1202  OCTINTERP_API int16NDArray xint16_array_value (const char *fmt, ...) const;
1203 
1204  OCTINTERP_API int32NDArray xint32_array_value (const char *fmt, ...) const;
1205 
1206  OCTINTERP_API int64NDArray xint64_array_value (const char *fmt, ...) const;
1207 
1208  OCTINTERP_API uint8NDArray xuint8_array_value (const char *fmt, ...) const;
1209 
1210  OCTINTERP_API uint16NDArray xuint16_array_value (const char *fmt, ...) const;
1211 
1212  OCTINTERP_API uint32NDArray xuint32_array_value (const char *fmt, ...) const;
1213 
1214  OCTINTERP_API uint64NDArray xuint64_array_value (const char *fmt, ...) const;
1215 
1216  OCTINTERP_API std::string xstring_value (const char *fmt, ...) const;
1217 
1218  OCTINTERP_API string_vector xstring_vector_value (const char *fmt, ...) const;
1219 
1220  OCTINTERP_API Cell xcell_value (const char *fmt, ...) const;
1221 
1222  OCTINTERP_API Array<std::string> xcellstr_value (const char *fmt, ...) const;
1223 
1224  OCTINTERP_API octave::range<double>
1225  xrange_value (const char *fmt, ...) const;
1226 
1227  // For now, enable only range<double>.
1228 
1229  OCTINTERP_API octave_map xmap_value (const char *fmt, ...) const;
1230 
1231  OCTINTERP_API octave_scalar_map
1232  xscalar_map_value (const char *fmt, ...) const;
1233 
1234  OCTINTERP_API ColumnVector xcolumn_vector_value (const char *fmt, ...) const;
1235 
1236  OCTINTERP_API ComplexColumnVector
1237  xcomplex_column_vector_value (const char *fmt, ...) const;
1238 
1239  OCTINTERP_API RowVector xrow_vector_value (const char *fmt, ...) const;
1240 
1241  OCTINTERP_API ComplexRowVector
1242  xcomplex_row_vector_value (const char *fmt, ...) const;
1243 
1244  OCTINTERP_API FloatColumnVector
1245  xfloat_column_vector_value (const char *fmt, ...) const;
1246 
1247  OCTINTERP_API FloatComplexColumnVector
1248  xfloat_complex_column_vector_value (const char *fmt, ...) const;
1249 
1250  OCTINTERP_API FloatRowVector
1251  xfloat_row_vector_value (const char *fmt, ...) const;
1252 
1253  OCTINTERP_API FloatComplexRowVector
1254  xfloat_complex_row_vector_value (const char *fmt, ...) const;
1255 
1256  OCTINTERP_API Array<int> xint_vector_value (const char *fmt, ...) const;
1257 
1258  OCTINTERP_API Array<octave_idx_type>
1259  xoctave_idx_type_vector_value (const char *fmt, ...) const;
1260 
1261  OCTINTERP_API Array<double> xvector_value (const char *fmt, ...) const;
1262 
1263  OCTINTERP_API Array<Complex>
1264  xcomplex_vector_value (const char *fmt, ...) const;
1265 
1266  OCTINTERP_API Array<float> xfloat_vector_value (const char *fmt, ...) const;
1267 
1268  OCTINTERP_API Array<FloatComplex>
1269  xfloat_complex_vector_value (const char *fmt, ...) const;
1270 
1271  OCTINTERP_API octave_function * xfunction_value (const char *fmt, ...) const;
1272 
1273  OCTINTERP_API octave_user_function *
1274  xuser_function_value (const char *fmt, ...) const;
1275 
1276  OCTINTERP_API octave_user_script *
1277  xuser_script_value (const char *fmt, ...) const;
1278 
1279  OCTINTERP_API octave_user_code *
1280  xuser_code_value (const char *fmt, ...) const;
1281 
1282  OCTINTERP_API octave_fcn_handle *
1283  xfcn_handle_value (const char *fmt, ...) const;
1284 
1285  OCTINTERP_API octave_value_list xlist_value (const char *fmt, ...) const;
1286 
1287  // Possibly economize a lazy-indexed value.
1288 
1290  { m_rep->maybe_economize (); }
1291 
1292  // The following two hook conversions are called on any octave_value prior to
1293  // storing it to a "permanent" location, like a named variable, a cell or a
1294  // struct component, or a return value of a function.
1295 
1296  OCTINTERP_API octave_value storable_value () const;
1297 
1298  // Ditto, but in place, i.e., equivalent to *this = this->storable_value (),
1299  // but possibly more efficient.
1300 
1301  OCTINTERP_API void make_storable_value ();
1302 
1303  // FIXME: These should probably be private.
1304  // Conversions. If a user of this class wants a certain kind of constant,
1305  // he should simply ask for it, and we should convert it if possible.
1306 
1307  octave_value convert_to_str (bool pad = false, bool force = false,
1308  char type = '\'') const
1309  { return m_rep->convert_to_str (pad, force, type); }
1310 
1311  octave_value
1312  convert_to_str_internal (bool pad, bool force, char type) const
1313  { return m_rep->convert_to_str_internal (pad, force, type); }
1314 
1316  { m_rep->convert_to_row_or_column_vector (); }
1317 
1318  bool print_as_scalar () const
1319  { return m_rep->print_as_scalar (); }
1320 
1321  void print (std::ostream& os, bool pr_as_read_syntax = false)
1322  { m_rep->print (os, pr_as_read_syntax); }
1323 
1324  void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const
1325  { m_rep->print_raw (os, pr_as_read_syntax); }
1326 
1327  bool print_name_tag (std::ostream& os, const std::string& name) const
1328  { return m_rep->print_name_tag (os, name); }
1329 
1330  void print_with_name (std::ostream& os, const std::string& name) const
1331  { m_rep->print_with_name (os, name, true); }
1332 
1333  void short_disp (std::ostream& os) const { m_rep->short_disp (os); }
1334 
1336 
1337  std::string edit_display (const float_display_format& fmt,
1338  octave_idx_type i, octave_idx_type j) const
1339  {
1340  return m_rep->edit_display (fmt, i, j);
1341  }
1342 
1343  int type_id () const { return m_rep->type_id (); }
1344 
1345  std::string type_name () const { return m_rep->type_name (); }
1346 
1347  std::string class_name () const { return m_rep->class_name (); }
1348 
1349  // Unary operations that are member functions. There are also some
1350  // non-member functions for unary and binary operations declared
1351  // below, outside of the octave_value class declaration.
1352 
1354 
1355  OCTINTERP_API octave_value&
1356  non_const_unary_op (unary_op op, const std::string& type,
1357  const std::list<octave_value_list>& idx);
1358 
1359  const octave_base_value& get_rep () const { return *m_rep; }
1360 
1361  bool is_copy_of (const octave_value& val) const { return m_rep == val.m_rep; }
1362 
1363  OCTINTERP_API void
1364  print_info (std::ostream& os, const std::string& prefix = "") const;
1365 
1366  bool save_ascii (std::ostream& os) { return m_rep->save_ascii (os); }
1367 
1368  OCTINTERP_API bool load_ascii (std::istream& is);
1369 
1370  bool save_binary (std::ostream& os, bool save_as_floats)
1371  { return m_rep->save_binary (os, save_as_floats); }
1372 
1373  OCTINTERP_API bool load_binary (std::istream& is, bool swap,
1375 
1376  bool save_hdf5 (octave_hdf5_id loc_id, const char *name,
1377  bool save_as_floats)
1378  { return m_rep->save_hdf5 (loc_id, name, save_as_floats); }
1379 
1380  OCTINTERP_API bool load_hdf5 (octave_hdf5_id loc_id, const char *name);
1381 
1382  OCTINTERP_API int
1383  write (octave::stream& os, int block_size,
1384  oct_data_conv::data_type output_type, int skip,
1385  octave::mach_info::float_format flt_fmt) const;
1386 
1387  octave_base_value * internal_rep () const { return m_rep; }
1388 
1389  // These functions exist to support the MEX interface.
1390  // You should not use them anywhere else.
1391 
1392  OCTINTERP_API const void *
1394  mxComplexity complexity = mxREAL) const;
1395 
1396  const octave_idx_type * mex_get_ir () const
1397  {
1398  return m_rep->mex_get_ir ();
1399  }
1400 
1401  const octave_idx_type *
1402  mex_get_jc () const
1403  {
1404  return m_rep->mex_get_jc ();
1405  }
1406 
1407  mxArray * as_mxArray (bool interleaved = false) const
1408  { return m_rep->as_mxArray (interleaved); }
1409 
1411  { return m_rep->diag (k); }
1412 
1414  { return m_rep->diag (m, n); }
1415 
1417  { return m_rep->sort (dim, mode); }
1419  sortmode mode = ASCENDING) const
1420  { return m_rep->sort (sidx, dim, mode); }
1421 
1423  { return m_rep->issorted (mode); }
1424 
1426  { return m_rep->sort_rows_idx (mode); }
1427 
1429  { return m_rep->is_sorted_rows (mode); }
1430 
1431  void lock () { m_rep->lock (); }
1432 
1433  void unlock () { m_rep->unlock (); }
1434 
1435  bool islocked () const { return m_rep->islocked (); }
1436 
1437  void call_object_destructor () { return m_rep->call_object_destructor (); }
1438 
1439  octave_value dump () const { return m_rep->dump (); }
1440 
1441 #define MAPPER_FORWARD(F) \
1442  octave_value F () const \
1443  { \
1444  return m_rep->map (octave_base_value::umap_ ## F); \
1445  }
1446 
1492 
1493  // These functions are prefixed with X to avoid potential macro conflicts.
1494 
1495  MAPPER_FORWARD (xisalnum)
1496  MAPPER_FORWARD (xisalpha)
1497  MAPPER_FORWARD (xisascii)
1498  MAPPER_FORWARD (xiscntrl)
1499  MAPPER_FORWARD (xisdigit)
1500  MAPPER_FORWARD (xisgraph)
1501  MAPPER_FORWARD (xislower)
1502  MAPPER_FORWARD (xisprint)
1503  MAPPER_FORWARD (xispunct)
1504  MAPPER_FORWARD (xisspace)
1505  MAPPER_FORWARD (xisupper)
1506  MAPPER_FORWARD (xisxdigit)
1507  MAPPER_FORWARD (xsignbit)
1508  MAPPER_FORWARD (xtolower)
1509  MAPPER_FORWARD (xtoupper)
1510 
1511 #undef MAPPER_FORWARD
1512 
1514  { return m_rep->map (umap); }
1515 
1516  //! Extract the n-th element, aka 'val(n)'.
1517  //!
1518  //! @return Result is undefined if 'val' is not an array type
1519  //! or @p n is out of range.
1520  //!
1521  //! @warning Function calls should never error.
1522 
1523  octave_value
1525  { return m_rep->fast_elem_extract (n); }
1526 
1527  //! Assign the n-th element, aka 'val(n) = x'.
1528  //!
1529  //! @returns false if 'val' is not an array type,
1530  //! @p x is not a matching scalar type,
1531  //! or @p n is out of range.
1532  //!
1533  //! @warning Function calls should never error.
1534 
1535  bool
1537  {
1538  make_unique ();
1539  return m_rep->fast_elem_insert (n, x);
1540  }
1541 
1542 protected:
1543 
1544  //! The real representation.
1546 
1547  static OCTINTERP_API octave_base_value * nil_rep ();
1548 
1549 private:
1550 
1551  OCTINTERP_API assign_op unary_op_to_assign_op (unary_op op);
1552 
1553  OCTINTERP_API binary_op op_eq_to_binary_op (assign_op op);
1554 
1555  // This declaration protects against constructing octave_value from
1556  // const octave_base_value* which actually silently calls octave_value (bool).
1557  OCTINTERP_API octave_value (const octave_base_value *);
1558 
1559 };
1560 
1561 // Non-member unary and binary operations on octave_value objects.
1562 
1564 
1565 extern OCTINTERP_API octave_value
1567  const octave_value& a);
1568 
1569 extern OCTINTERP_API octave_value
1571 
1572 extern OCTINTERP_API octave_value
1574  const octave_value& a, const octave_value& b);
1575 
1576 extern OCTINTERP_API octave_value
1578  const octave_value& a, const octave_value& b);
1579 
1580 extern OCTINTERP_API octave_value
1582  const octave_value& b);
1583 
1584 extern OCTINTERP_API octave_value
1586  const octave_value& b);
1587 
1588 extern OCTINTERP_API octave_value
1590  const octave_value& b, const Array<octave_idx_type>& ra_idx);
1591 
1592 extern OCTINTERP_API octave_value
1593 cat_op (const octave_value& a, const octave_value& b,
1595 
1596 extern OCTINTERP_API octave_value
1597 colon_op (const octave_value& base, const octave_value& increment,
1598  const octave_value& limit, bool is_for_cmd_expr = false);
1599 
1600 inline octave_value
1601 colon_op (const octave_value& base, const octave_value& limit,
1602  bool is_for_cmd_expr = false)
1603 {
1604  // Note, we need to pass an undefined octave_value object instead of
1605  // octave_value (1.0) so that we can properly detect the
1606  // two-argument case and correctly pass just two arguments to any
1607  // user-defined function that is provided if either base or limit is
1608  // an object.
1609 
1610  return colon_op (base, octave_value (), limit, is_for_cmd_expr);
1611 }
1612 
1613 OCTAVE_END_NAMESPACE(octave)
1614 
1615 #define OV_UNOP_FN(name) \
1616  inline octave_value \
1617  name (const octave_value& a) \
1618  { \
1619  return octave::unary_op (octave_value::name, a); \
1620  }
1621 
1622 #define OV_UNOP_OP(name, op) \
1623  inline octave_value \
1624  operator op (const octave_value& a) \
1625  { \
1626  return name (a); \
1627  }
1628 
1629 #define OV_UNOP_FN_OP(name, op) \
1630  OV_UNOP_FN (name) \
1631  OV_UNOP_OP (name, op)
1632 
1636 
1639 
1640 // No simple way to define these for prefix and suffix ops?
1641 //
1642 // incr
1643 // decr
1644 
1645 #define OV_BINOP_FN(name) \
1646  inline octave_value \
1647  name (const octave_value& a1, const octave_value& a2) \
1648  { \
1649  return octave::binary_op (octave_value::name, a1, a2); \
1650  }
1651 
1652 #define OV_BINOP_OP(name, op) \
1653  inline octave_value \
1654  operator op (const octave_value& a1, const octave_value& a2) \
1655  { \
1656  return name (a1, a2); \
1657  }
1658 
1659 #define OV_BINOP_FN_OP(name, op) \
1660  OV_BINOP_FN (name) \
1661  OV_BINOP_OP (name, op)
1662 
1667 
1670 
1677 
1684 
1686 
1687 #define OV_COMP_BINOP_FN(name) \
1688  inline octave_value \
1689  name (const octave_value& a1, const octave_value& a2) \
1690  { \
1691  return octave::binary_op (octave_value::name, a1, a2); \
1692  }
1693 
1698 
1699 extern OCTINTERP_API void install_types (octave::type_info&);
1700 
1701 // Templated value extractors.
1702 // FIXME: would be more consistent to use panic_impossible(), rather than
1703 // assert(), but including "error.h" leads to compilation errors.
1704 template <typename Value>
1705 inline Value octave_value_extract (const octave_value&)
1706 { assert (false); }
1707 
1708 #define DEF_VALUE_EXTRACTOR(VALUE,MPREFIX) \
1709  template <> \
1710  inline VALUE octave_value_extract<VALUE> (const octave_value& v) \
1711  { \
1712  return v.MPREFIX ## _value (); \
1713  }
1714 
1715 DEF_VALUE_EXTRACTOR (double, scalar)
1716 DEF_VALUE_EXTRACTOR (float, float_scalar)
1720 
1729 
1735 
1745 
1751 
1755 DEF_VALUE_EXTRACTOR (FloatComplexColumnVector, float_complex_column_vector)
1756 
1760 DEF_VALUE_EXTRACTOR (FloatComplexRowVector, float_complex_row_vector)
1761 
1765 DEF_VALUE_EXTRACTOR (FloatComplexDiagMatrix, float_complex_diag_matrix)
1767 
1771 #undef DEF_VALUE_EXTRACTOR
1772 
1773 #define DEF_DUMMY_VALUE_EXTRACTOR(VALUE,DEFVAL) \
1774  template <> \
1775  inline VALUE octave_value_extract<VALUE> (const octave_value&) \
1776  { \
1777  assert (false); \
1778  return DEFVAL; \
1779  }
1780 
1783 #undef DEF_DUMMY_VALUE_EXTRACTOR
1784 
1785 #endif
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:217
#define C(a, b)
Definition: Faddeeva.cc:259
size_type size(const size_type d) const
Size of the specified dimension.
Definition: Array.h:492
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Sort by rows returns only indices.
Definition: Array-base.cc:2079
Definition: Cell.h:43
Definition: dMatrix.h:42
Definition: Sparse.h:49
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
octave::refcount< octave_idx_type > m_count
Definition: ov-base.h:933
virtual octave_base_value * try_narrowing_conversion()
Definition: ov-base.h:323
virtual octave_base_value * find_parent_class(const std::string &)
Definition: ov-base.h:693
virtual octave_base_value * empty_clone() const
Definition: ov-base.cc:121
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:997
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
octave_base_value * internal_rep() const
Definition: ov.h:1387
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:1418
octave_value_list list_value() const
octave_int8 xint8_scalar_value(const char *fmt,...) const
bool all_zero_dims() const
Definition: ov.h:553
void make_unique(int obsolete_copies)
Definition: ov.h:368
bool is_magic_int() const
Definition: ov.h:676
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:835
octave_int8 int8_scalar_value() const
Definition: ov.h:926
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:1324
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:891
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:900
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:947
void call_object_destructor()
Definition: ov.h:1437
int8NDArray xint8_array_value(const char *fmt,...) const
Cell xcell_value(const char *fmt,...) const
std::string class_name() const
Definition: ov.h:1347
bool bool_value(bool warn=false) const
Definition: ov.h:885
int xnint_value(const char *fmt,...) const
octave_base_value * clone() const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition: ov.h:1312
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:941
bool is_real_scalar() const
Definition: ov.h:610
charMatrix char_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:894
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:956
uint16NDArray uint16_array_value() const
Definition: ov.h:965
DiagMatrix diag_matrix_value(bool force=false) const
Definition: ov.h:910
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:1536
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
int16NDArray xint16_array_value(const char *fmt,...) const
octave_value as_int8() const
Definition: ov.h:448
octave_value(const Array< octave_uint8 > &inda)
octave_user_code * xuser_code_value(const char *fmt,...) const
bool is_instance_of(const std::string &cls_name) const
Definition: ov.h:1013
octave_value(const uint8NDArray &inda)
int16NDArray int16_array_value() const
Definition: ov.h:953
octave_function * xfunction_value(const char *fmt,...) const
void maybe_economize()
Definition: ov.h:1289
octave_value_list xlist_value(const char *fmt,...) const
Cell cell_value() const
octave_user_function * user_function_value(bool silent=false) 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:1330
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)
unary_op
Definition: ov.h:79
@ 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)
Array< std::string > xcellstr_value(const char *fmt,...) const
int8NDArray int8_array_value() const
Definition: ov.h:950
std::string get_dims_str() const
octave_int64 int64_scalar_value() const
Definition: ov.h:935
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:831
bool is_scalar_type() const
Definition: ov.h:744
octave_value diag(octave_idx_type m, octave_idx_type n) const
Definition: ov.h:1413
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx, bool auto_add)
Definition: ov.h:480
bool is_sq_string() const
Definition: ov.h:640
octave::range< double > range_value() const
Definition: ov.h:985
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_idx_type nzmax() const
Definition: ov.h:567
octave_value & non_const_unary_op(unary_op op, const std::string &type, const std::list< octave_value_list > &idx)
bool is_classdef_meta() const
Definition: ov.h:652
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
FloatDiagMatrix float_diag_matrix_value(bool force=false) const
Definition: ov.h:913
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:871
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:1333
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:1431
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:1439
double xscalar_value(const char *fmt,...) const
Complex complex_value(bool frc_str_conv=false) const
Definition: ov.h:865
octave_value(const octave_uint16 &i)
octave_int32 xint32_scalar_value(const char *fmt,...) const
float xfloat_scalar_value(const char *fmt,...) const
Array< FloatComplex > float_complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_value(const uint32NDArray &inda)
FloatComplexDiagMatrix float_complex_diag_matrix_value(bool force=false) const
Definition: ov.h:920
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:1376
Array< octave_idx_type > xoctave_idx_type_vector_value(const char *fmt,...) const
const octave_idx_type * mex_get_ir() const
Definition: ov.h:1396
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
Array< int > xint_vector_value(const char *fmt,...) const
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:1416
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
int type_id() const
Definition: ov.h:1343
PermMatrix xperm_matrix_value(const char *fmt,...) const
octave_value(const octave_int64 &i)
ComplexMatrix xcomplex_matrix_value(const char *fmt,...) const
const octave_idx_type * mex_get_jc() const
Definition: ov.h:1402
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
octave_value & assign(assign_op, const octave_value &rhs)
octave_user_code * user_code_value(bool silent=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:878
bool is_copy_of(const octave_value &val) const
Definition: ov.h:1361
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, std::size_t skip=1)
bool is_mex_function() const
Definition: ov.h:795
string_vector parent_class_names() const
Definition: ov.h:1006
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:1337
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:1370
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov.h:897
void make_storable_value()
const octave_base_value & get_rep() const
Definition: ov.h:1359
bool isempty() const
Definition: ov.h:601
octave_uint32 uint32_scalar_value() const
Definition: ov.h:944
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:1366
string_vector map_keys() const
Definition: ov.h:994
float float_scalar_value(bool frc_str_conv=false) const
Definition: ov.h:850
bool is_function() const
Definition: ov.h:777
FloatComplex float_complex_value(bool frc_str_conv=false) const
Definition: ov.h:868
void break_closure_cycles(const std::shared_ptr< octave::stack_frame > &)
Array< FloatComplex > xfloat_complex_vector_value(const char *fmt,...) const
octave::range< double > xrange_value(const char *fmt,...) const
bool is_equal(const octave_value &) const
std::size_t nparents() const
Definition: ov.h:1000
octave_idx_type xnumel(const octave_value_list &idx)
Definition: ov.h:467
assign_op
Definition: ov.h:134
@ 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
Array< octave_idx_type > octave_idx_type_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
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
bool is_uint16_type() const
Definition: ov.h:721
octave_fcn_handle * xfcn_handle_value(const char *fmt,...) const
uint64NDArray uint64_array_value() const
Definition: ov.h:971
charMatrix xchar_matrix_value(const char *fmt,...) const
short int xshort_value(const char *fmt,...) const
octave_user_script * xuser_script_value(const char *fmt,...) const
float float_value(bool frc_str_conv=false) const
Definition: ov.h:844
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
SparseComplexMatrix xsparse_complex_matrix_value(const char *fmt,...) const
ComplexDiagMatrix xcomplex_diag_matrix_value(const char *fmt,...) const
bool is_magic_colon() const
Definition: ov.h:673
FloatNDArray xfloat_array_value(const char *fmt,...) const
octave_function * function_value(bool silent=false) const
unsigned long int ulong_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:827
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:1318
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
octave_int64 xint64_scalar_value(const char *fmt,...) const
double scalar_value(bool frc_str_conv=false) const
Definition: ov.h:847
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)
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:1315
bool is_real_matrix() const
Definition: ov.h:613
octave_fcn_handle * fcn_handle_value(bool silent=false) const
boolMatrix bool_matrix_value(bool warn=false) const
Definition: ov.h:888
bool isnull() const
Definition: ov.h:679
octave_idx_type nnz() const
Definition: ov.h:565
octave_value fast_elem_extract(octave_idx_type n) const
Extract the n-th element, aka 'val(n)'.
Definition: ov.h:1524
octave_value(const Array< octave_uint16 > &inda)
octave_value(const SparseComplexMatrix &m, const MatrixType &t=MatrixType())
magic_colon
Definition: ov.h:170
std::string string_value(bool force=false) const
Definition: ov.h:974
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:916
octave_uint8 uint8_scalar_value() const
Definition: ov.h:938
int nint_value(bool frc_str_conv=false) const
Definition: ov.h:819
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:856
octave_base_value * find_parent_class(const std::string &parent_class_name)
Definition: ov.h:1010
octave_scalar_map xscalar_map_value(const char *fmt,...) const
bool islocked() const
Definition: ov.h:1435
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:1513
octave_int16 int16_scalar_value() const
Definition: ov.h:929
charNDArray xchar_array_value(const char *fmt,...) const
octave_value(const octave_uint8 &i)
octave_value(const Array< octave_int32 > &inda)
octave_base_value * empty_clone() const
Definition: ov.h:337
long int long_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:823
Array< float > xfloat_vector_value(const char *fmt,...) const
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:977
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:1428
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
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
octave_classdef * classdef_object_value(bool silent=false) const
int64NDArray int64_array_value() const
Definition: ov.h:959
octave_idx_type get_count() const
Definition: ov.h:421
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
Definition: ov.h:907
NDArray array_value(bool frc_str_conv=false) const
Definition: ov.h:859
Array< Complex > xcomplex_vector_value(const char *fmt,...) const
FloatComplex xfloat_complex_value(const char *fmt,...) 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
octave_value & non_const_unary_op(unary_op op)
uint16NDArray xuint16_array_value(const char *fmt,...) const
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
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
const void * mex_get_data(mxClassID class_id=mxUNKNOWN_CLASS, mxComplexity complexity=mxREAL) const
octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
Definition: ov.h:1307
uint8NDArray uint8_array_value() const
Definition: ov.h:962
bool print_name_tag(std::ostream &os, const std::string &name) const
Definition: ov.h:1327
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:1422
std::string type_name() const
Definition: ov.h:1345
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
Array< float > float_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_base_value * m_rep
The real representation.
Definition: ov.h:1545
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
boolNDArray xbool_array_value(const char *fmt,...) const
octave_int32 int32_scalar_value() const
Definition: ov.h:932
Array< double > xvector_value(const char *fmt,...) const
std::size_t byte_size() const
Definition: ov.h:562
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
Definition: ov.h:882
octave_value(const octave_int32 &i)
ColumnVector column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
int32NDArray xint32_array_value(const char *fmt,...) const
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition: ov.h:580
octave_base_value * try_narrowing_conversion()
Definition: ov.h:458
~octave_value()
Definition: ov.h:342
float xfloat_value(const char *fmt,...) const
std::list< std::string > parent_class_name_list() const
Definition: ov.h:1003
DiagMatrix xdiag_matrix_value(const char *fmt,...) const
Array< Complex > complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
Array< int > int_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
bool iscellstr() const
Definition: ov.h:607
FloatNDArray float_array_value(bool frc_str_conv=false) const
Definition: ov.h:862
bool isstruct() const
Definition: ov.h:649
octave_value(const octave_value &a)
Definition: ov.h:321
Matrix xmatrix_value(const char *fmt,...) const
mxArray * as_mxArray(bool interleaved=false) const
Definition: ov.h:1407
NDArray xarray_value(const char *fmt,...) const
uint32NDArray uint32_array_value() const
Definition: ov.h:968
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:853
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:875
void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov.h:1321
octave_value diag(octave_idx_type k=0) const
Definition: ov.h:1410
octave_value(const Array< octave_uint32 > &inda)
double double_value(bool frc_str_conv=false) const
Definition: ov.h:841
unsigned int uint_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:816
boolMatrix xbool_matrix_value(const char *fmt,...) const
PermMatrix perm_matrix_value() const
Definition: ov.h:923
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
octave_user_function * xuser_function_value(const char *fmt,...) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:904
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_user_script * user_script_value(bool silent=false) const
Array< std::string > cellstr_value() const
Definition: ov.h:982
octave_value(const string_vector &s, char type='\'')
dim_vector dims() const
Definition: ov.h:541
void unlock()
Definition: ov.h:1433
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Definition: ov.h:1425
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)
Definition: dColVector.cc:137
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:143
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
function gamma(X)
Definition: gamma.f:3
octave::idx_vector idx_vector
Definition: idx-vector.h:1022
Complex log2(const Complex &x)
Definition: lo-mappers.cc:141
Complex asin(const Complex &x)
Definition: lo-mappers.cc:107
bool isna(double x)
Definition: lo-mappers.cc:47
Complex acos(const Complex &x)
Definition: lo-mappers.cc:85
Complex atan(const Complex &x)
Definition: lo-mappers.h:71
double roundb(double x)
Definition: lo-mappers.h:147
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
std::complex< T > floor(const std::complex< T > &x)
Definition: lo-mappers.h:130
std::complex< T > ceil(const std::complex< T > &x)
Definition: lo-mappers.h:103
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)
Definition: lo-specfun.cc:1823
double dawson(double x)
Definition: lo-specfun.cc:1467
double erfcinv(double x)
Definition: lo-specfun.cc:1697
Complex expm1(const Complex &x)
Definition: lo-specfun.cc:1835
Complex log1p(const Complex &x)
Definition: lo-specfun.cc:1919
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
float_format
Definition: mach-info.h:38
T octave_idx_type m
Definition: mx-inlines.cc:781
octave_idx_type n
Definition: mx-inlines.cc:761
T * r
Definition: mx-inlines.cc:781
mxClassID
Definition: mxtypes.h:57
@ mxUNKNOWN_CLASS
Definition: mxtypes.h:58
mxComplexity
Definition: mxtypes.h:79
@ mxREAL
Definition: mxtypes.h:80
std::complex< double > erfc(std::complex< double > z, double relerr=0)
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
std::complex< double > erfi(std::complex< double > z, double relerr=0)
std::complex< double > erf(std::complex< double > z, double relerr=0)
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
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
builtin_type_t
Definition: ov-base.h:83
octave_value op_ne(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1676
octave_value op_el_ldiv(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1681
octave_value op_uplus(const octave_value &a)
Definition: ov.h:1634
octave_value op_add(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1663
octave_value op_gt(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1675
octave_value op_uminus(const octave_value &a)
Definition: ov.h:1635
octave_value op_el_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1679
#define DEF_DUMMY_VALUE_EXTRACTOR(VALUE, DEFVAL)
Definition: ov.h:1773
octave_value op_mul_herm(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1697
octave_value op_transpose(const octave_value &a)
Definition: ov.h:1637
octave_value op_el_or(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1683
octave_value op_sub(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1664
octave_value op_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1665
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:1638
#define OV_COMP_BINOP_FN(name)
Definition: ov.h:1687
octave_value op_le(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1672
octave_value op_el_and(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1682
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:1696
#define MAPPER_FORWARD(F)
Definition: ov.h:1441
octave_value op_eq(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1673
octave_value op_el_pow(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1680
#define OV_UNOP_FN_OP(name, op)
Definition: ov.h:1629
#define DEF_VALUE_EXTRACTOR(VALUE, MPREFIX)
Definition: ov.h:1708
octave_value op_struct_ref(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1685
octave_value op_not(const octave_value &a)
Definition: ov.h:1633
#define OV_BINOP_FN(name)
Definition: ov.h:1645
octave_value op_ldiv(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1669
#define OV_UNOP_FN(name)
Definition: ov.h:1615
Value octave_value_extract(const octave_value &)
Definition: ov.h:1705
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:1668
octave_value op_ge(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1674
octave_value op_el_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1678
octave_value op_div(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1666
octave_value op_trans_mul(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1694
octave_value op_mul_trans(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1695
#define OV_BINOP_FN_OP(name, op)
Definition: ov.h:1659
octave_value op_lt(const octave_value &a1, const octave_value &a2)
Definition: ov.h:1671