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