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