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