GNU Octave  4.2.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-base.h
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2017 John W. Eaton
4 Copyright (C) 2009-2010 VZLU Prague
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if ! defined (octave_ov_base_h)
25 #define octave_ov_base_h 1
26 
27 #include "octave-config.h"
28 
29 #include <cstdlib>
30 
31 #include <iosfwd>
32 #include <list>
33 #include <string>
34 
35 #include "Range.h"
36 #include "data-conv.h"
37 #include "mx-base.h"
38 #include "str-vec.h"
39 
40 #include "error.h"
41 #include "oct-hdf5-types.h"
42 
43 class Cell;
44 class mxArray;
45 class octave_map;
46 class octave_scalar_map;
47 class octave_value;
48 class octave_value_list;
49 class octave_stream;
50 class octave_function;
52 class octave_user_script;
53 class octave_user_code;
54 class octave_fcn_handle;
55 class octave_fcn_inline;
56 class octave_value_list;
57 class octave_lvalue;
58 
59 class tree_walker;
60 
62 {
82 };
83 
86 
88 get_builtin_classes (void);
89 
90 inline bool btyp_isnumeric (builtin_type_t btyp)
91 { return btyp <= btyp_uint64; }
92 
93 inline bool btyp_isinteger (builtin_type_t btyp)
94 { return btyp >= btyp_int8 && btyp <= btyp_uint64; }
95 
96 inline bool btyp_isfloat (builtin_type_t btyp)
97 { return btyp <= btyp_float_complex; }
98 
99 inline bool btyp_isarray (builtin_type_t btyp)
100 { return btyp <= btyp_char; }
101 
102 // Compute numeric type for a possible mixed-type operation, using these rules:
103 // bool -> double
104 // single + double -> single
105 // real + complex -> complex
106 // integer + real -> integer
107 // uint + uint -> uint (the bigger one)
108 // sint + sint -> sint (the bigger one)
109 //
110 // failing otherwise.
111 
112 extern OCTINTERP_API
114 
115 template <typename T>
117 {
119 };
120 
121 #define DEF_CLASS_TO_BTYP(CLASS,BTYP) \
122  template <> \
123  struct class_to_btyp<CLASS> \
124  { \
125  static const builtin_type_t btyp = BTYP; \
126  }
127 
142 
143 // T_ID is the type id of struct objects, set by register_type().
144 // T_NAME is the type name of struct objects.
145 
146 #define OCTAVE_EMPTY_CPP_ARG /* empty */
147 
148 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA \
149  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2 (OCTAVE_EMPTY_CPP_ARG)
150 
151 #define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA \
152  DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(virtual)
153 
154 #define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA2(VIRTUAL) \
155  public: \
156  VIRTUAL int type_id (void) const { return t_id; } \
157  VIRTUAL std::string type_name (void) const { return t_name; } \
158  VIRTUAL std::string class_name (void) const { return c_name; } \
159  static int static_type_id (void) { return t_id; } \
160  static std::string static_type_name (void) { return t_name; } \
161  static std::string static_class_name (void) { return c_name; } \
162  static void register_type (void); \
163  \
164  private: \
165  static int t_id; \
166  static const std::string t_name; \
167  static const std::string c_name;
168 
169 #define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c) \
170  int t::t_id (-1); \
171  const std::string t::t_name (n); \
172  const std::string t::c_name (c); \
173  void t::register_type (void) \
174  { \
175  static t exemplar; \
176  octave_value v (&exemplar, true); \
177  t_id = octave_value_typeinfo::register_type (t::t_name, t::c_name, v); \
178  }
179 
180 // A base value type, so that derived types only have to redefine what
181 // they need (if they are derived from octave_base_value instead of
182 // octave_value).
183 
184 class
187 {
188 public:
189 
190  typedef octave_base_value * (*type_conv_fcn) (const octave_base_value&);
191 
192  // type conversion, including result type information
194  {
195  public:
196  type_conv_info (type_conv_fcn f = 0, int t = -1)
197  : _fcn (f), _type_id (t) { }
198 
199  operator type_conv_fcn (void) const { return _fcn; }
200 
201  octave_base_value * operator () (const octave_base_value &v) const
202  { return (*_fcn) (v); }
203 
204  int type_id (void) const { return _type_id; }
205 
206  private:
207  type_conv_fcn _fcn;
208  int _type_id;
209  };
210 
211  friend class octave_value;
212 
213  octave_base_value (void) : count (1) { }
214 
215  octave_base_value (const octave_base_value&) : count (1) { }
216 
217  virtual ~octave_base_value (void) { }
218 
219  // Unconditional clone. Always clones.
220  virtual octave_base_value *
221  clone (void) const { return new octave_base_value (*this); }
222 
223  // Empty clone.
224  virtual octave_base_value *
225  empty_clone (void) const;
226 
227  // Unique clone. Usually clones, but may be overridden to fake the
228  // cloning when sharing copies is to be controlled from within an
229  // instance (see octave_class).
230  virtual octave_base_value *
231  unique_clone (void) { return clone (); }
232 
233  virtual type_conv_info
235  { return type_conv_info (); }
236 
237  virtual type_conv_info
239  { return type_conv_info (); }
240 
241  virtual octave_value squeeze (void) const;
242 
243  virtual octave_value full_value (void) const;
244 
245  virtual octave_value as_double (void) const;
246  virtual octave_value as_single (void) const;
247 
248  virtual octave_value as_int8 (void) const;
249  virtual octave_value as_int16 (void) const;
250  virtual octave_value as_int32 (void) const;
251  virtual octave_value as_int64 (void) const;
252 
253  virtual octave_value as_uint8 (void) const;
254  virtual octave_value as_uint16 (void) const;
255  virtual octave_value as_uint32 (void) const;
256  virtual octave_value as_uint64 (void) const;
257 
258  virtual octave_base_value *try_narrowing_conversion (void) { return 0; }
259 
260  virtual void maybe_economize (void) { }
261 
262  virtual Matrix size (void);
263 
264  virtual octave_idx_type numel (const octave_value_list&);
265 
266  virtual octave_value
267  subsref (const std::string& type,
268  const std::list<octave_value_list>& idx);
269 
270  virtual octave_value_list
271  subsref (const std::string& type,
272  const std::list<octave_value_list>& idx,
273  int nargout);
274 
275  virtual octave_value
276  subsref (const std::string& type,
277  const std::list<octave_value_list>& idx,
278  bool auto_add);
279 
280  virtual octave_value_list
281  subsref (const std::string& type,
282  const std::list<octave_value_list>& idx,
283  int nargout,
284  const std::list<octave_lvalue> *lvalue_list);
285 
286  virtual octave_value
287  do_index_op (const octave_value_list& idx, bool resize_ok = false);
288 
289  virtual octave_value_list
290  do_multi_index_op (int nargout, const octave_value_list& idx);
291 
292  virtual octave_value_list
294  const std::list<octave_lvalue> *lvalue_list);
295 
296  virtual void assign (const std::string&, const octave_value&) { }
297 
298  virtual octave_value
299  subsasgn (const std::string& type,
300  const std::list<octave_value_list>& idx,
301  const octave_value& rhs);
302 
303  virtual octave_value
305  const std::list<octave_value_list>& idx,
306  const octave_value& rhs);
307 
308  virtual idx_vector index_vector (bool require_integers = false) const;
309 
310  virtual dim_vector dims (void) const { return dim_vector (); }
311 
312  octave_idx_type rows (void) const
313  {
314  const dim_vector dv = dims ();
315 
316  return dv(0);
317  }
318 
320  {
321  const dim_vector dv = dims ();
322 
323  return dv(1);
324  }
325 
326  virtual int ndims (void) const
327  { return dims ().ndims (); }
328 
329  virtual octave_idx_type numel (void) const { return dims ().numel (); }
330 
331  OCTAVE_DEPRECATED ("use 'numel' instead")
332  virtual octave_idx_type capacity (void) const
333  { return numel (); }
334 
335  virtual size_t byte_size (void) const { return 0; }
336 
337  virtual octave_idx_type nnz (void) const;
338 
339  virtual octave_idx_type nzmax (void) const;
340 
341  virtual octave_idx_type nfields (void) const;
342 
343  virtual octave_value reshape (const dim_vector&) const;
344 
345  virtual octave_value permute (const Array<int>& vec, bool = false) const;
346 
347  virtual octave_value resize (const dim_vector&, bool fill = false) const;
348 
349  virtual MatrixType matrix_type (void) const;
350 
351  virtual MatrixType matrix_type (const MatrixType& typ) const;
352 
353  virtual bool is_defined (void) const { return false; }
354 
355  bool is_empty (void) const { return (dims ().any_zero ()); }
356 
357  virtual bool is_cell (void) const { return false; }
358 
359  virtual bool is_cellstr (void) const { return false; }
360 
361  virtual bool is_real_scalar (void) const { return false; }
362 
363  virtual bool is_real_matrix (void) const { return false; }
364 
365  virtual bool is_complex_scalar (void) const { return false; }
366 
367  virtual bool is_complex_matrix (void) const { return false; }
368 
369  virtual bool is_bool_scalar (void) const { return false; }
370 
371  virtual bool is_bool_matrix (void) const { return false; }
372 
373  virtual bool is_char_matrix (void) const { return false; }
374 
375  virtual bool is_diag_matrix (void) const { return false; }
376 
377  virtual bool is_perm_matrix (void) const { return false; }
378 
379  virtual bool is_string (void) const { return false; }
380 
381  virtual bool is_sq_string (void) const { return false; }
382 
383  virtual bool is_range (void) const { return false; }
384 
385  virtual bool is_map (void) const { return false; }
386 
387  virtual bool is_object (void) const { return false; }
388 
389  virtual bool is_classdef_object (void) const { return false; }
390 
391  virtual bool is_java (void) const { return false; }
392 
393  virtual bool is_cs_list (void) const { return false; }
394 
395  virtual bool is_magic_colon (void) const { return false; }
396 
397  virtual bool is_all_va_args (void) const { return false; }
398 
399  virtual octave_value all (int = 0) const;
400 
401  virtual octave_value any (int = 0) const;
402 
403  virtual builtin_type_t builtin_type (void) const { return btyp_unknown; }
404 
405  virtual bool is_double_type (void) const { return false; }
406 
407  virtual bool is_single_type (void) const { return false; }
408 
409  virtual bool is_float_type (void) const { return false; }
410 
411  virtual bool is_int8_type (void) const { return false; }
412 
413  virtual bool is_int16_type (void) const { return false; }
414 
415  virtual bool is_int32_type (void) const { return false; }
416 
417  virtual bool is_int64_type (void) const { return false; }
418 
419  virtual bool is_uint8_type (void) const { return false; }
420 
421  virtual bool is_uint16_type (void) const { return false; }
422 
423  virtual bool is_uint32_type (void) const { return false; }
424 
425  virtual bool is_uint64_type (void) const { return false; }
426 
427  virtual bool is_bool_type (void) const { return false; }
428 
429  virtual bool is_integer_type (void) const { return false; }
430 
431  virtual bool is_real_type (void) const { return false; }
432 
433  virtual bool is_complex_type (void) const { return false; }
434 
435  // Would be nice to get rid of the next four functions:
436 
437  virtual bool is_scalar_type (void) const { return false; }
438 
439  virtual bool is_matrix_type (void) const { return false; }
440 
441  virtual bool is_numeric_type (void) const { return false; }
442 
443  virtual bool is_sparse_type (void) const { return false; }
444 
445  virtual bool is_true (void) const { return false; }
446 
447  virtual bool is_null_value (void) const { return false; }
448 
449  virtual bool is_constant (void) const { return false; }
450 
451  virtual bool is_function_handle (void) const { return false; }
452 
453  virtual bool is_anonymous_function (void) const { return false; }
454 
455  virtual bool is_inline_function (void) const { return false; }
456 
457  virtual bool is_function (void) const { return false; }
458 
459  virtual bool is_user_script (void) const { return false; }
460 
461  virtual bool is_user_function (void) const { return false; }
462 
463  virtual bool is_user_code (void) const { return false; }
464 
465  virtual bool is_builtin_function (void) const { return false; }
466 
467  virtual bool is_dld_function (void) const { return false; }
468 
469  virtual bool is_mex_function (void) const { return false; }
470 
471  virtual void erase_subfunctions (void) { }
472 
473  virtual short int short_value (bool = false, bool = false) const;
474 
475  virtual unsigned short int ushort_value (bool = false, bool = false) const;
476 
477  virtual int int_value (bool = false, bool = false) const;
478 
479  virtual unsigned int uint_value (bool = false, bool = false) const;
480 
481  virtual int nint_value (bool = false) const;
482 
483  virtual long int long_value (bool = false, bool = false) const;
484 
485  virtual unsigned long int ulong_value (bool = false, bool = false) const;
486 
487  virtual int64_t int64_value (bool = false, bool = false) const;
488 
489  virtual uint64_t uint64_value (bool = false, bool = false) const;
490 
491  virtual double double_value (bool = false) const;
492 
493  virtual float float_value (bool = false) const;
494 
495  virtual double scalar_value (bool frc_str_conv = false) const
496  { return double_value (frc_str_conv); }
497 
498  virtual float float_scalar_value (bool frc_str_conv = false) const
499  { return float_value (frc_str_conv); }
500 
501  virtual Cell cell_value (void) const;
502 
503  virtual Matrix matrix_value (bool = false) const;
504 
505  virtual FloatMatrix float_matrix_value (bool = false) const;
506 
507  virtual NDArray array_value (bool = false) const;
508 
509  virtual FloatNDArray float_array_value (bool = false) const;
510 
511  virtual Complex complex_value (bool = false) const;
512 
513  virtual FloatComplex float_complex_value (bool = false) const;
514 
515  virtual ComplexMatrix complex_matrix_value (bool = false) const;
516 
517  virtual FloatComplexMatrix float_complex_matrix_value (bool = false) const;
518 
519  virtual ComplexNDArray complex_array_value (bool = false) const;
520 
521  virtual FloatComplexNDArray float_complex_array_value (bool = false) const;
522 
523  virtual bool bool_value (bool = false) const;
524 
525  virtual boolMatrix bool_matrix_value (bool = false) const;
526 
527  virtual boolNDArray bool_array_value (bool = false) const;
528 
529  virtual charMatrix char_matrix_value (bool force = false) const;
530 
531  virtual charNDArray char_array_value (bool = false) const;
532 
533  virtual SparseMatrix sparse_matrix_value (bool = false) const;
534 
535  virtual SparseComplexMatrix sparse_complex_matrix_value (bool = false) const;
536 
537  virtual SparseBoolMatrix sparse_bool_matrix_value (bool = false) const;
538 
539  virtual DiagMatrix diag_matrix_value (bool = false) const;
540 
541  virtual FloatDiagMatrix float_diag_matrix_value (bool = false) const;
542 
543  virtual ComplexDiagMatrix complex_diag_matrix_value (bool = false) const;
544 
545  virtual FloatComplexDiagMatrix
546  float_complex_diag_matrix_value (bool = false) const;
547 
548  virtual PermMatrix perm_matrix_value (void) const;
549 
550  virtual octave_int8 int8_scalar_value (void) const;
551 
552  virtual octave_int16 int16_scalar_value (void) const;
553 
554  virtual octave_int32 int32_scalar_value (void) const;
555 
556  virtual octave_int64 int64_scalar_value (void) const;
557 
558  virtual octave_uint8 uint8_scalar_value (void) const;
559 
560  virtual octave_uint16 uint16_scalar_value (void) const;
561 
562  virtual octave_uint32 uint32_scalar_value (void) const;
563 
564  virtual octave_uint64 uint64_scalar_value (void) const;
565 
566  virtual int8NDArray int8_array_value (void) const;
567 
568  virtual int16NDArray int16_array_value (void) const;
569 
570  virtual int32NDArray int32_array_value (void) const;
571 
572  virtual int64NDArray int64_array_value (void) const;
573 
574  virtual uint8NDArray uint8_array_value (void) const;
575 
576  virtual uint16NDArray uint16_array_value (void) const;
577 
578  virtual uint32NDArray uint32_array_value (void) const;
579 
580  virtual uint64NDArray uint64_array_value (void) const;
581 
582  virtual string_vector string_vector_value (bool pad = false) const;
583 
584  virtual std::string string_value (bool force = false) const;
585 
586  virtual Array<std::string> cellstr_value (void) const;
587 
588  virtual Range range_value (void) const;
589 
590  virtual octave_map map_value (void) const;
591 
592  virtual octave_scalar_map scalar_map_value (void) const;
593 
594  virtual string_vector map_keys (void) const;
595 
596  virtual size_t nparents (void) const;
597 
598  virtual std::list<std::string> parent_class_name_list (void) const;
599 
600  virtual string_vector parent_class_names (void) const;
601 
603  { return 0; }
604 
606  { return 0; }
607 
608  virtual bool is_instance_of (const std::string&) const
609  { return false; }
610 
611  virtual octave_function *function_value (bool silent = false);
612 
613  virtual octave_user_function *user_function_value (bool silent = false);
614 
615  virtual octave_user_script *user_script_value (bool silent = false);
616 
617  virtual octave_user_code *user_code_value (bool silent = false);
618 
619  virtual octave_fcn_handle *fcn_handle_value (bool silent = false);
620 
621  virtual octave_fcn_inline *fcn_inline_value (bool silent = false);
622 
623  virtual octave_value_list list_value (void) const;
624 
625  virtual octave_value convert_to_str (bool pad = false, bool force = false,
626  char type = '\'') const;
627  virtual octave_value
628  convert_to_str_internal (bool pad, bool force, char type) const;
629 
630  virtual void convert_to_row_or_column_vector (void);
631 
632  // The following extractor functions don't perform any implicit type
633  // conversions.
634 
635  virtual std::string xstring_value () const;
636 
637  virtual bool print_as_scalar (void) const { return false; }
638 
639  virtual void print (std::ostream& os, bool pr_as_read_syntax = false);
640 
641  virtual void
642  print_raw (std::ostream& os, bool pr_as_read_syntax = false) const;
643 
644  virtual bool
645  print_name_tag (std::ostream& os, const std::string& name) const;
646 
647  virtual void
648  print_with_name (std::ostream& output_buf, const std::string& name,
649  bool print_padding = true);
650 
651  virtual void short_disp (std::ostream& os) const { os << "..."; }
652 
653  virtual void print_info (std::ostream& os, const std::string& prefix) const;
654 
655  virtual bool save_ascii (std::ostream& os);
656 
657  virtual bool load_ascii (std::istream& is);
658 
659  virtual bool save_binary (std::ostream& os, bool& save_as_floats);
660 
661  virtual bool load_binary (std::istream& is, bool swap,
663 
664  virtual bool
665  save_hdf5 (octave_hdf5_id loc_id, const char *name, bool save_as_floats);
666 
667  virtual bool
668  load_hdf5 (octave_hdf5_id loc_id, const char *name);
669 
670  virtual int
671  write (octave_stream& os, int block_size,
672  oct_data_conv::data_type output_type, int skip,
674 
675  virtual void *mex_get_data (void) const { return 0; }
676 
677  virtual octave_idx_type *mex_get_ir (void) const { return 0; }
678 
679  virtual octave_idx_type *mex_get_jc (void) const { return 0; }
680 
681  virtual mxArray *as_mxArray (void) const;
682 
683  virtual octave_value diag (octave_idx_type k = 0) const;
684 
686 
687  virtual octave_value sort (octave_idx_type dim = 0,
688  sortmode mode = ASCENDING) const;
690  octave_idx_type dim = 0,
691  sortmode mode = ASCENDING) const;
692 
693  virtual sortmode is_sorted (sortmode mode = UNSORTED) const;
694 
695  virtual Array<octave_idx_type>
697 
698  virtual sortmode is_sorted_rows (sortmode mode = UNSORTED) const;
699 
700  virtual void lock (void);
701 
702  virtual void unlock (void);
703 
704  virtual bool islocked (void) const { return false; }
705 
706  virtual void dump (std::ostream& os) const;
707 
708  // Standard mappers. Register new ones here.
710  {
773  num_unary_mappers = umap_unknown
774  };
775 
776  virtual octave_value map (unary_mapper_t) const;
777 
778  // These are fast indexing & assignment shortcuts for extracting
779  // or inserting a single scalar from/to an array.
780 
781  // Extract the n-th element, aka val(n). Result is undefined if val is not
782  // an array type or n is out of range. Never error.
783  virtual octave_value
785 
786  // Assign the n-th element, aka val(n) = x. Returns false if val is not an
787  // array type, x is not a matching scalar type, or n is out of range.
788  // Never error.
789  virtual bool
791 
792  // This is a helper for the above, to be overridden in scalar types. The
793  // whole point is to handle the insertion efficiently with just *two* VM
794  // calls, which is basically the theoretical minimum.
795  virtual bool
796  fast_elem_insert_self (void *where, builtin_type_t btyp) const;
797 
798  // Grab the reference count. For use by jit.
799  void
800  grab (void)
801  {
802  ++count;
803  }
804 
805  // Release the reference count. For use by jit.
806  void
807  release (void)
808  {
809  if (--count == 0)
810  delete this;
811  }
812 
813 protected:
814 
815  // This should only be called for derived types.
816 
817  octave_value numeric_assign (const std::string& type,
818  const std::list<octave_value_list>& idx,
819  const octave_value& rhs);
820 
821  void reset_indent_level (void) const
822  { curr_print_indent_level = 0; }
823 
824  void increment_indent_level (void) const
825  { curr_print_indent_level += 2; }
826 
827  void decrement_indent_level (void) const
828  { curr_print_indent_level -= 2; }
829 
830  int current_print_indent_level (void) const
831  { return curr_print_indent_level; }
832 
833  void indent (std::ostream& os) const;
834 
835  void newline (std::ostream& os) const;
836 
837  void reset (void) const;
838 
839  // A reference count.
840  // NOTE: the declaration is octave_idx_type because with 64-bit indexing,
841  // it is well possible to have more than MAX_INT copies of a single value
842  // (think of an empty cell array with >2G elements).
844 
845  static const char *get_umap_name (unary_mapper_t);
846 
847  void warn_load (const char *type) const;
848  void warn_save (const char *type) const;
849 
850 private:
851 
852  void wrong_type_arg_error (void) const;
853 
855  static bool beginning_of_line;
856 
858 };
859 
860 // TRUE means to perform automatic sparse to real mutation if there
861 // is memory to be saved
863 
864 // Utility function to convert C++ arguments used in subsref/subsasgn into an
865 // octave_value_list object that can be used to call a function/method in the
866 // interpreter.
869  const std::list<octave_value_list>& idx,
870  const std::string& who);
871 
872 // Tells whether some regular octave_value_base methods are being called from
873 // within the "builtin" function.
874 extern OCTINTERP_API bool called_from_builtin (void);
875 
876 #endif
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Definition: ov.h:1329
uint8NDArray uint8_array_value(void) const
Definition: ov.h:896
virtual bool is_uint32_type(void) const
Definition: ov-base.h:423
virtual octave_base_value * unique_parent_class(const std::string &)
Definition: ov-base.h:605
virtual dim_vector dims(void) const
Definition: ov-base.h:310
octave_idx_type nnz(void) const
Definition: ov.h:509
#define DEF_CLASS_TO_BTYP(CLASS, BTYP)
Definition: ov-base.h:121
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
Definition: ov.h:812
bool btyp_isfloat(builtin_type_t btyp)
Definition: ov-base.h:96
virtual bool is_sparse_type(void) const
Definition: ov-base.h:443
virtual bool is_bool_matrix(void) const
Definition: ov-base.h:371
FloatComplexDiagMatrix float_complex_diag_matrix_value(bool force=false) const
Definition: ov.h:854
octave_idx_type capacity(void) const
Definition: ov.h:503
OCTINTERP_API octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
Definition: ov-base.cc:1454
virtual bool is_mex_function(void) const
Definition: ov-base.h:469
Definition: Cell.h:37
virtual bool is_true(void) const
Definition: ov-base.h:445
virtual bool is_complex_matrix(void) const
Definition: ov-base.h:367
size_t nparents(void) const
Definition: ov.h:933
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov.h:831
virtual bool is_function(void) const
Definition: ov-base.h:457
octave_refcount< octave_idx_type > count
Definition: ov-base.h:843
octave_value as_uint16(void) const
Definition: ov.h:400
virtual bool is_real_type(void) const
Definition: ov-base.h:431
boolMatrix bool_matrix_value(bool warn=false) const
Definition: ov.h:822
virtual bool is_function_handle(void) const
Definition: ov-base.h:451
bool print_name_tag(std::ostream &os, const std::string &name) const
Definition: ov.h:1222
octave_value as_int64(void) const
Definition: ov.h:397
virtual type_conv_info numeric_conversion_function(void) const
Definition: ov-base.h:234
octave_value reshape(const dim_vector &dv) const
Definition: ov.h:515
octave_value permute(const Array< int > &vec, bool inv=false) const
Definition: ov.h:518
void increment_indent_level(void) const
Definition: ov-base.h:824
virtual bool is_double_type(void) const
Definition: ov-base.h:405
octave_int16 int16_scalar_value(void) const
Definition: ov.h:863
octave_value full_value(void) const
Definition: ov.h:386
unsigned int uint_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:750
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov.h:1288
int8NDArray int8_array_value(void) const
Definition: ov.h:884
octave_idx_type columns(void) const
Definition: ov-base.h:319
FloatComplexMatrix float_complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:809
octave_base_value * empty_clone(void) const
Definition: ov.h:316
mxArray * as_mxArray(void) const
Definition: ov.h:1309
virtual bool is_bool_type(void) const
Definition: ov-base.h:427
sortmode
Definition: oct-sort.h:105
virtual bool is_real_matrix(void) const
Definition: ov-base.h:363
virtual void short_disp(std::ostream &os) const
Definition: ov-base.h:651
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
int16NDArray int16_array_value(void) const
Definition: ov.h:887
virtual type_conv_info numeric_demotion_function(void) const
Definition: ov-base.h:238
octave_idx_type nfields(void) const
Definition: ov.h:513
std::list< std::string > parent_class_name_list(void) const
Definition: ov.h:936
virtual bool is_magic_colon(void) const
Definition: ov-base.h:395
octave_map map_value(void) const
Definition: ov.cc:1693
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
Definition: data.cc:6386
idx subsref(val, idx) esult
Definition: ov.cc:3080
octave_user_code * user_code_value(bool silent=false) const
Definition: ov.cc:1723
octave_value diag(octave_idx_type k=0) const
Definition: ov.h:1311
virtual void assign(const std::string &, const octave_value &)
Definition: ov-base.h:296
virtual bool is_int8_type(void) const
Definition: ov-base.h:411
virtual void maybe_economize(void)
Definition: ov-base.h:260
for large enough k
Definition: lu.cc:606
virtual octave_idx_type * mex_get_ir(void) const
Definition: ov-base.h:677
int int_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:746
Definition: Range.h:33
uint64NDArray uint64_array_value(void) const
Definition: ov.h:905
virtual bool is_classdef_object(void) const
Definition: ov-base.h:389
int64_t int64_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:765
OCTINTERP_API string_vector get_builtin_classes(void)
Definition: ov-base.cc:94
virtual bool is_user_code(void) const
Definition: ov-base.h:463
virtual double scalar_value(bool frc_str_conv=false) const
Definition: ov-base.h:495
octave_int32 int32_scalar_value(void) const
Definition: ov.h:866
float float_value(bool frc_str_conv=false) const
Definition: ov.h:778
int32NDArray int32_array_value(void) const
Definition: ov.h:890
virtual bool is_anonymous_function(void) const
Definition: ov-base.h:453
bool btyp_isarray(builtin_type_t btyp)
Definition: ov-base.h:99
octave_value as_double(void) const
Definition: ov.h:391
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Definition: ov.h:1326
virtual bool is_perm_matrix(void) const
Definition: ov-base.h:377
virtual float float_scalar_value(bool frc_str_conv=false) const
Definition: ov-base.h:498
virtual bool is_numeric_type(void) const
Definition: ov-base.h:441
octave::mach_info::float_format flt_fmt
Definition: load-save.cc:723
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition: ov.h:524
OCTINTERP_API std::string btyp_class_name[btyp_num_types]
Definition: ov-base.cc:84
octave_idx_type nzmax(void) const
Definition: ov.h:511
virtual size_t byte_size(void) const
Definition: ov-base.h:335
octave_value as_int32(void) const
Definition: ov.h:396
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition: ov.h:1207
virtual bool is_cs_list(void) const
Definition: ov-base.h:393
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:935
virtual bool is_cell(void) const
Definition: ov-base.h:357
octave_value as_uint8(void) const
Definition: ov.h:399
octave_fcn_handle * fcn_handle_value(bool silent=false) const
Definition: ov.cc:1729
virtual bool is_null_value(void) const
Definition: ov-base.h:447
std::string xstring_value(const char *fmt,...) const
Definition: ov.cc:2122
builtin_type_t
Definition: ov-base.h:61
ComplexDiagMatrix complex_diag_matrix_value(bool force=false) const
Definition: ov.h:850
virtual bool is_int64_type(void) const
Definition: ov-base.h:417
virtual bool is_cellstr(void) const
Definition: ov-base.h:359
OCTINTERP_API bool called_from_builtin(void)
Definition: ov-base.cc:1517
bool is_empty(void) const
Definition: ov-base.h:355
boolNDArray bool_array_value(bool warn=false) const
Definition: ov.h:825
virtual octave_idx_type * mex_get_jc(void) const
Definition: ov-base.h:679
virtual bool is_scalar_type(void) const
Definition: ov-base.h:437
octave_base_value * clone(void) const
Definition: ov.cc:1149
virtual void * mex_get_data(void) const
Definition: ov-base.h:675
virtual bool is_range(void) const
Definition: ov-base.h:383
virtual bool is_map(void) const
Definition: ov-base.h:385
virtual octave_idx_type numel(void) const
Definition: ov-base.h:329
octave_base_value(void)
Definition: ov-base.h:213
int64NDArray int64_array_value(void) const
Definition: ov.h:893
Cell cell_value(void) const
Definition: ov.cc:1687
static int curr_print_indent_level
Definition: ov-base.h:854
virtual bool is_single_type(void) const
Definition: ov-base.h:407
OCTINTERP_API bool Vsparse_auto_mutate
Definition: ov-base.cc:119
bool swap
Definition: load-save.cc:725
sortmode is_sorted(sortmode mode=UNSORTED) const
Definition: ov.h:1323
idx_vector index_vector(bool require_integers=false) const
Definition: ov.h:479
virtual bool is_uint64_type(void) const
Definition: ov-base.h:425
void lock(void)
Definition: ov.h:1332
Array< std::string > cellstr_value(void) const
Definition: ov.h:920
octave_value_list do_multi_index_op(int nargout, const octave_value_list &idx)
Definition: ov.cc:1527
static const builtin_type_t btyp
Definition: ov-base.h:118
virtual octave_base_value * clone(void) const
Definition: ov-base.h:221
void print_info(std::ostream &os, const std::string &prefix="") const
Definition: ov.cc:2622
long int long_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:757
virtual octave_base_value * try_narrowing_conversion(void)
Definition: ov-base.h:258
FloatNDArray float_array_value(bool frc_str_conv=false) const
Definition: ov.h:796
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
void dump(std::ostream &os) const
Definition: ov.h:1338
virtual octave_base_value * find_parent_class(const std::string &)
Definition: ov-base.h:602
#define DECLARE_OV_BASE_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:151
octave_value as_single(void) const
Definition: ov.h:392
unsigned long int ulong_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:761
octave_uint8 uint8_scalar_value(void) const
Definition: ov.h:872
virtual bool is_builtin_function(void) const
Definition: ov-base.h:465
virtual bool is_integer_type(void) const
Definition: ov-base.h:429
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:935
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
Definition: ov.cc:2192
octave_value as_int16(void) const
Definition: ov.h:395
#define OCTINTERP_API
Definition: mexproto.h:69
octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
Definition: ov.h:1202
uint64_t uint64_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:769
octave_value squeeze(void) const
Definition: ov.h:382
virtual bool is_all_va_args(void) const
Definition: ov-base.h:397
octave_value as_int8(void) const
Definition: ov.h:394
virtual bool is_object(void) const
Definition: ov-base.h:387
void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov.h:1216
std::string string_value(bool force=false) const
Definition: ov.h:908
FloatDiagMatrix float_diag_matrix_value(bool force=false) const
Definition: ov.h:847
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
virtual int ndims(void) const
Definition: ov-base.h:326
int nint_value(bool frc_str_conv=false) const
Definition: ov.h:753
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov.h:1292
FloatComplex float_complex_value(bool frc_str_conv=false) const
Definition: ov.h:802
virtual bool is_bool_scalar(void) const
Definition: ov-base.h:369
Range range_value(void) const
Definition: ov.h:923
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
Definition: ov.h:816
virtual bool is_int16_type(void) const
Definition: ov-base.h:413
octave_user_function * user_function_value(bool silent=false) const
Definition: ov.cc:1711
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov.h:1281
bool save_as_floats
Definition: load-save.cc:1581
octave_value as_uint32(void) const
Definition: ov.h:401
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
Definition: ov.h:841
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov.h:1219
virtual bool is_int32_type(void) const
Definition: ov-base.h:415
bool btyp_isnumeric(builtin_type_t btyp)
Definition: ov-base.h:90
virtual bool is_real_scalar(void) const
Definition: ov-base.h:361
int64_t octave_hdf5_id
virtual bool is_instance_of(const std::string &) const
Definition: ov-base.h:608
virtual bool print_as_scalar(void) const
Definition: ov-base.h:637
virtual bool is_complex_type(void) const
Definition: ov-base.h:433
virtual bool is_user_script(void) const
Definition: ov-base.h:459
string_vector map_keys(void) const
Definition: ov.h:930
idx type
Definition: ov.cc:3129
virtual bool is_user_function(void) const
Definition: ov-base.h:461
Definition: dMatrix.h:37
octave_value all(int dim=0) const
Definition: ov.h:613
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:838
string_vector parent_class_names(void) const
Definition: ov.h:939
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
Definition: sub2ind.cc:255
bool btyp_isinteger(builtin_type_t btyp)
Definition: ov-base.h:93
string_vector string_vector_value(bool pad=false) const
Definition: ov.h:911
Matrix matrix_value(bool frc_str_conv=false) const
Definition: ov.h:787
virtual bool is_dld_function(void) const
Definition: ov-base.h:467
void decrement_indent_level(void) const
Definition: ov-base.h:827
virtual bool is_defined(void) const
Definition: ov-base.h:353
virtual bool is_sq_string(void) const
Definition: ov-base.h:381
virtual bool is_java(void) const
Definition: ov-base.h:391
charMatrix char_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:828
virtual octave_base_value * unique_clone(void)
Definition: ov-base.h:231
octave_function * function_value(bool silent=false) const
Definition: ov.cc:1705
bool save_ascii(std::ostream &os)
Definition: ov.h:1277
MatrixType matrix_type(void) const
Definition: ov.h:527
DiagMatrix diag_matrix_value(bool force=false) const
Definition: ov.h:844
virtual bool is_constant(void) const
Definition: ov-base.h:449
void grab(void)
Definition: ov-base.h:800
unsigned short int ushort_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:743
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition: ov.h:1317
virtual bool islocked(void) const
Definition: ov-base.h:704
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov.cc:1548
virtual ~octave_base_value(void)
Definition: ov-base.h:217
T::size_type numel(const T &str)
Definition: oct-string.cc:61
NDArray array_value(bool frc_str_conv=false) const
Definition: ov.h:793
octave_base_value(const octave_base_value &)
Definition: ov-base.h:215
octave_int8 int8_scalar_value(void) const
Definition: ov.h:860
virtual bool is_float_type(void) const
Definition: ov-base.h:409
virtual void erase_subfunctions(void)
Definition: ov-base.h:471
octave_scalar_map scalar_map_value(void) const
Definition: ov.cc:1699
type_conv_info(type_conv_fcn f=0, int t=-1)
Definition: ov-base.h:196
void unlock(void)
Definition: ov.h:1334
bool load_ascii(std::istream &is)
Definition: ov.h:1279
bool bool_value(bool warn=false) const
Definition: ov.h:819
virtual bool is_complex_scalar(void) const
Definition: ov-base.h:365
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:805
virtual bool is_string(void) const
Definition: ov-base.h:379
int current_print_indent_level(void) const
Definition: ov-base.h:830
virtual bool is_uint16_type(void) const
Definition: ov-base.h:421
octave_map map(dims)
Complex complex_value(bool frc_str_conv=false) const
Definition: ov.h:799
FloatMatrix float_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:790
idx subsasgn(val, idx, 0) esult
Definition: ov.cc:3129
void print_with_name(std::ostream &os, const std::string &name) const
Definition: ov.h:1225
virtual bool is_matrix_type(void) const
Definition: ov-base.h:439
virtual bool is_inline_function(void) const
Definition: ov-base.h:455
the element is set to zero In other the statement xample y
Definition: data.cc:5342
octave_int64 int64_scalar_value(void) const
Definition: ov.h:869
virtual builtin_type_t builtin_type(void) const
Definition: ov-base.h:403
OCTINTERP_API builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
Definition: ov-base.cc:60
virtual bool is_char_matrix(void) const
Definition: ov-base.h:373
octave_uint64 uint64_scalar_value(void) const
Definition: ov.h:881
octave_value fast_elem_extract(octave_idx_type n) const
Definition: ov.h:1420
octave_value_list list_value(void) const
Definition: ov.cc:1741
std::complex< float > FloatComplex
Definition: oct-cmplx.h:32
virtual bool fast_elem_insert(octave_idx_type n, const octave_value &x)
Definition: ov.h:1428
PermMatrix perm_matrix_value(void) const
Definition: ov.h:857
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable or any other valid Octave code The number of return their size
Definition: input.cc:871
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:834
virtual bool is_uint8_type(void) const
Definition: ov-base.h:419
void reset_indent_level(void) const
Definition: ov-base.h:821
virtual bool is_diag_matrix(void) const
Definition: ov-base.h:375
std::complex< double > Complex
Definition: oct-cmplx.h:31
octave_fcn_inline * fcn_inline_value(bool silent=false) const
Definition: ov.cc:1735
double double_value(bool frc_str_conv=false) const
Definition: ov.h:775
static bool beginning_of_line
Definition: ov-base.h:855
write the output to stdout if nargout is
Definition: load-save.cc:1576
void release(void)
Definition: ov-base.h:807
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
octave_user_script * user_script_value(bool silent=false) const
Definition: ov.cc:1717
the second is matched to the second specifier and placed in the second column and so forth If there are more words than specifiers then the process is repeated until all words have been processed or the limit imposed by any(non-whitespace) text in the format that is not one of these specifiers is considered a literal.If there is a literal between two format specifiers then that same literal must appear in the input stream between the matching words.The following specifiers are valid
Definition: file-io.cc:1491
octave_uint32 uint32_scalar_value(void) const
Definition: ov.h:878
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov.h:1284
uint32NDArray uint32_array_value(void) const
Definition: ov.h:902
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
octave_value as_uint64(void) const
Definition: ov.h:402
dim_vector dv
Definition: sub2ind.cc:263
uint16NDArray uint16_array_value(void) const
Definition: ov.h:899
void convert_to_row_or_column_vector(void)
Definition: ov.h:1210
octave_uint16 uint16_scalar_value(void) const
Definition: ov.h:875
octave_idx_type rows(void) const
Definition: ov-base.h:312
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
short int short_value(bool req_int=false, bool frc_str_conv=false) const
Definition: ov.h:739
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov.h:454