GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-base.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2018 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
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License 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 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if defined (HAVE_CONFIG_H)
25 # include "config.h"
26 #endif
27 
28 #include <iostream>
29 #include <limits>
30 
31 #include "lo-ieee.h"
32 #include "lo-mappers.h"
33 
34 #include "call-stack.h"
35 #include "defun.h"
36 #include "errwarn.h"
37 #include "interpreter-private.h"
38 #include "interpreter.h"
39 #include "mxarray.h"
40 #include "oct-hdf5.h"
41 #include "oct-lvalue.h"
42 #include "oct-map.h"
43 #include "oct-stream.h"
44 #include "ops.h"
45 #include "ov-base.h"
46 #include "ov-cell.h"
47 #include "ov-ch-mat.h"
48 #include "ov-classdef.h"
49 #include "ov-complex.h"
50 #include "ov-cx-mat.h"
51 #include "ov-fcn-handle.h"
52 #include "ov-range.h"
53 #include "ov-re-mat.h"
54 #include "ov-scalar.h"
55 #include "ov-str-mat.h"
56 #include "ovl.h"
57 #include "parse.h"
58 #include "pr-flt-fmt.h"
59 #include "pr-output.h"
60 #include "utils.h"
61 #include "variables.h"
62 
64 {
66 
67  if (x == btyp_bool)
68  x = btyp_double;
69  if (y == btyp_bool)
70  y = btyp_double;
71 
73  retval = static_cast<builtin_type_t> (x | y);
74  else if (x <= btyp_uint64 && y <= btyp_float)
75  retval = x;
76  else if (x <= btyp_float && y <= btyp_uint64)
77  retval = y;
78  else if ((x >= btyp_int8 && x <= btyp_int64
79  && y >= btyp_int8 && y <= btyp_int64)
80  || (x >= btyp_uint8 && x <= btyp_uint64
81  && y >= btyp_uint8 && y <= btyp_uint64))
82  retval = (x > y) ? x : y;
83 
84  return retval;
85 }
86 
88 {
89  "double", "single", "double", "single",
90  "int8", "int16", "int32", "int64",
91  "uint8", "uint16", "uint32", "uint64",
92  "logical", "char",
93  "struct", "cell", "function_handle"
94 };
95 
97  "<unknown type>", "unknown");
98 
99 // TRUE means to perform automatic sparse to real mutation if there
100 // is memory to be saved
101 bool Vsparse_auto_mutate = false;
102 
105 {
106  return resize (dim_vector ()).clone ();
107 }
108 
111 {
112  std::string nm = type_name ();
113  error ("squeeze: invalid operation for %s type", nm.c_str ());
114 }
115 
118 {
119  err_wrong_type_arg ("full: invalid operation for %s type", type_name ());
120 }
121 
124 {
125  err_invalid_conversion (type_name (), "double");
126 }
127 
130 {
131  err_invalid_conversion (type_name (), "single");
132 }
133 
136 {
137  err_invalid_conversion (type_name (), "int8");
138 }
139 
142 {
143  err_invalid_conversion (type_name (), "int16");
144 }
145 
148 {
149  err_invalid_conversion (type_name (), "int32");
150 }
151 
154 {
155  err_invalid_conversion (type_name (), "int64");
156 }
157 
160 {
161  err_invalid_conversion (type_name (), "uint8");
162 }
163 
166 {
167  err_invalid_conversion (type_name (), "uint16");
168 }
169 
172 {
173  err_invalid_conversion (type_name (), "uint32");
174 }
175 
178 {
179  err_invalid_conversion (type_name (), "uint64");
180 }
181 
182 Matrix
184 {
185  const dim_vector dv = dims ();
186  Matrix mdv (1, dv.ndims ());
187  for (octave_idx_type i = 0; i < dv.ndims (); i++)
188  mdv(i) = dv(i);
189  return mdv;
190 }
191 
194 {
195  return dims_to_numel (dims (), idx);
196 }
197 
200  const std::list<octave_value_list>&)
201 {
202  std::string nm = type_name ();
203  error ("can't perform indexing operations for %s type", nm.c_str ());
204 }
205 
208  const std::list<octave_value_list>&, int)
209 {
210  std::string nm = type_name ();
211  error ("can't perform indexing operations for %s type", nm.c_str ());
212 }
213 
216  const std::list<octave_value_list>& idx,
217  bool /* auto_add */)
218 {
219  // This way we may get a more meaningful error message.
220  return subsref (type, idx);
221 }
222 
225 {
226  std::string nm = type_name ();
227  error ("can't perform indexing operations for %s type", nm.c_str ());
228 }
229 
231 octave_base_value::index_vector (bool /* require_integers */) const
232 {
233  std::string nm = '<' + type_name () + '>';
234  octave::err_invalid_index (nm.c_str ());
235 }
236 
239  const std::list<octave_value_list>& idx,
240  const octave_value& rhs)
241 {
243 
244  if (is_defined ())
245  {
246  if (! isnumeric ())
247  {
248  std::string nm = type_name ();
249  error ("can't perform indexed assignment for %s type", nm.c_str ());
250  }
251 
252  switch (type[0])
253  {
254  case '(':
255  {
256  if (type.length () == 1)
257  retval = numeric_assign (type, idx, rhs);
258  else if (isempty ())
259  {
260  // Allow conversion of empty matrix to some other
261  // type in cases like
262  //
263  // x = []; x(i).f = rhs
264 
266 
267  retval = tmp.subsasgn (type, idx, rhs);
268  }
269  else
270  {
271  std::string nm = type_name ();
272  error ("in indexed assignment of %s, last rhs index must be ()",
273  nm.c_str ());
274  }
275  }
276  break;
277 
278  case '{':
279  case '.':
280  {
281  std::string nm = type_name ();
282  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
283  }
284  break;
285 
286  default:
287  panic_impossible ();
288  }
289  }
290  else
291  {
292  // Create new object of appropriate type for given index and rhs
293  // types and then call undef_subsasgn for that object.
294 
296 
297  retval = tmp.undef_subsasgn (type, idx, rhs);
298  }
299 
300  return retval;
301 }
302 
305  const std::list<octave_value_list>& idx,
306  const octave_value& rhs)
307 {
308  // In most cases, undef_subsasgn is handled the sams as subsasgn. One
309  // exception is octave_class objects.
310 
311  return subsasgn (type, idx, rhs);
312 }
313 
316 {
317  err_wrong_type_arg ("octave_base_value::nnz ()", type_name ());
318 }
319 
322 {
323  return numel ();
324 }
325 
328 {
329  err_wrong_type_arg ("octave_base_value::nfields ()", type_name ());
330 }
331 
334 {
335  err_wrong_type_arg ("octave_base_value::reshape ()", type_name ());
336 }
337 
340 {
341  err_wrong_type_arg ("octave_base_value::permute ()", type_name ());
342 }
343 
346 {
347  err_wrong_type_arg ("octave_base_value::resize ()", type_name ());
348 }
349 
352 {
353  err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
354 }
355 
358 {
359  err_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
360 }
361 
364 {
365  return 0.0;
366 }
367 
370 {
371  return 0.0;
372 }
373 
375 octave_base_value::convert_to_str (bool pad, bool force, char type) const
376 {
378 
379  if (! force && isnumeric ())
380  warn_implicit_conversion ("Octave:num-to-str",
381  type_name (), retval.type_name ());
382 
383  return retval;
384 }
385 
388 {
389  err_wrong_type_arg ("octave_base_value::convert_to_str_internal ()",
390  type_name ());
391 }
392 
393 void
395 {
397  ("octave_base_value::convert_to_row_or_column_vector ()", type_name ());
398 }
399 
400 void
401 octave_base_value::print (std::ostream&, bool)
402 {
403  err_wrong_type_arg ("octave_base_value::print ()", type_name ());
404 }
405 
406 void
407 octave_base_value::print_raw (std::ostream&, bool) const
408 {
409  err_wrong_type_arg ("octave_base_value::print_raw ()", type_name ());
410 }
411 
412 bool
414  const std::string& name) const
415 {
416  indent (os);
417 
418  if (print_as_scalar ())
419  os << name << " = ";
420  else
421  {
422  os << name << " =";
423  newline (os);
424  if (! Vcompact_format)
425  newline (os);
426 
427  return true;
428  }
429 
430  return false;
431 }
432 
433 void
434 octave_base_value::print_with_name (std::ostream& output_buf,
435  const std::string& name,
436  bool print_padding)
437 {
438  bool pad_after = print_name_tag (output_buf, name);
439 
440  print (output_buf);
441 
442  if (print_padding && pad_after && ! Vcompact_format)
443  newline (output_buf);
444 }
445 
448 {
449  return float_display_format ();
450 }
451 
452 void
454  const std::string& /* prefix */) const
455 {
456  os << "no info for type: " << type_name () << "\n";
457 }
458 
459 #define INT_CONV_METHOD(T, F) \
460  T \
461  octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
462  { \
463  T retval = 0; \
464  \
465  double d = 0.0; \
466  \
467  try \
468  { \
469  d = double_value (frc_str_conv); \
470  } \
471  catch (octave::execution_exception& e) \
472  { \
473  err_wrong_type_arg (e, "octave_base_value::" #F "_value ()", type_name ()); \
474  } \
475  \
476  if (require_int && octave::math::x_nint (d) != d) \
477  error_with_cfn ("conversion of %g to " #T " value failed", d); \
478  else if (d < std::numeric_limits<T>::min ()) \
479  retval = std::numeric_limits<T>::min (); \
480  else if (d > std::numeric_limits<T>::max ()) \
481  retval = std::numeric_limits<T>::max (); \
482  else \
483  retval = static_cast<T> (octave::math::fix (d)); \
484  \
485  return retval; \
486  }
487 
488 INT_CONV_METHOD (short int, short)
489 INT_CONV_METHOD (unsigned short int, ushort)
490 
491 INT_CONV_METHOD (int, int)
492 INT_CONV_METHOD (unsigned int, uint)
493 
494 INT_CONV_METHOD (long int, long)
495 INT_CONV_METHOD (unsigned long int, ulong)
496 
497 INT_CONV_METHOD (int64_t, int64)
498 INT_CONV_METHOD (uint64_t, uint64)
499 
500 int
501 octave_base_value::nint_value (bool frc_str_conv) const
502 {
503  double d = 0.0;
504 
505  try
506  {
507  d = double_value (frc_str_conv);
508  }
509  catch (octave::execution_exception& e)
510  {
511  err_wrong_type_arg (e, "octave_base_value::nint_value ()", type_name ());
512  }
513 
514  if (octave::math::isnan (d))
515  error ("conversion of NaN to integer value failed");
516 
517  return static_cast<int> (octave::math::fix (d));
518 }
519 
520 double
522 {
523  err_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
524 }
525 
526 float
528 {
529  err_wrong_type_arg ("octave_base_value::float_value ()", type_name ());
530 }
531 
532 Cell
534 {
535  err_wrong_type_arg ("octave_base_value::cell_value()", type_name ());
536 }
537 
538 Matrix
540 {
541  err_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
542 }
543 
546 {
547  err_wrong_type_arg ("octave_base_value::float_matrix_value()", type_name ());
548 }
549 
550 NDArray
552 {
553  err_wrong_type_arg ("octave_base_value::array_value()", type_name ());
554 }
555 
558 {
559  err_wrong_type_arg ("octave_base_value::float_array_value()", type_name ());
560 }
561 
562 Complex
564 {
565  err_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
566 }
567 
570 {
571  err_wrong_type_arg ("octave_base_value::float_complex_value()", type_name ());
572 }
573 
576 {
577  err_wrong_type_arg ("octave_base_value::complex_matrix_value()",
578  type_name ());
579 }
580 
583 {
584  err_wrong_type_arg ("octave_base_value::float_complex_matrix_value()",
585  type_name ());
586 }
587 
590 {
591  err_wrong_type_arg ("octave_base_value::complex_array_value()", type_name ());
592 }
593 
596 {
597  err_wrong_type_arg ("octave_base_value::float_complex_array_value()",
598  type_name ());
599 }
600 
601 bool
603 {
604  err_wrong_type_arg ("octave_base_value::bool_value()", type_name ());
605 }
606 
609 {
610  err_wrong_type_arg ("octave_base_value::bool_matrix_value()", type_name ());
611 }
612 
615 {
616  err_wrong_type_arg ("octave_base_value::bool_array_value()", type_name ());
617 }
618 
621 {
622  octave_value tmp = convert_to_str (false, force);
623 
624  return tmp.char_matrix_value ();
625 }
626 
629 {
630  err_wrong_type_arg ("octave_base_value::char_array_value()", type_name ());
631 }
632 
635 {
636  err_wrong_type_arg ("octave_base_value::sparse_matrix_value()", type_name ());
637 }
638 
641 {
642  err_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()",
643  type_name ());
644 }
645 
648 {
649  err_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()",
650  type_name ());
651 }
652 
655 {
656  err_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ());
657 }
658 
661 {
662  err_wrong_type_arg ("octave_base_value::float_diag_matrix_value()",
663  type_name ());
664 }
665 
668 {
669  err_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()",
670  type_name ());
671 }
672 
675 {
676  err_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()",
677  type_name ());
678 }
679 
682 {
683  err_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ());
684 }
685 
688 {
689  err_wrong_type_arg ("octave_base_value::int8_scalar_value()", type_name ());
690 }
691 
694 {
695  err_wrong_type_arg ("octave_base_value::int16_scalar_value()", type_name ());
696 }
697 
700 {
701  err_wrong_type_arg ("octave_base_value::int32_scalar_value()", type_name ());
702 }
703 
706 {
707  err_wrong_type_arg ("octave_base_value::int64_scalar_value()", type_name ());
708 }
709 
712 {
713  err_wrong_type_arg ("octave_base_value::uint8_scalar_value()", type_name ());
714 }
715 
718 {
719  err_wrong_type_arg ("octave_base_value::uint16_scalar_value()", type_name ());
720 }
721 
724 {
725  err_wrong_type_arg ("octave_base_value::uint32_scalar_value()", type_name ());
726 }
727 
730 {
731  err_wrong_type_arg ("octave_base_value::uint64_scalar_value()", type_name ());
732 }
733 
736 {
737  err_wrong_type_arg ("octave_base_value::int8_array_value()", type_name ());
738 }
739 
742 {
743  err_wrong_type_arg ("octave_base_value::int16_array_value()", type_name ());
744 }
745 
748 {
749  err_wrong_type_arg ("octave_base_value::int32_array_value()", type_name ());
750 }
751 
754 {
755  err_wrong_type_arg ("octave_base_value::int64_array_value()", type_name ());
756 }
757 
760 {
761  err_wrong_type_arg ("octave_base_value::uint8_array_value()", type_name ());
762 }
763 
766 {
767  err_wrong_type_arg ("octave_base_value::uint16_array_value()", type_name ());
768 }
769 
772 {
773  err_wrong_type_arg ("octave_base_value::uint32_array_value()", type_name ());
774 }
775 
778 {
779  err_wrong_type_arg ("octave_base_value::uint64_array_value()", type_name ());
780 }
781 
784 {
785  octave_value tmp = convert_to_str (pad, true);
786 
787  return tmp.string_vector_value ();
788 }
789 
792 {
793  octave_value tmp = convert_to_str (force);
794 
795  return tmp.string_value ();
796 }
797 
800 {
802 
803  return std::string ();
804 }
805 
808 {
809  err_wrong_type_arg ("octave_base_value::cellstr_value()", type_name ());
810 }
811 
812 Range
814 {
815  err_wrong_type_arg ("octave_base_value::range_value()", type_name ());
816 }
817 
820 {
821  err_wrong_type_arg ("octave_base_value::map_value()", type_name ());
822 }
823 
826 {
827  octave_map tmp = map_value ();
828 
829  if (tmp.numel () != 1)
830  error ("invalid conversion of multi-dimensional struct to scalar struct");
831 
832  return octave_scalar_map (tmp.checkelem (0));
833 }
834 
837 {
838  err_wrong_type_arg ("octave_base_value::map_keys()", type_name ());
839 }
840 
841 size_t
843 {
844  err_wrong_type_arg ("octave_base_value::nparents()", type_name ());
845 }
846 
847 std::list<std::string>
849 {
850  err_wrong_type_arg ("octave_base_value::parent_class_name_list()",
851  type_name ());
852 }
853 
856 {
857  err_wrong_type_arg ("octave_base_value::parent_class_names()", type_name ());
858 }
859 
862 {
863  if (! silent)
864  err_wrong_type_arg ("octave_base_value::classdef_object_value()",
865  type_name ());
866 
867  return nullptr;
868 }
869 
872 {
873  if (! silent)
874  err_wrong_type_arg ("octave_base_value::function_value()", type_name ());
875 
876  return nullptr;
877 }
878 
881 {
882  if (! silent)
883  err_wrong_type_arg ("octave_base_value::user_function_value()",
884  type_name ());
885  return nullptr;
886 }
887 
890 {
891  if (! silent)
892  err_wrong_type_arg ("octave_base_value::user_script_value()", type_name ());
893 
894  return nullptr;
895 }
896 
899 {
900  if (! silent)
901  err_wrong_type_arg ("octave_base_value::user_code_value()", type_name ());
902 
903  return nullptr;
904 }
905 
908 {
909  if (! silent)
910  err_wrong_type_arg ("octave_base_value::fcn_handle_value()", type_name ());
911 
912  return nullptr;
913 }
914 
917 {
918  if (! silent)
919  err_wrong_type_arg ("octave_base_value::fcn_inline_value()", type_name ());
920 
921  return nullptr;
922 }
923 
926 {
927  err_wrong_type_arg ("octave_base_value::list_value()", type_name ());
928 }
929 
930 bool
932 {
933  err_wrong_type_arg ("octave_base_value::save_ascii()", type_name ());
934 }
935 
936 bool
938 {
939  err_wrong_type_arg ("octave_base_value::load_ascii()", type_name ());
940 }
941 
942 bool
943 octave_base_value::save_binary (std::ostream&, bool&)
944 {
945  err_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
946 }
947 
948 bool
949 octave_base_value::load_binary (std::istream&, bool,
951 {
952  err_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
953 }
954 
955 bool
957 {
958  err_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
959 }
960 
961 bool
963 {
964  err_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
965 }
966 
967 int
970 {
971  err_wrong_type_arg ("octave_base_value::write()", type_name ());
972 }
973 
974 mxArray *
976 {
977  return nullptr;
978 }
979 
982 {
983  err_wrong_type_arg ("octave_base_value::diag ()", type_name ());
984 }
985 
988 {
989  err_wrong_type_arg ("octave_base_value::diag ()", type_name ());
990 }
991 
994 {
995  err_wrong_type_arg ("octave_base_value::sort ()", type_name ());
996 }
997 
1000  octave_idx_type, sortmode) const
1001 {
1002  err_wrong_type_arg ("octave_base_value::sort ()", type_name ());
1003 }
1004 
1005 sortmode
1007 {
1008  err_wrong_type_arg ("octave_base_value::issorted ()", type_name ());
1009 }
1010 
1013 {
1014  err_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ());
1015 }
1016 
1017 sortmode
1019 {
1020  err_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ());
1021 }
1022 
1023 const char *
1025 {
1026  static const char *names[num_unary_mappers] =
1027  {
1028  "abs",
1029  "acos",
1030  "acosh",
1031  "angle",
1032  "arg",
1033  "asin",
1034  "asinh",
1035  "atan",
1036  "atanh",
1037  "cbrt",
1038  "ceil",
1039  "conj",
1040  "cos",
1041  "cosh",
1042  "erf",
1043  "erfinv",
1044  "erfcinv",
1045  "erfc",
1046  "erfcx",
1047  "erfi",
1048  "dawson",
1049  "exp",
1050  "expm1",
1051  "isfinite",
1052  "fix",
1053  "floor",
1054  "gamma",
1055  "imag",
1056  "isinf",
1057  "isna",
1058  "isnan",
1059  "lgamma",
1060  "log",
1061  "log2",
1062  "log10",
1063  "log1p",
1064  "real",
1065  "round",
1066  "roundb",
1067  "signum",
1068  "sin",
1069  "sinh",
1070  "sqrt",
1071  "tan",
1072  "tanh",
1073  "isalnum",
1074  "isalpha",
1075  "isascii",
1076  "iscntrl",
1077  "isdigit",
1078  "isgraph",
1079  "islower",
1080  "isprint",
1081  "ispunct",
1082  "isspace",
1083  "isupper",
1084  "isxdigit",
1085  "signbit",
1086  "tolower",
1087  "toupper"
1088  };
1089 
1090  if (umap < 0 || umap >= num_unary_mappers)
1091  return "unknown";
1092  else
1093  return names[umap];
1094 }
1095 
1096 void
1098 {
1100  ("Octave:load-save-unavailable",
1101  "%s: loading %s files not available in this version of Octave",
1102  t_name.c_str (), type);
1103 }
1104 
1105 void
1107 {
1109  ("Octave:load-save-unavailable",
1110  "%s: saving %s files not available in this version of Octave",
1111  t_name.c_str (), type);
1112 }
1113 
1114 void
1116 {
1118 }
1119 
1122 {
1123  error ("%s: not defined for %s", get_umap_name (umap), type_name ().c_str ());
1124 }
1125 
1126 void
1128 {
1129  err_wrong_type_arg ("octave_base_value::lock ()", type_name ());
1130 }
1131 
1132 void
1134 {
1135  err_wrong_type_arg ("octave_base_value::unlock ()", type_name ());
1136 }
1137 
1140 {
1141  std::map<std::string, octave_value> m
1142  = {{ "class", this->class_name () },
1143  { "type", this->type_name () },
1144  { "dims", this->dims().as_array () }};
1145 
1146  return octave_value (m);
1147 }
1148 
1149 OCTAVE_NORETURN static
1150 void
1152 {
1153  error ("assignment of '%s' to indexed '%s' not implemented",
1154  tn2.c_str (), tn1.c_str ());
1155 }
1156 
1157 OCTAVE_NORETURN static
1158 void
1160 {
1161  error ("type conversion for assignment of '%s' to indexed '%s' failed",
1162  tn2.c_str (), tn1.c_str ());
1163 }
1164 
1165 OCTAVE_NORETURN static
1166 void
1168  const std::string& tn2)
1169 {
1170  error ("operator %s: no conversion for assignment of '%s' to indexed '%s'",
1171  on.c_str (), tn2.c_str (), tn1.c_str ());
1172 }
1173 
1176  const std::list<octave_value_list>& idx,
1177  const octave_value& rhs)
1178 {
1180 
1181  if (idx.front ().empty ())
1182  error ("missing index in indexed assignment");
1183 
1184  int t_lhs = type_id ();
1185  int t_rhs = rhs.type_id ();
1186 
1187  octave::type_info& ti
1188  = octave::__get_type_info__ ("octave_base_value::numeric_assign");
1189 
1191  = ti.lookup_assign_op (octave_value::op_asn_eq, t_lhs, t_rhs);
1192 
1193  bool done = false;
1194 
1195  if (f)
1196  {
1197  f (*this, idx.front (), rhs.get_rep ());
1198 
1199  done = true;
1200  }
1201 
1202  if (done)
1203  {
1204  count++;
1205  retval = octave_value (this);
1206  }
1207  else
1208  {
1209  int t_result = ti.lookup_pref_assign_conv (t_lhs, t_rhs);
1210 
1211  if (t_result >= 0)
1212  {
1214  = ti.lookup_widening_op (t_lhs, t_result);
1215 
1216  if (! cf)
1218 
1219  octave_base_value *tmp = cf (*this);
1220 
1221  if (! tmp)
1223 
1224  octave_value val (tmp);
1225 
1226  retval = val.subsasgn (type, idx, rhs);
1227 
1228  done = true;
1229  }
1230 
1231  if (! done)
1232  {
1233  octave_value tmp_rhs;
1234 
1236  = rhs.numeric_conversion_function ();
1237 
1240 
1241  // Try biased (one-sided) conversions first.
1242  if (cf_rhs.type_id () >= 0
1244  t_lhs, cf_rhs.type_id ())
1245  || ti.lookup_pref_assign_conv (t_lhs,
1246  cf_rhs.type_id ()) >= 0))
1247  cf_this = nullptr;
1248  else if (cf_this.type_id () >= 0
1250  cf_this.type_id (), t_rhs)
1251  || ti.lookup_pref_assign_conv (cf_this.type_id (),
1252  t_rhs) >= 0))
1253  cf_rhs = nullptr;
1254 
1255  if (cf_rhs)
1256  {
1257  octave_base_value *tmp = cf_rhs (rhs.get_rep ());
1258 
1259  if (! tmp)
1261 
1262  tmp_rhs = octave_value (tmp);
1263  }
1264  else
1265  tmp_rhs = rhs;
1266 
1267  count++;
1268  octave_value tmp_lhs = octave_value (this);
1269 
1270  if (cf_this)
1271  {
1272  octave_base_value *tmp = cf_this (*this);
1273 
1274  if (! tmp)
1276 
1277  tmp_lhs = octave_value (tmp);
1278  }
1279 
1280  if (! cf_this && ! cf_rhs)
1283  type_name (), rhs.type_name ());
1284 
1285  retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
1286 
1287  done = true;
1288  }
1289  }
1290 
1291  // The assignment may have converted to a type that is wider than necessary.
1292 
1293  retval.maybe_mutate ();
1294 
1295  return retval;
1296 }
1297 
1298 // Current indentation.
1300 
1301 // TRUE means we are at the beginning of a line.
1303 
1304 // Each print() function should call this before printing anything.
1305 //
1306 // This doesn't need to be fast, but isn't there a better way?
1307 
1308 void
1309 octave_base_value::indent (std::ostream& os) const
1310 {
1311  assert (curr_print_indent_level >= 0);
1312 
1313  if (beginning_of_line)
1314  {
1315  // FIXME: do we need this?
1316  // os << prefix;
1317 
1318  for (int i = 0; i < curr_print_indent_level; i++)
1319  os << ' ';
1320 
1321  beginning_of_line = false;
1322  }
1323 }
1324 
1325 // All print() functions should use this to print new lines.
1326 
1327 void
1328 octave_base_value::newline (std::ostream& os) const
1329 {
1330  os << "\n";
1331 
1332  beginning_of_line = true;
1333 }
1334 
1335 // For resetting print state.
1336 
1337 void
1339 {
1340  beginning_of_line = true;
1342 }
1343 
1346 {
1347  return octave_value ();
1348 }
1349 
1350 bool
1352 {
1353  return false;
1354 }
1355 
1356 bool
1358 {
1359  return false;
1360 }
1361 
1362 static octave_base_value *
1364 {
1365  return new octave_matrix ();
1366 }
1367 
1368 static octave_base_value *
1370 {
1371  return new octave_complex_matrix ();
1372 }
1373 
1374 static octave_base_value *
1376 {
1377  return new octave_char_matrix_str ();
1378 }
1379 
1380 static octave_base_value *
1382 {
1383  return new octave_cell ();
1384 }
1385 
1386 static inline octave_value_list
1388 {
1390 
1391  for (octave_idx_type i = 0; i < ovl.length (); i++)
1392  {
1393  if (retval(i).is_magic_colon ())
1394  retval(i) = ":";
1395  }
1396 
1397  return retval;
1398 }
1399 
1402  const std::list<octave_value_list>& idx,
1403  const std::string& who)
1404 {
1405  size_t len = type.length ();
1406 
1407  if (len != idx.size ())
1408  error ("invalid index for %s", who.c_str ());
1409 
1410  Cell type_field (1, len);
1411  Cell subs_field (1, len);
1412 
1413  std::list<octave_value_list>::const_iterator p = idx.begin ();
1414 
1415  for (size_t i = 0; i < len; i++)
1416  {
1417  char t = type[i];
1418 
1419  switch (t)
1420  {
1421  case '(':
1422  type_field(i) = "()";
1423  subs_field(i) = Cell (sanitize (*p++));
1424  break;
1425 
1426  case '{':
1427  type_field(i) = "{}";
1428  subs_field(i) = Cell (sanitize (*p++));
1429  break;
1430 
1431  case '.':
1432  {
1433  type_field(i) = ".";
1434 
1435  octave_value_list vlist = *p++;
1436 
1437  if (vlist.length () != 1)
1438  error ("only single argument permitted for '.' index");
1439 
1440  octave_value val = vlist(0);
1441 
1442  if (! val.is_string ())
1443  error ("string argument required for '.' index");
1444 
1445  subs_field(i) = val;
1446  }
1447  break;
1448 
1449  default:
1450  panic_impossible ();
1451  break;
1452  }
1453  }
1454 
1455  octave_map m;
1456 
1457  m.assign ("type", type_field);
1458  m.assign ("subs", subs_field);
1459 
1460  return m;
1461 }
1462 
1463 bool
1465 {
1466  octave::call_stack& cs = octave::__get_call_stack__ ("called_from_builtin");
1467 
1468  octave_function *fcn = cs.caller ();
1469 
1470  // FIXME: we probably need a better check here, or some other
1471  // mechanism to avoid overloaded functions when builtin is used.
1472  // For example, what if someone overloads the builtin function?
1473  // Also, are there other places where using builtin is not properly
1474  // avoiding dispatch?
1475 
1476  return (fcn && fcn->name () == "builtin");
1477 }
1478 
1479 void
1481 {
1492 
1495  complex_matrix_conv);
1498 }
1499 
1500 DEFUN (sparse_auto_mutate, args, nargout,
1501  doc: /* -*- texinfo -*-
1502 @deftypefn {} {@var{val} =} sparse_auto_mutate ()
1503 @deftypefnx {} {@var{old_val} =} sparse_auto_mutate (@var{new_val})
1504 @deftypefnx {} {} sparse_auto_mutate (@var{new_val}, "local")
1505 Query or set the internal variable that controls whether Octave will
1506 automatically mutate sparse matrices to full matrices to save memory.
1507 
1508 For example:
1509 
1510 @example
1511 @group
1512 s = speye (3);
1513 sparse_auto_mutate (false);
1514 s(:, 1) = 1;
1515 typeinfo (s)
1516 @result{} sparse matrix
1517 sparse_auto_mutate (true);
1518 s(1, :) = 1;
1519 typeinfo (s)
1520 @result{} matrix
1521 @end group
1522 @end example
1523 
1524 When called from inside a function with the @qcode{"local"} option, the
1525 variable is changed locally for the function and any subroutines it calls.
1526 The original variable value is restored when exiting the function.
1527 @end deftypefn */)
1528 {
1529  return SET_INTERNAL_VARIABLE (sparse_auto_mutate);
1530 }
1531 
1532 /*
1533 %!test
1534 %! s = speye (3);
1535 %! sparse_auto_mutate (false);
1536 %! s(:, 1) = 1;
1537 %! assert (typeinfo (s), "sparse matrix");
1538 %! sparse_auto_mutate (true);
1539 %! s(1, :) = 1;
1540 %! assert (typeinfo (s), "matrix");
1541 %! sparse_auto_mutate (false);
1542 */
double double_value(bool=false) const
virtual octave_value as_int64(void) const
Definition: ov-base.cc:153
bool called_from_builtin(void)
Definition: ov-base.cc:1464
virtual octave_value as_double(void) const
Definition: ov-base.cc:123
virtual octave_value reshape(const dim_vector &) const
Definition: ov-base.cc:333
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:816
virtual octave_int16 int16_scalar_value(void) const
Definition: ov-base.cc:693
octave_base_value * clone(void) const
virtual ComplexDiagMatrix complex_diag_matrix_value(bool=false) const
Definition: ov-base.cc:667
virtual octave_uint32 uint32_scalar_value(void) const
Definition: ov-base.cc:723
Definition: Cell.h:37
virtual octave_fcn_handle * fcn_handle_value(bool silent=false)
Definition: ov-base.cc:907
virtual bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-base.cc:943
virtual SparseMatrix sparse_matrix_value(bool=false) const
Definition: ov-base.cc:634
void assign(const std::string &k, const Cell &val)
Definition: oct-map.h:351
virtual int8NDArray int8_array_value(void) const
Definition: ov-base.cc:735
octave_value numeric_assign(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:1175
virtual octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov-base.cc:224
sortmode
Definition: oct-sort.h:105
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
virtual ComplexNDArray complex_array_value(bool=false) const
Definition: ov-base.cc:589
virtual octave_value as_uint32(void) const
Definition: ov-base.cc:171
virtual SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-base.cc:640
virtual FloatDiagMatrix float_diag_matrix_value(bool=false) const
Definition: ov-base.cc:660
virtual octave_uint64 uint64_scalar_value(void) const
Definition: ov-base.cc:729
void newline(std::ostream &os) const
Definition: ov-base.cc:1328
octave_base_value::type_conv_fcn lookup_widening_op(int, int)
Definition: ov-typeinfo.cc:572
virtual FloatComplex float_complex_value(bool=false) const
Definition: ov-base.cc:569
virtual void unlock(void)
Definition: ov-base.cc:1133
virtual ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-base.cc:575
virtual uint16NDArray uint16_array_value(void) const
Definition: ov-base.cc:765
Definition: Range.h:33
virtual uint8NDArray uint8_array_value(void) const
Definition: ov-base.cc:759
virtual int type_id(void) const
Definition: ov-base.h:876
static octave_base_value * oct_conv_complex_matrix_conv(const octave_base_value &)
Definition: ov-base.cc:1369
virtual bool print_name_tag(std::ostream &os, const std::string &name) const
Definition: ov-base.cc:413
bool isnan(bool)
Definition: lo-mappers.h:187
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
Definition: defun.h:53
OCTINTERP_API octave_idx_type dims_to_numel(const dim_vector &dims, const octave_value_list &idx)
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
void error(const char *fmt,...)
Definition: error.cc:578
#define SET_INTERNAL_VARIABLE(NM)
Definition: variables.h:109
bool is_magic_colon(void) const
Definition: ov.h:625
#define INT_CONV_METHOD(T, F)
Definition: ov-base.cc:459
virtual octave_value permute(const Array< int > &vec, bool=false) const
Definition: ov-base.cc:339
void install_base_type_conversions(octave::type_info &ti)
Definition: ov-base.cc:1480
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:180
virtual bool fast_elem_insert(octave_idx_type n, const octave_value &x)
Definition: ov-base.cc:1351
virtual Cell cell_value(void) const
Definition: ov-base.cc:533
static std::string assign_op_as_string(assign_op)
Definition: ov.cc:348
virtual octave_value resize(const dim_vector &, bool fill=false) const
Definition: ov-base.cc:345
const octave_base_value & get_rep(void) const
Definition: ov.h:1327
virtual std::list< std::string > parent_class_name_list(void) const
Definition: ov-base.cc:848
virtual dim_vector dims(void) const
Definition: ov-base.h:314
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:997
virtual SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
Definition: ov-base.cc:647
virtual bool isnumeric(void) const
Definition: ov-base.h:453
virtual bool save_ascii(std::ostream &os)
Definition: ov-base.cc:931
virtual octave_int32 int32_scalar_value(void) const
Definition: ov-base.cc:699
double fix(double x)
Definition: lo-mappers.h:127
static const char * get_umap_name(unary_mapper_t)
Definition: ov-base.cc:1024
builtin_type_t
Definition: ov-base.h:71
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-base.cc:199
i e
Definition: data.cc:2591
virtual octave_value as_uint8(void) const
Definition: ov-base.cc:159
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1121
octave_function * fcn
Definition: ov-class.cc:1754
virtual octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:238
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
virtual int32NDArray int32_array_value(void) const
Definition: ov-base.cc:747
virtual void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov-base.cc:401
virtual Range range_value(void) const
Definition: ov-base.cc:813
virtual Array< std::string > cellstr_value(void) const
Definition: ov-base.cc:807
void warn_load(const char *type) const
Definition: ov-base.cc:1097
octave_value(* assign_op_fcn)(octave_base_value &, const octave_value_list &, const octave_base_value &)
Definition: ov-typeinfo.h:60
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
static int curr_print_indent_level
Definition: ov-base.h:873
virtual octave_idx_type nzmax(void) const
Definition: ov-base.cc:321
octave::call_stack & cs
Definition: ov-class.cc:1752
virtual octave_map map_value(void) const
Definition: ov-base.cc:819
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:304
assign_op_fcn lookup_assign_op(octave_value::assign_op, int, int)
Definition: ov-typeinfo.cc:551
virtual octave_fcn_inline * fcn_inline_value(bool silent=false)
Definition: ov-base.cc:916
virtual octave_value as_uint16(void) const
Definition: ov-base.cc:165
bool Vcompact_format
Definition: pr-output.cc:99
builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
Determine the resulting type for a possible mixed-type operation.
Definition: ov-base.cc:63
virtual octave_value any(int=0) const
Definition: ov-base.cc:369
done
Definition: syscalls.cc:251
nd deftypefn *std::string name
Definition: sysdep.cc:647
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:975
virtual sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Definition: ov-base.cc:1018
virtual octave_user_function * user_function_value(bool silent=false)
Definition: ov-base.cc:880
virtual octave_value full_value(void) const
Definition: ov-base.cc:117
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:997
virtual octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
Definition: ov-base.cc:375
type_info & __get_type_info__(const std::string &who)
virtual octave_value_list list_value(void) const
Definition: ov-base.cc:925
virtual octave_idx_type nnz(void) const
Definition: ov-base.cc:315
virtual void lock(void)
Definition: ov-base.cc:1127
virtual NDArray array_value(bool=false) const
Definition: ov-base.cc:551
octave_function * caller(void) const
Definition: call-stack.h:118
int lookup_pref_assign_conv(int, int)
Definition: ov-typeinfo.cc:566
std::string btyp_class_name[btyp_num_types]
Definition: ov-base.cc:87
virtual float_display_format get_edit_display_format(void) const
Definition: ov-base.cc:447
virtual DiagMatrix diag_matrix_value(bool=false) const
Definition: ov-base.cc:654
virtual octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition: ov-base.cc:993
virtual std::string xstring_value() const
Definition: ov-base.cc:799
static octave_base_value * oct_conv_string_conv(const octave_base_value &)
Definition: ov-base.cc:1375
virtual bool fast_elem_insert_self(void *where, builtin_type_t btyp) const
Definition: ov-base.cc:1357
virtual octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition: ov-base.cc:387
static const std::string t_name
Definition: ov-base.h:876
virtual string_vector parent_class_names(void) const
Definition: ov-base.cc:855
std::string type_name(void) const
Array< octave_idx_type > as_array(void) const
Definition: dim-vector.cc:273
double tmp
Definition: data.cc:6252
virtual sortmode issorted(sortmode mode=UNSORTED) const
Definition: ov-base.cc:1006
octave_value retval
Definition: data.cc:6246
static octave_base_value * oct_conv_cell_conv(const octave_base_value &)
Definition: ov-base.cc:1381
virtual octave_uint8 uint8_scalar_value(void) const
Definition: ov-base.cc:711
#define panic_impossible()
Definition: error.h:40
virtual string_vector string_vector_value(bool pad=false) const
Definition: ov-base.cc:783
virtual mxArray * as_mxArray(void) const
Definition: ov-base.cc:975
virtual Complex complex_value(bool=false) const
Definition: ov-base.cc:563
int64_t octave_hdf5_id
virtual octave_idx_type numel(void) const
Definition: ov-base.h:333
virtual octave_value dump(void) const
Definition: ov-base.cc:1139
void warn_save(const char *type) const
Definition: ov-base.cc:1106
virtual int nint_value(bool=false) const
Definition: ov-base.cc:501
idx type
Definition: ov.cc:3114
int type_id(void) const
Definition: ov.h:1287
Definition: dMatrix.h:36
virtual bool print_as_scalar(void) const
Definition: ov-base.h:651
static OCTAVE_NORETURN void err_no_conversion(const std::string &on, const std::string &tn1, const std::string &tn2)
Definition: ov-base.cc:1167
virtual FloatMatrix float_matrix_value(bool=false) const
Definition: ov-base.cc:545
virtual float float_value(bool=false) const
Definition: ov-base.cc:527
virtual bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-base.cc:956
virtual Matrix size(void)
Definition: ov-base.cc:183
virtual octave_user_code * user_code_value(bool silent=false)
Definition: ov-base.cc:898
virtual bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-base.cc:962
virtual void convert_to_row_or_column_vector(void)
Definition: ov-base.cc:394
virtual idx_vector index_vector(bool require_integers=false) const
Definition: ov-base.cc:231
void err_wrong_type_arg(const char *name, const char *s)
Definition: errwarn.cc:162
void indent(std::ostream &os) const
Definition: ov-base.cc:1309
virtual type_conv_info numeric_conversion_function(void) const
Definition: ov-base.h:251
friend class octave_value
Definition: ov-base.h:228
virtual octave_value as_int32(void) const
Definition: ov-base.cc:147
virtual octave_idx_type nfields(void) const
Definition: ov-base.cc:327
virtual octave_value diag(octave_idx_type k=0) const
Definition: ov-base.cc:981
octave_base_value::type_conv_info numeric_conversion_function(void) const
Definition: ov.h:375
#define INSTALL_ASSIGNCONV_TI(ti, t1, t2, tr)
Definition: ops.h:71
virtual FloatNDArray float_array_value(bool=false) const
Definition: ov-base.cc:557
virtual octave_value fast_elem_extract(octave_idx_type n) const
Definition: ov-base.cc:1345
virtual FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-base.cc:582
virtual octave_value squeeze(void) const
Definition: ov-base.cc:110
virtual int64NDArray int64_array_value(void) const
Definition: ov-base.cc:753
octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
Definition: ov-base.cc:1401
virtual bool load_ascii(std::istream &is)
Definition: ov-base.cc:937
void err_invalid_conversion(const std::string &from, const std::string &to)
Definition: errwarn.cc:68
static OCTAVE_NORETURN void err_assign_conversion_failed(const std::string &tn1, const std::string &tn2)
Definition: ov-base.cc:1159
void reset(void) const
Definition: ov-base.cc:1338
virtual octave_uint16 uint16_scalar_value(void) const
Definition: ov-base.cc:717
virtual octave_int8 int8_scalar_value(void) const
Definition: ov-base.cc:687
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
virtual std::string class_name(void) const
Definition: ov-base.h:876
static octave_value_list sanitize(const octave_value_list &ovl)
Definition: ov-base.cc:1387
virtual octave_classdef * classdef_object_value(bool silent=false)
Definition: ov-base.cc:861
virtual Matrix matrix_value(bool=false) const
Definition: ov-base.cc:539
virtual octave_value as_single(void) const
Definition: ov-base.cc:129
void maybe_mutate(void)
virtual int16NDArray int16_array_value(void) const
Definition: ov-base.cc:741
virtual octave_value all(int=0) const
Definition: ov-base.cc:363
virtual size_t nparents(void) const
Definition: ov-base.cc:842
p
Definition: lu.cc:138
virtual FloatComplexDiagMatrix float_complex_diag_matrix_value(bool=false) const
Definition: ov-base.cc:674
call_stack & __get_call_stack__(const std::string &who)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition: errwarn.cc:338
virtual uint32NDArray uint32_array_value(void) const
Definition: ov-base.cc:771
virtual octave_value as_uint64(void) const
Definition: ov-base.cc:177
virtual bool is_defined(void) const
Definition: ov-base.h:357
octave_idx_type length(void) const
Definition: ovl.h:96
virtual boolMatrix bool_matrix_value(bool=false) const
Definition: ov-base.cc:608
static OCTAVE_NORETURN void err_indexed_assignment(const std::string &tn1, const std::string &tn2)
Definition: ov-base.cc:1151
virtual std::string type_name(void) const
Definition: ov-base.h:876
the element is set to zero In other the statement xample y
Definition: data.cc:5264
virtual 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-base.cc:968
octave::refcount< octave_idx_type > count
Definition: ov-base.h:862
bool Vsparse_auto_mutate
Definition: ov-base.cc:101
virtual octave_value as_int16(void) const
Definition: ov-base.cc:141
for i
Definition: data.cc:5264
static octave_base_value * oct_conv_matrix_conv(const octave_base_value &)
Definition: ov-base.cc:1363
bool isempty(void) const
Definition: ov-base.h:359
virtual PermMatrix perm_matrix_value(void) const
Definition: ov-base.cc:681
std::complex< float > FloatComplex
Definition: oct-cmplx.h:32
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:295
std::complex< double > Complex
Definition: oct-cmplx.h:31
virtual void print_info(std::ostream &os, const std::string &prefix) const
Definition: ov-base.cc:453
virtual octave_function * function_value(bool silent=false)
Definition: ov-base.cc:871
virtual octave_int64 int64_scalar_value(void) const
Definition: ov-base.cc:705
virtual bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-base.cc:949
static bool beginning_of_line
Definition: ov-base.h:874
#define INSTALL_WIDENOP_TI(ti, t1, t2, f)
Definition: ops.h:75
virtual void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-base.cc:407
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
std::string name(void) const
Definition: ov-fcn.h:182
virtual charNDArray char_array_value(bool=false) const
Definition: ov-base.cc:628
virtual string_vector map_keys(void) const
Definition: ov-base.cc:836
std::string type_name(void) const
Definition: ov.h:1289
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:888
virtual uint64NDArray uint64_array_value(void) const
Definition: ov-base.cc:777
virtual octave_user_script * user_script_value(bool silent=false)
Definition: ov-base.cc:889
dim_vector dv
Definition: sub2ind.cc:263
virtual void print_with_name(std::ostream &output_buf, const std::string &name, bool print_padding=true)
Definition: ov-base.cc:434
octave_base_value *(* type_conv_fcn)(const octave_base_value &)
Definition: ov-base.h:207
virtual Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Definition: ov-base.cc:1012
void wrong_type_arg_error(void) const
Definition: ov-base.cc:1115
octave::stream os
Definition: file-io.cc:627
virtual MatrixType matrix_type(void) const
Definition: ov-base.cc:351
virtual charMatrix char_matrix_value(bool force=false) const
Definition: ov-base.cc:620
virtual boolNDArray bool_array_value(bool=false) const
Definition: ov-base.cc:614
more on
Definition: toplev.cc:236
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 const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE * x
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
Definition: ov.cc:2867
virtual octave_value as_int8(void) const
Definition: ov-base.cc:135
virtual std::string string_value(bool force=false) const
Definition: ov-base.cc:791
virtual FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-base.cc:595
virtual octave_base_value * empty_clone(void) const
Definition: ov-base.cc:104
virtual double double_value(bool=false) const
Definition: ov-base.cc:521
virtual octave_scalar_map scalar_map_value(void) const
Definition: ov-base.cc:825
virtual bool bool_value(bool=false) const
Definition: ov-base.cc:602