GNU Octave  4.0.0
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-2015 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 #ifdef 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 "defun.h"
35 #include "gripes.h"
36 #include "mxarray.h"
37 #include "oct-map.h"
38 #include "oct-obj.h"
39 #include "oct-hdf5.h"
40 #include "oct-lvalue.h"
41 #include "oct-stream.h"
42 #include "ops.h"
43 #include "ov-base.h"
44 #include "ov-cell.h"
45 #include "ov-ch-mat.h"
46 #include "ov-complex.h"
47 #include "ov-cx-mat.h"
48 #include "ov-range.h"
49 #include "ov-re-mat.h"
50 #include "ov-scalar.h"
51 #include "ov-str-mat.h"
52 #include "ov-fcn-handle.h"
53 #include "parse.h"
54 #include "pr-output.h"
55 #include "utils.h"
56 #include "toplev.h"
57 #include "variables.h"
58 
60 {
62 
63  if (x == btyp_bool)
64  x = btyp_double;
65  if (y == btyp_bool)
66  y = btyp_double;
67 
68  if (x <= btyp_float_complex && y <= btyp_float_complex)
69  retval = static_cast<builtin_type_t> (x | y);
70  else if (x <= btyp_uint64 && y <= btyp_float)
71  retval = x;
72  else if (x <= btyp_float && y <= btyp_uint64)
73  retval = y;
74  else if ((x >= btyp_int8 && x <= btyp_int64
75  && y >= btyp_int8 && y <= btyp_int64)
76  || (x >= btyp_uint8 && x <= btyp_uint64
77  && y >= btyp_uint8 && y <= btyp_uint64))
78  retval = (x > y) ? x : y;
79 
80  return retval;
81 }
82 
84 {
85  "double", "single", "double", "single",
86  "int8", "int16", "int32", "int64",
87  "uint8", "uint16", "uint32", "uint64",
88  "logical", "char",
89  "struct", "cell", "function_handle"
90 };
91 
94 {
95  static string_vector retval;
96 
97  if (retval.is_empty ())
98  {
99  int n = btyp_num_types - 2;
100  retval = string_vector (n);
101  int j = 0;
102  for (int i = 0; i < btyp_num_types; i++)
103  {
104  builtin_type_t ityp = static_cast<builtin_type_t> (i);
105  if (ityp != btyp_complex && ityp != btyp_float_complex)
106  retval(j++) = btyp_class_name[i];
107  }
108  }
109 
110  return retval;
111 }
112 
114  "<unknown type>", "unknown");
115 
116 // TRUE means to perform automatic sparse to real mutation if there
117 // is memory to be saved
118 bool Vsparse_auto_mutate = false;
119 
122 {
123  return resize (dim_vector ()).clone ();
124 }
125 
128 {
129  std::string nm = type_name ();
130  error ("squeeze: invalid operation for %s type", nm.c_str ());
131  return octave_value ();
132 }
133 
136 {
137  gripe_wrong_type_arg ("full: invalid operation for %s type", type_name ());
138  return octave_value ();
139 }
140 
141 Matrix
143 {
144  const dim_vector dv = dims ();
145  Matrix mdv (1, dv.length ());
146  for (octave_idx_type i = 0; i < dv.length (); i++)
147  mdv(i) = dv(i);
148  return mdv;
149 }
150 
153 {
154  return dims_to_numel (dims (), idx);
155 }
156 
158 octave_base_value::subsref (const std::string&,
159  const std::list<octave_value_list>&)
160 {
161  std::string nm = type_name ();
162  error ("can't perform indexing operations for %s type", nm.c_str ());
163  return octave_value ();
164 }
165 
167 octave_base_value::subsref (const std::string&,
168  const std::list<octave_value_list>&, int)
169 {
170  std::string nm = type_name ();
171  error ("can't perform indexing operations for %s type", nm.c_str ());
172  return octave_value ();
173 }
174 
176 octave_base_value::subsref (const std::string& type,
177  const std::list<octave_value_list>& idx,
178  bool /* auto_add */)
179 {
180  // This way we may get a more meaningful error message.
181  return subsref (type, idx);
182 }
183 
185 octave_base_value::subsref (const std::string& type,
186  const std::list<octave_value_list>& idx,
187  int nargout,
188  const std::list<octave_lvalue> *)
189 {
190  // Fall back to call without passing lvalue list.
191  return subsref (type, idx, nargout);
192 }
193 
196 {
197  std::string nm = type_name ();
198  error ("can't perform indexing operations for %s type", nm.c_str ());
199  return octave_value ();
200 }
201 
204 {
205  std::string nm = type_name ();
206  error ("can't perform indexing operations for %s type", nm.c_str ());
207  return octave_value ();
208 }
209 
212  const std::list<octave_lvalue> *)
213 {
214  // Fall back.
215  return do_multi_index_op (nargout, idx);
216 }
217 
219 octave_base_value::index_vector (bool /* require_integers */) const
220 {
221  std::string nm = type_name ();
222  error ("%s type invalid as index value", nm.c_str ());
223  return idx_vector ();
224 }
225 
227 octave_base_value::subsasgn (const std::string& type,
228  const std::list<octave_value_list>& idx,
229  const octave_value& rhs)
230 {
231  octave_value retval;
232 
233  if (is_defined ())
234  {
235  if (is_numeric_type ())
236  {
237  switch (type[0])
238  {
239  case '(':
240  {
241  if (type.length () == 1)
242  retval = numeric_assign (type, idx, rhs);
243  else if (is_empty ())
244  {
245  // Allow conversion of empty matrix to some other
246  // type in cases like
247  //
248  // x = []; x(i).f = rhs
249 
250  octave_value tmp = octave_value::empty_conv (type, rhs);
251 
252  retval = tmp.subsasgn (type, idx, rhs);
253  }
254  else
255  {
256  std::string nm = type_name ();
257  error ("in indexed assignment of %s, last rhs index must be ()",
258  nm.c_str ());
259  }
260  }
261  break;
262 
263  case '{':
264  case '.':
265  {
266  std::string nm = type_name ();
267  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
268  }
269  break;
270 
271  default:
272  panic_impossible ();
273  }
274  }
275  else
276  {
277  std::string nm = type_name ();
278  error ("can't perform indexed assignment for %s type", nm.c_str ());
279  }
280  }
281  else
282  {
283  // Create new object of appropriate type for given index and rhs
284  // types and then call undef_subsasgn for that object.
285 
286  octave_value tmp = octave_value::empty_conv (type, rhs);
287 
288  retval = tmp.undef_subsasgn (type, idx, rhs);
289  }
290 
291  return retval;
292 }
293 
296  const std::list<octave_value_list>& idx,
297  const octave_value& rhs)
298 {
299  // In most cases, undef_subsasgn is handled the sams as subsasgn. One
300  // exception is octave_class objects.
301 
302  return subsasgn (type, idx, rhs);
303 }
304 
307 {
308  gripe_wrong_type_arg ("octave_base_value::nnz ()", type_name ());
309  return -1;
310 }
311 
314 {
315  return numel ();
316 }
317 
320 {
321  gripe_wrong_type_arg ("octave_base_value::nfields ()", type_name ());
322  return -1;
323 }
324 
327 {
328  gripe_wrong_type_arg ("octave_base_value::reshape ()", type_name ());
329  return octave_value ();
330 }
331 
334 {
335  gripe_wrong_type_arg ("octave_base_value::permute ()", type_name ());
336  return octave_value ();
337 }
338 
341 {
342  gripe_wrong_type_arg ("octave_base_value::resize ()", type_name ());
343  return octave_value ();
344 }
345 
348 {
349  gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
350  return MatrixType ();
351 }
352 
355 {
356  gripe_wrong_type_arg ("octave_base_value::matrix_type ()", type_name ());
357  return MatrixType ();
358 }
359 
362 {
363  return 0.0;
364 }
365 
368 {
369  return 0.0;
370 }
371 
373 octave_base_value::convert_to_str (bool pad, bool force, char type) const
374 {
375  octave_value retval = convert_to_str_internal (pad, force, type);
376 
377  if (! force && is_numeric_type ())
378  gripe_implicit_conversion ("Octave:num-to-str",
379  type_name (), retval.type_name ());
380 
381  return retval;
382 }
383 
386 {
387  gripe_wrong_type_arg ("octave_base_value::convert_to_str_internal ()",
388  type_name ());
389  return octave_value ();
390 }
391 
392 void
394 {
396  ("octave_base_value::convert_to_row_or_column_vector ()",
397  type_name ());
398 }
399 
400 void
401 octave_base_value::print (std::ostream&, bool)
402 {
403  gripe_wrong_type_arg ("octave_base_value::print ()", type_name ());
404 }
405 
406 void
407 octave_base_value::print_raw (std::ostream&, bool) const
408 {
409  gripe_wrong_type_arg ("octave_base_value::print_raw ()", type_name ());
410 }
411 
412 bool
414  const std::string& name) const
415 {
416  bool retval = false;
417 
418  indent (os);
419 
420  if (print_as_scalar ())
421  os << name << " = ";
422  else
423  {
424  os << name << " =";
425  newline (os);
426  if (! Vcompact_format)
427  newline (os);
428 
429  retval = true;
430  }
431 
432  return retval;
433 }
434 
435 void
436 octave_base_value::print_with_name (std::ostream& output_buf,
437  const std::string& name,
438  bool print_padding)
439 {
440  bool pad_after = print_name_tag (output_buf, name);
441 
442  print (output_buf);
443 
444  if (print_padding && pad_after && ! Vcompact_format)
445  newline (output_buf);
446 }
447 
448 void
450  const std::string& /* prefix */) const
451 {
452  os << "no info for type: " << type_name () << "\n";
453 }
454 
455 #define INT_CONV_METHOD(T, F) \
456  T \
457  octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
458  { \
459  T retval = 0; \
460  \
461  double d = double_value (frc_str_conv); \
462  \
463  if (! error_state) \
464  { \
465  if (require_int && D_NINT (d) != d) \
466  error_with_cfn ("conversion of %g to " #T " value failed", d); \
467  else if (d < std::numeric_limits<T>::min ()) \
468  retval = std::numeric_limits<T>::min (); \
469  else if (d > std::numeric_limits<T>::max ()) \
470  retval = std::numeric_limits<T>::max (); \
471  else \
472  retval = static_cast<T> (::fix (d)); \
473  } \
474  else \
475  gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \
476  type_name ()); \
477  \
478  return retval; \
479  }
480 
481 INT_CONV_METHOD (short int, short)
482 INT_CONV_METHOD (unsigned short int, ushort)
483 
484 INT_CONV_METHOD (int, int)
485 INT_CONV_METHOD (unsigned int, uint)
486 
487 INT_CONV_METHOD (long int, long)
488 INT_CONV_METHOD (unsigned long int, ulong)
489 
490 INT_CONV_METHOD (int64_t, int64)
491 INT_CONV_METHOD (uint64_t, uint64)
492 
493 int
494 octave_base_value::nint_value (bool frc_str_conv) const
495 {
496  int retval = 0;
497 
498  double d = double_value (frc_str_conv);
499 
500  if (! error_state)
501  {
502  if (xisnan (d))
503  {
504  error ("conversion of NaN to integer value failed");
505  return retval;
506  }
507 
508  retval = static_cast<int> (::fix (d));
509  }
510  else
511  gripe_wrong_type_arg ("octave_base_value::nint_value ()", type_name ());
512 
513  return retval;
514 }
515 
516 double
518 {
519  double retval = lo_ieee_nan_value ();
520  gripe_wrong_type_arg ("octave_base_value::double_value ()", type_name ());
521  return retval;
522 }
523 
524 float
526 {
527  float retval = lo_ieee_float_nan_value ();
528  gripe_wrong_type_arg ("octave_base_value::float_value ()", type_name ());
529  return retval;
530 }
531 
532 Cell
534 {
535  Cell retval;
536  gripe_wrong_type_arg ("octave_base_value::cell_value()", type_name ());
537  return retval;
538 }
539 
540 Matrix
542 {
543  Matrix retval;
544  gripe_wrong_type_arg ("octave_base_value::matrix_value()", type_name ());
545  return retval;
546 }
547 
550 {
551  FloatMatrix retval;
552  gripe_wrong_type_arg ("octave_base_value::float_matrix_value()",
553  type_name ());
554  return retval;
555 }
556 
557 NDArray
559 {
560  FloatNDArray retval;
561  gripe_wrong_type_arg ("octave_base_value::array_value()", type_name ());
562  return retval;
563 }
564 
567 {
568  FloatNDArray retval;
569  gripe_wrong_type_arg ("octave_base_value::float_array_value()", type_name ());
570  return retval;
571 }
572 
573 Complex
575 {
576  double tmp = lo_ieee_nan_value ();
577  Complex retval (tmp, tmp);
578  gripe_wrong_type_arg ("octave_base_value::complex_value()", type_name ());
579  return retval;
580 }
581 
584 {
585  float tmp = lo_ieee_float_nan_value ();
586  FloatComplex retval (tmp, tmp);
587  gripe_wrong_type_arg ("octave_base_value::float_complex_value()",
588  type_name ());
589  return retval;
590 }
591 
594 {
595  ComplexMatrix retval;
596  gripe_wrong_type_arg ("octave_base_value::complex_matrix_value()",
597  type_name ());
598  return retval;
599 }
600 
603 {
604  FloatComplexMatrix retval;
605  gripe_wrong_type_arg ("octave_base_value::float_complex_matrix_value()",
606  type_name ());
607  return retval;
608 }
609 
612 {
613  ComplexNDArray retval;
614  gripe_wrong_type_arg ("octave_base_value::complex_array_value()",
615  type_name ());
616  return retval;
617 }
618 
621 {
622  FloatComplexNDArray retval;
623  gripe_wrong_type_arg ("octave_base_value::float_complex_array_value()",
624  type_name ());
625  return retval;
626 }
627 
628 bool
630 {
631  bool retval = false;
632  gripe_wrong_type_arg ("octave_base_value::bool_value()", type_name ());
633  return retval;
634 }
635 
638 {
639  boolMatrix retval;
640  gripe_wrong_type_arg ("octave_base_value::bool_matrix_value()",
641  type_name ());
642  return retval;
643 }
644 
647 {
648  boolNDArray retval;
649  gripe_wrong_type_arg ("octave_base_value::bool_array_value()",
650  type_name ());
651  return retval;
652 }
653 
656 {
657  charMatrix retval;
658 
659  octave_value tmp = convert_to_str (false, force);
660 
661  if (! error_state)
662  retval = tmp.char_matrix_value ();
663 
664  return retval;
665 }
666 
669 {
670  charNDArray retval;
671  gripe_wrong_type_arg ("octave_base_value::char_array_value()",
672  type_name ());
673  return retval;
674 }
675 
678 {
679  SparseMatrix retval;
680  gripe_wrong_type_arg ("octave_base_value::sparse_matrix_value()",
681  type_name ());
682  return retval;
683 }
684 
687 {
688  SparseComplexMatrix retval;
689  gripe_wrong_type_arg ("octave_base_value::sparse_complex_matrix_value()",
690  type_name ());
691  return retval;
692 }
693 
696 {
697  SparseBoolMatrix retval;
698  gripe_wrong_type_arg ("octave_base_value::sparse_bool_matrix_value()",
699  type_name ());
700  return retval;
701 }
702 
705 {
706  DiagMatrix retval;
707  gripe_wrong_type_arg ("octave_base_value::diag_matrix_value()", type_name ());
708  return retval;
709 }
710 
713 {
714  FloatDiagMatrix retval;
715  gripe_wrong_type_arg ("octave_base_value::float_diag_matrix_value()",
716  type_name ());
717  return retval;
718 }
719 
722 {
723  ComplexDiagMatrix retval;
724  gripe_wrong_type_arg ("octave_base_value::complex_diag_matrix_value()",
725  type_name ());
726  return retval;
727 }
728 
731 {
732  FloatComplexDiagMatrix retval;
733  gripe_wrong_type_arg ("octave_base_value::float_complex_diag_matrix_value()",
734  type_name ());
735  return retval;
736 }
737 
740 {
741  PermMatrix retval;
742  gripe_wrong_type_arg ("octave_base_value::perm_matrix_value()", type_name ());
743  return retval;
744 }
745 
748 {
749  octave_int8 retval;
750  gripe_wrong_type_arg ("octave_base_value::int8_scalar_value()",
751  type_name ());
752  return retval;
753 }
754 
757 {
758  octave_int16 retval;
759  gripe_wrong_type_arg ("octave_base_value::int16_scalar_value()",
760  type_name ());
761  return retval;
762 }
763 
766 {
767  octave_int32 retval;
768  gripe_wrong_type_arg ("octave_base_value::int32_scalar_value()",
769  type_name ());
770  return retval;
771 }
772 
775 {
776  octave_int64 retval;
777  gripe_wrong_type_arg ("octave_base_value::int64_scalar_value()",
778  type_name ());
779  return retval;
780 }
781 
784 {
785  octave_uint8 retval;
786  gripe_wrong_type_arg ("octave_base_value::uint8_scalar_value()",
787  type_name ());
788  return retval;
789 }
790 
793 {
794  octave_uint16 retval;
795  gripe_wrong_type_arg ("octave_base_value::uint16_scalar_value()",
796  type_name ());
797  return retval;
798 }
799 
802 {
803  octave_uint32 retval;
804  gripe_wrong_type_arg ("octave_base_value::uint32_scalar_value()",
805  type_name ());
806  return retval;
807 }
808 
811 {
812  octave_uint64 retval;
813  gripe_wrong_type_arg ("octave_base_value::uint64_scalar_value()",
814  type_name ());
815  return retval;
816 }
817 
820 {
821  int8NDArray retval;
822  gripe_wrong_type_arg ("octave_base_value::int8_array_value()",
823  type_name ());
824  return retval;
825 }
826 
829 {
830  int16NDArray retval;
831  gripe_wrong_type_arg ("octave_base_value::int16_array_value()",
832  type_name ());
833  return retval;
834 }
835 
838 {
839  int32NDArray retval;
840  gripe_wrong_type_arg ("octave_base_value::int32_array_value()",
841  type_name ());
842  return retval;
843 }
844 
847 {
848  int64NDArray retval;
849  gripe_wrong_type_arg ("octave_base_value::int64_array_value()",
850  type_name ());
851  return retval;
852 }
853 
856 {
857  uint8NDArray retval;
858  gripe_wrong_type_arg ("octave_base_value::uint8_array_value()",
859  type_name ());
860  return retval;
861 }
862 
865 {
866  uint16NDArray retval;
867  gripe_wrong_type_arg ("octave_base_value::uint16_array_value()",
868  type_name ());
869  return retval;
870 }
871 
874 {
875  uint32NDArray retval;
876  gripe_wrong_type_arg ("octave_base_value::uint32_array_value()",
877  type_name ());
878  return retval;
879 }
880 
883 {
884  uint64NDArray retval;
885  gripe_wrong_type_arg ("octave_base_value::uint64_array_value()",
886  type_name ());
887  return retval;
888 }
889 
892 {
893  string_vector retval;
894 
895  octave_value tmp = convert_to_str (pad, true);
896 
897  if (! error_state)
898  retval = tmp.all_strings ();
899 
900  return retval;
901 }
902 
903 std::string
905 {
906  std::string retval;
907 
908  octave_value tmp = convert_to_str (force);
909 
910  if (! error_state)
911  retval = tmp.string_value ();
912 
913  return retval;
914 }
915 
918 {
919  Array<std::string> retval;
920  gripe_wrong_type_arg ("octave_base_value::cellstry_value()",
921  type_name ());
922  return retval;
923 }
924 
925 Range
927 {
928  Range retval;
929  gripe_wrong_type_arg ("octave_base_value::range_value()", type_name ());
930  return retval;
931 }
932 
935 {
936  octave_map retval;
937  gripe_wrong_type_arg ("octave_base_value::map_value()", type_name ());
938  return retval;
939 }
940 
943 {
944  octave_map tmp = map_value ();
945 
946  if (tmp.numel () == 1)
947  return tmp.checkelem (0);
948  else
949  {
950  if (! error_state)
951  error ("invalid conversion of multi-dimensional struct to scalar struct");
952 
953  return octave_scalar_map ();
954  }
955 }
956 
959 {
960  string_vector retval;
961  gripe_wrong_type_arg ("octave_base_value::map_keys()", type_name ());
962  return retval;
963 }
964 
965 size_t
967 {
968  size_t retval = 0;
969  gripe_wrong_type_arg ("octave_base_value::nparents()", type_name ());
970  return retval;
971 }
972 
973 std::list<std::string>
975 {
976  std::list<std::string> retval;
977  gripe_wrong_type_arg ("octave_base_value::parent_class_name_list()",
978  type_name ());
979  return retval;
980 }
981 
984 {
985  string_vector retval;
986  gripe_wrong_type_arg ("octave_base_value::parent_class_names()",
987  type_name ());
988  return retval;
989 }
990 
993 {
994  octave_function *retval = 0;
995 
996  if (! silent)
997  gripe_wrong_type_arg ("octave_base_value::function_value()",
998  type_name ());
999  return retval;
1000 }
1001 
1004 {
1005  octave_user_function *retval = 0;
1006 
1007  if (! silent)
1008  gripe_wrong_type_arg ("octave_base_value::user_function_value()",
1009  type_name ());
1010  return retval;
1011 }
1012 
1015 {
1016  octave_user_script *retval = 0;
1017 
1018  if (! silent)
1019  gripe_wrong_type_arg ("octave_base_value::user_script_value()",
1020  type_name ());
1021  return retval;
1022 }
1023 
1026 {
1027  octave_user_code *retval = 0;
1028 
1029  if (! silent)
1030  gripe_wrong_type_arg ("octave_base_value::user_code_value()",
1031  type_name ());
1032  return retval;
1033 }
1034 
1037 {
1038  octave_fcn_handle *retval = 0;
1039 
1040  if (! silent)
1041  gripe_wrong_type_arg ("octave_base_value::fcn_handle_value()",
1042  type_name ());
1043  return retval;
1044 }
1045 
1048 {
1049  octave_fcn_inline *retval = 0;
1050 
1051  if (! silent)
1052  gripe_wrong_type_arg ("octave_base_value::fcn_inline_value()",
1053  type_name ());
1054  return retval;
1055 }
1056 
1059 {
1060  octave_value_list retval;
1061  gripe_wrong_type_arg ("octave_base_value::list_value()", type_name ());
1062  return retval;
1063 }
1064 
1065 bool
1067 {
1068  gripe_wrong_type_arg ("octave_base_value::save_ascii()", type_name ());
1069  return false;
1070 }
1071 
1072 bool
1074 {
1075  gripe_wrong_type_arg ("octave_base_value::load_ascii()", type_name ());
1076  return false;
1077 }
1078 
1079 bool
1080 octave_base_value::save_binary (std::ostream&, bool&)
1081 {
1082  gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
1083  return false;
1084 }
1085 
1086 bool
1087 octave_base_value::load_binary (std::istream&, bool,
1089 {
1090  gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
1091  return false;
1092 }
1093 
1094 bool
1096 {
1097  gripe_wrong_type_arg ("octave_base_value::save_binary()", type_name ());
1098 
1099  return false;
1100 }
1101 
1102 bool
1104 {
1105  gripe_wrong_type_arg ("octave_base_value::load_binary()", type_name ());
1106 
1107  return false;
1108 }
1109 
1110 int
1112  int, oct_mach_info::float_format) const
1113 {
1114  gripe_wrong_type_arg ("octave_base_value::write()", type_name ());
1115 
1116  return false;
1117 }
1118 
1119 mxArray *
1121 {
1122  return 0;
1123 }
1124 
1127 {
1128  gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ());
1129 
1130  return octave_value ();
1131 }
1132 
1135 {
1136  gripe_wrong_type_arg ("octave_base_value::diag ()", type_name ());
1137 
1138  return octave_value ();
1139 }
1140 
1143 {
1144  gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ());
1145 
1146  return octave_value ();
1147 }
1148 
1151  octave_idx_type, sortmode) const
1152 {
1153  gripe_wrong_type_arg ("octave_base_value::sort ()", type_name ());
1154 
1155  return octave_value ();
1156 }
1157 
1158 sortmode
1160 {
1161  gripe_wrong_type_arg ("octave_base_value::is_sorted ()", type_name ());
1162 
1163  return UNSORTED;
1164 }
1165 
1168 {
1169  gripe_wrong_type_arg ("octave_base_value::sort_rows_idx ()", type_name ());
1170 
1171  return Array<octave_idx_type> ();
1172 }
1173 
1174 sortmode
1176 {
1177  gripe_wrong_type_arg ("octave_base_value::is_sorted_rows ()", type_name ());
1178 
1179  return UNSORTED;
1180 }
1181 
1182 
1183 const char *
1185 {
1186  static const char *names[num_unary_mappers] =
1187  {
1188  "abs",
1189  "acos",
1190  "acosh",
1191  "angle",
1192  "arg",
1193  "asin",
1194  "asinh",
1195  "atan",
1196  "atanh",
1197  "cbrt",
1198  "ceil",
1199  "conj",
1200  "cos",
1201  "cosh",
1202  "erf",
1203  "erfinv",
1204  "erfcinv",
1205  "erfc",
1206  "erfcx",
1207  "erfi",
1208  "dawson",
1209  "exp",
1210  "expm1",
1211  "finite",
1212  "fix",
1213  "floor",
1214  "gamma",
1215  "imag",
1216  "isinf",
1217  "isna",
1218  "isnan",
1219  "lgamma",
1220  "log",
1221  "log2",
1222  "log10",
1223  "log1p",
1224  "real",
1225  "round",
1226  "roundb",
1227  "signum",
1228  "sin",
1229  "sinh",
1230  "sqrt",
1231  "tan",
1232  "tanh",
1233  "isalnum",
1234  "isalpha",
1235  "isascii",
1236  "iscntrl",
1237  "isdigit",
1238  "isgraph",
1239  "islower",
1240  "isprint",
1241  "ispunct",
1242  "isspace",
1243  "isupper",
1244  "isxdigit",
1245  "signbit",
1246  "toascii",
1247  "tolower",
1248  "toupper"
1249  };
1250 
1251  if (umap < 0 || umap >= num_unary_mappers)
1252  return "unknown";
1253  else
1254  return names[umap];
1255 }
1256 
1257 void
1259 {
1261  ("Octave:load-save-unavailable",
1262  "%s: loading %s files not available in this version of Octave",
1263  t_name.c_str (), type);
1264 }
1265 
1266 void
1268 {
1270  ("Octave:load-save-unavailable",
1271  "%s: saving %s files not available in this version of Octave",
1272  t_name.c_str (), type);
1273 }
1274 
1277 {
1278  error ("%s: not defined for %s", get_umap_name (umap), type_name ().c_str ());
1279  return octave_value ();
1280 }
1281 
1282 void
1284 {
1285  gripe_wrong_type_arg ("octave_base_value::lock ()", type_name ());
1286 }
1287 
1288 void
1290 {
1291  gripe_wrong_type_arg ("octave_base_value::unlock ()", type_name ());
1292 }
1293 
1294 void
1295 octave_base_value::dump (std::ostream& os) const
1296 {
1297  dim_vector dv = this->dims ();
1298 
1299  os << "class: " << this->class_name ()
1300  << " type: " << this->type_name ()
1301  << " dims: " << dv.str ();
1302 }
1303 
1304 static void
1305 gripe_indexed_assignment (const std::string& tn1, const std::string& tn2)
1306 {
1307  error ("assignment of '%s' to indexed '%s' not implemented",
1308  tn2.c_str (), tn1.c_str ());
1309 }
1310 
1311 static void
1312 gripe_assign_conversion_failed (const std::string& tn1,
1313  const std::string& tn2)
1314 {
1315  error ("type conversion for assignment of '%s' to indexed '%s' failed",
1316  tn2.c_str (), tn1.c_str ());
1317 }
1318 
1319 static void
1320 gripe_no_conversion (const std::string& on, const std::string& tn1,
1321  const std::string& tn2)
1322 {
1323  error ("operator %s: no conversion for assignment of '%s' to indexed '%s'",
1324  on.c_str (), tn2.c_str (), tn1.c_str ());
1325 }
1326 
1329  const std::list<octave_value_list>& idx,
1330  const octave_value& rhs)
1331 {
1332  octave_value retval;
1333 
1334  if (idx.front ().empty ())
1335  {
1336  error ("missing index in indexed assignment");
1337  return retval;
1338  }
1339 
1340  int t_lhs = type_id ();
1341  int t_rhs = rhs.type_id ();
1342 
1345  t_lhs, t_rhs);
1346 
1347  bool done = false;
1348 
1349  if (f)
1350  {
1351  f (*this, idx.front (), rhs.get_rep ());
1352 
1353  done = (! error_state);
1354  }
1355 
1356  if (done)
1357  {
1358  count++;
1359  retval = octave_value (this);
1360  }
1361  else
1362  {
1363  int t_result
1365 
1366  if (t_result >= 0)
1367  {
1369  = octave_value_typeinfo::lookup_widening_op (t_lhs, t_result);
1370 
1371  if (cf)
1372  {
1373  octave_base_value *tmp = cf (*this);
1374 
1375  if (tmp)
1376  {
1377  octave_value val (tmp);
1378 
1379  retval = val.subsasgn (type, idx, rhs);
1380 
1381  done = (! error_state);
1382  }
1383  else
1385  rhs.type_name ());
1386  }
1387  else
1389  }
1390 
1391  if (! (done || error_state))
1392  {
1393  octave_value tmp_rhs;
1394 
1396  = rhs.numeric_conversion_function ();
1397 
1400 
1401  // Try biased (one-sided) conversions first.
1402  if (cf_rhs.type_id () >= 0
1404  t_lhs,
1405  cf_rhs.type_id ())
1407  cf_rhs.type_id ()) >= 0))
1408  cf_this = 0;
1409  else if (cf_this.type_id () >= 0
1411  cf_this.type_id (), t_rhs)
1413  t_rhs) >= 0))
1414  cf_rhs = 0;
1415 
1416  if (cf_rhs)
1417  {
1418  octave_base_value *tmp = cf_rhs (rhs.get_rep ());
1419 
1420  if (tmp)
1421  tmp_rhs = octave_value (tmp);
1422  else
1423  {
1425  rhs.type_name ());
1426  return octave_value ();
1427  }
1428  }
1429  else
1430  tmp_rhs = rhs;
1431 
1432  count++;
1433  octave_value tmp_lhs = octave_value (this);
1434 
1435  if (cf_this)
1436  {
1437  octave_base_value *tmp = cf_this (*this);
1438 
1439  if (tmp)
1440  tmp_lhs = octave_value (tmp);
1441  else
1442  {
1444  rhs.type_name ());
1445  return octave_value ();
1446  }
1447  }
1448 
1449  if (cf_this || cf_rhs)
1450  {
1451  retval = tmp_lhs.subsasgn (type, idx, tmp_rhs);
1452 
1453  done = (! error_state);
1454  }
1455  else
1458  type_name (), rhs.type_name ());
1459  }
1460  }
1461 
1462  // The assignment may have converted to a type that is wider than
1463  // necessary.
1464 
1465  retval.maybe_mutate ();
1466 
1467  return retval;
1468 }
1469 
1470 // Current indentation.
1472 
1473 // TRUE means we are at the beginning of a line.
1475 
1476 // Each print() function should call this before printing anything.
1477 //
1478 // This doesn't need to be fast, but isn't there a better way?
1479 
1480 void
1481 octave_base_value::indent (std::ostream& os) const
1482 {
1483  assert (curr_print_indent_level >= 0);
1484 
1485  if (beginning_of_line)
1486  {
1487  // FIXME: do we need this?
1488  // os << prefix;
1489 
1490  for (int i = 0; i < curr_print_indent_level; i++)
1491  os << " ";
1492 
1493  beginning_of_line = false;
1494  }
1495 }
1496 
1497 // All print() functions should use this to print new lines.
1498 
1499 void
1500 octave_base_value::newline (std::ostream& os) const
1501 {
1502  os << "\n";
1503 
1504  beginning_of_line = true;
1505 }
1506 
1507 // For ressetting print state.
1508 
1509 void
1511 {
1512  beginning_of_line = true;
1514 }
1515 
1516 
1519 {
1520  return octave_value ();
1521 }
1522 
1523 bool
1525 {
1526  return false;
1527 }
1528 
1529 bool
1531 {
1532  return false;
1533 }
1534 
1535 CONVDECLX (matrix_conv)
1536 {
1537  return new octave_matrix ();
1538 }
1539 
1540 CONVDECLX (complex_matrix_conv)
1541 {
1542  return new octave_complex_matrix ();
1543 }
1544 
1545 CONVDECLX (string_conv)
1546 {
1547  return new octave_char_matrix_str ();
1548 }
1549 
1550 CONVDECLX (cell_conv)
1551 {
1552  return new octave_cell ();
1553 }
1554 
1555 static inline octave_value_list
1557 {
1558  octave_value_list retval = ovl;
1559 
1560  for (octave_idx_type i = 0; i < ovl.length (); i++)
1561  {
1562  if (retval(i).is_magic_colon ())
1563  retval(i) = ":";
1564  }
1565 
1566  return retval;
1567 }
1568 
1570 make_idx_args (const std::string& type,
1571  const std::list<octave_value_list>& idx,
1572  const std::string& who)
1573 {
1574  octave_value retval;
1575 
1576  size_t len = type.length ();
1577 
1578  if (len == idx.size ())
1579  {
1580  Cell type_field (1, len);
1581  Cell subs_field (1, len);
1582 
1583  std::list<octave_value_list>::const_iterator p = idx.begin ();
1584 
1585  for (size_t i = 0; i < len; i++)
1586  {
1587  char t = type[i];
1588 
1589  switch (t)
1590  {
1591  case '(':
1592  type_field(i) = "()";
1593  subs_field(i) = Cell (sanitize (*p++));
1594  break;
1595 
1596  case '{':
1597  type_field(i) = "{}";
1598  subs_field(i) = Cell (sanitize (*p++));
1599  break;
1600 
1601  case '.':
1602  {
1603  type_field(i) = ".";
1604 
1605  octave_value_list vlist = *p++;
1606 
1607  if (vlist.length () == 1)
1608  {
1609  octave_value val = vlist(0);
1610 
1611  if (val.is_string ())
1612  subs_field(i) = val;
1613  else
1614  {
1615  error ("string argument required for '.' index");
1616  return retval;
1617  }
1618  }
1619  else
1620  {
1621  error ("only single argument permitted for '.' index");
1622  return retval;
1623  }
1624  }
1625  break;
1626 
1627  default:
1628  panic_impossible ();
1629  break;
1630  }
1631  }
1632 
1633  octave_map m;
1634 
1635  m.assign ("type", type_field);
1636  m.assign ("subs", subs_field);
1637 
1638  retval = m;
1639  }
1640  else
1641  error ("invalid index for %s", who.c_str ());
1642 
1643  return retval;
1644 }
1645 
1646 bool
1648 {
1650 
1651  // FIXME: we probably need a better check here, or some other
1652  // mechanism to avoid overloaded functions when builtin is used.
1653  // For example, what if someone overloads the builtin function?
1654  // Also, are there other places where using builtin is not properly
1655  // avoiding dispatch?
1656 
1657  return (fcn && fcn->name () == "builtin");
1658 }
1659 
1660 void
1662 {
1672 
1675  complex_matrix_conv);
1678 }
1679 
1680 DEFUN (sparse_auto_mutate, args, nargout,
1681  "-*- texinfo -*-\n\
1682 @deftypefn {Built-in Function} {@var{val} =} sparse_auto_mutate ()\n\
1683 @deftypefnx {Built-in Function} {@var{old_val} =} sparse_auto_mutate (@var{new_val})\n\
1684 @deftypefnx {Built-in Function} {} sparse_auto_mutate (@var{new_val}, \"local\")\n\
1685 Query or set the internal variable that controls whether Octave will\n\
1686 automatically mutate sparse matrices to full matrices to save memory.\n\
1687 \n\
1688 For example:\n\
1689 \n\
1690 @example\n\
1691 @group\n\
1692 s = speye (3);\n\
1693 sparse_auto_mutate (false);\n\
1694 s(:, 1) = 1;\n\
1695 typeinfo (s)\n\
1696 @result{} sparse matrix\n\
1697 sparse_auto_mutate (true);\n\
1698 s(1, :) = 1;\n\
1699 typeinfo (s)\n\
1700 @result{} matrix\n\
1701 @end group\n\
1702 @end example\n\
1703 \n\
1704 When called from inside a function with the @qcode{\"local\"} option, the\n\
1705 variable is changed locally for the function and any subroutines it calls.\n\
1706 The original variable value is restored when exiting the function.\n\
1707 @end deftypefn")
1708 {
1709  return SET_INTERNAL_VARIABLE (sparse_auto_mutate);
1710 }
1711 
1712 /*
1713 %!test
1714 %! s = speye (3);
1715 %! sparse_auto_mutate (false);
1716 %! s(:, 1) = 1;
1717 %! assert (typeinfo (s), "sparse matrix");
1718 %! sparse_auto_mutate (true);
1719 %! s(1, :) = 1;
1720 %! assert (typeinfo (s), "matrix");
1721 %! sparse_auto_mutate (false);
1722 */
virtual idx_vector index_vector(bool require_integers=false) const
Definition: ov-base.cc:219
bool called_from_builtin(void)
Definition: ov-base.cc:1647
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
Definition: gripes.cc:180
virtual int16NDArray int16_array_value(void) const
Definition: ov-base.cc:828
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:696
virtual dim_vector dims(void) const
Definition: ov-base.h:292
virtual uint64NDArray uint64_array_value(void) const
Definition: ov-base.cc:882
virtual uint16NDArray uint16_array_value(void) const
Definition: ov-base.cc:864
virtual octave_value diag(octave_idx_type k=0) const
Definition: ov-base.cc:1126
bool is_empty(void) const
Definition: Array.h:472
virtual float float_value(bool=false) const
Definition: ov-base.cc:525
virtual int write(octave_stream &os, int block_size, oct_data_conv::data_type output_type, int skip, oct_mach_info::float_format flt_fmt) const
Definition: ov-base.cc:1111
Definition: Cell.h:35
virtual octave_fcn_handle * fcn_handle_value(bool silent=false)
Definition: ov-base.cc:1036
std::string str(char sep= 'x') const
Definition: dim-vector.cc:63
virtual bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-base.cc:1080
octave_refcount< octave_idx_type > count
Definition: ov-base.h:818
virtual boolMatrix bool_matrix_value(bool=false) const
Definition: ov-base.cc:637
void gripe_wrong_type_arg(const char *name, const char *s, bool is_error)
Definition: gripes.cc:135
virtual MatrixType matrix_type(void) const
Definition: ov-base.cc:347
virtual Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Definition: ov-base.cc:1167
static void gripe_no_conversion(const std::string &on, const std::string &tn1, const std::string &tn2)
Definition: ov-base.cc:1320
virtual octave_value_list do_multi_index_op(int nargout, const octave_value_list &idx)
Definition: ov-base.cc:203
virtual type_conv_info numeric_conversion_function(void) const
Definition: ov-base.h:229
virtual int32NDArray int32_array_value(void) const
Definition: ov-base.cc:837
void assign(const std::string &k, const Cell &val)
Definition: oct-map.h:348
virtual octave_idx_type nzmax(void) const
Definition: ov-base.cc:313
virtual SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-base.cc:686
bool xisnan(double x)
Definition: lo-mappers.cc:144
octave_value numeric_assign(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:1328
virtual octave_map map_value(void) const
Definition: ov-base.cc:934
virtual octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov-base.cc:195
virtual FloatDiagMatrix float_diag_matrix_value(bool=false) const
Definition: ov-base.cc:712
sortmode
Definition: oct-sort.h:103
void gripe_load(const char *type) const
Definition: ov-base.cc:1258
octave_idx_type length(void) const
Definition: oct-obj.h:89
virtual octave_uint32 uint32_scalar_value(void) const
Definition: ov-base.cc:801
virtual charNDArray char_array_value(bool=false) const
Definition: ov-base.cc:668
virtual Range range_value(void) const
Definition: ov-base.cc:926
virtual int nint_value(bool=false) const
Definition: ov-base.cc:494
virtual void unlock(void)
Definition: ov-base.cc:1289
Definition: Range.h:31
virtual octave_value fast_elem_extract(octave_idx_type n) const
Definition: ov-base.cc:1518
#define DEFUN(name, args_name, nargout_name, doc)
Definition: defun.h:44
void error(const char *fmt,...)
Definition: error.cc:476
virtual uint8NDArray uint8_array_value(void) const
Definition: ov-base.cc:855
static void gripe_assign_conversion_failed(const std::string &tn1, const std::string &tn2)
Definition: ov-base.cc:1312
std::string name(void) const
Definition: ov-fcn.h:161
#define SET_INTERNAL_VARIABLE(NM)
Definition: variables.h:120
#define INT_CONV_METHOD(T, F)
Definition: ov-base.cc:455
void indent(std::ostream &os) const
Definition: ov-base.cc:1481
#define INSTALL_WIDENOP(t1, t2, f)
Definition: ops.h:72
int type_id(void) const
Definition: ov.h:1045
static string_vector names(const map_type &lst)
Definition: help.cc:782
virtual bool is_numeric_type(void) const
Definition: ov-base.h:421
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:164
virtual bool fast_elem_insert(octave_idx_type n, const octave_value &x)
Definition: ov-base.cc:1524
void gripe_save(const char *type) const
Definition: ov-base.cc:1267
static std::string assign_op_as_string(assign_op)
Definition: ov.cc:428
virtual SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
Definition: ov-base.cc:695
double lo_ieee_nan_value(void)
Definition: lo-ieee.cc:126
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:372
virtual octave_int8 int8_scalar_value(void) const
Definition: ov-base.cc:747
virtual octave_uint8 uint8_scalar_value(void) const
Definition: ov-base.cc:783
virtual bool save_ascii(std::ostream &os)
Definition: ov-base.cc:1066
virtual octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition: ov-base.cc:1142
virtual bool fast_elem_insert_self(void *where, builtin_type_t btyp) const
Definition: ov-base.cc:1530
static const char * get_umap_name(unary_mapper_t)
Definition: ov-base.cc:1184
builtin_type_t
Definition: ov-base.h:59
virtual Array< std::string > cellstr_value(void) const
Definition: ov-base.cc:917
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-base.cc:158
void newline(std::ostream &os) const
Definition: ov-base.cc:1500
virtual string_vector map_keys(void) const
Definition: ov-base.cc:958
virtual ComplexDiagMatrix complex_diag_matrix_value(bool=false) const
Definition: ov-base.cc:721
bool is_empty(void) const
Definition: ov-base.h:335
octave_base_value * clone(void) const
Definition: ov.cc:1265
F77_RET_T const double const double double * d
virtual octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:227
string_vector all_strings(bool pad=false) const
Definition: ov.h:894
virtual void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov-base.cc:401
virtual void print_info(std::ostream &os, const std::string &prefix) const
Definition: ov-base.cc:449
virtual octave_idx_type numel(void) const
Definition: ov-base.h:311
virtual FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-base.cc:602
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov.cc:1414
static int curr_print_indent_level
Definition: ov-base.h:827
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-base.cc:295
virtual octave_value_list list_value(void) const
Definition: ov-base.cc:1058
virtual octave_uint16 uint16_scalar_value(void) const
Definition: ov-base.cc:792
virtual octave_fcn_inline * fcn_inline_value(bool silent=false)
Definition: ov-base.cc:1047
virtual size_t nparents(void) const
Definition: ov-base.cc:966
virtual Complex complex_value(bool=false) const
Definition: ov-base.cc:574
virtual std::list< std::string > parent_class_name_list(void) const
Definition: ov-base.cc:974
double double_value(bool=false) const
bool Vcompact_format
Definition: pr-output.cc:106
builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
Definition: ov-base.cc:59
virtual octave_user_function * user_function_value(bool silent=false)
Definition: ov-base.cc:1003
static octave_function * caller(void)
Definition: toplev.h:176
F77_RET_T const double const double * f
#define CONVDECLX(name)
Definition: ops.h:170
virtual uint32NDArray uint32_array_value(void) const
Definition: ov-base.cc:873
virtual octave_scalar_map scalar_map_value(void) const
Definition: ov-base.cc:942
virtual double double_value(bool=false) const
Definition: ov-base.cc:517
virtual void lock(void)
Definition: ov-base.cc:1283
virtual octave_int16 int16_scalar_value(void) const
Definition: ov-base.cc:756
virtual octave_value full_value(void) const
Definition: ov-base.cc:135
virtual int64NDArray int64_array_value(void) const
Definition: ov-base.cc:846
std::string string_value(bool force=false) const
Definition: ov.h:897
virtual std::string string_value(bool force=false) const
Definition: ov-base.cc:904
virtual bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
Definition: ov-base.cc:1087
octave_base_value::type_conv_info numeric_conversion_function(void) const
Definition: ov.h:373
std::string btyp_class_name[btyp_num_types]
Definition: ov-base.cc:83
virtual SparseMatrix sparse_matrix_value(bool=false) const
Definition: ov-base.cc:677
virtual int8NDArray int8_array_value(void) const
Definition: ov-base.cc:819
virtual octave_value reshape(const dim_vector &) const
Definition: ov-base.cc:326
virtual FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-base.cc:620
bool is_string(void) const
Definition: ov.h:562
int error_state
Definition: error.cc:101
static const std::string t_name
Definition: ov-base.h:830
virtual DiagMatrix diag_matrix_value(bool=false) const
Definition: ov-base.cc:704
virtual octave_value permute(const Array< int > &vec, bool=false) const
Definition: ov-base.cc:333
virtual octave_value all(int=0) const
Definition: ov-base.cc:361
virtual octave_base_value * empty_clone(void) const
Definition: ov-base.cc:121
#define panic_impossible()
Definition: error.h:33
virtual FloatComplex float_complex_value(bool=false) const
Definition: ov-base.cc:583
virtual charMatrix char_matrix_value(bool force=false) const
Definition: ov-base.cc:655
string_vector get_builtin_classes(void)
Definition: ov-base.cc:93
virtual bool print_as_scalar(void) const
Definition: ov-base.h:612
virtual void dump(std::ostream &os) const
Definition: ov-base.cc:1295
octave_idx_type length(void) const
Definition: ov.cc:1525
void install_base_type_conversions(void)
Definition: ov-base.cc:1661
Definition: dMatrix.h:35
virtual ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-base.cc:593
virtual bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-base.cc:1095
virtual octave_uint64 uint64_scalar_value(void) const
Definition: ov-base.cc:810
virtual Matrix matrix_value(bool=false) const
Definition: ov-base.cc:541
virtual Matrix size(void)
Definition: ov-base.cc:142
virtual octave_user_code * user_code_value(bool silent=false)
Definition: ov-base.cc:1025
virtual bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-base.cc:1103
virtual void convert_to_row_or_column_vector(void)
Definition: ov-base.cc:393
virtual bool is_defined(void) const
Definition: ov-base.h:333
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:202
virtual bool print_name_tag(std::ostream &os, const std::string &name) const
Definition: ov-base.cc:413
virtual FloatMatrix float_matrix_value(bool=false) const
Definition: ov-base.cc:549
charMatrix char_matrix_value(bool frc_str_conv=false) const
Definition: ov.h:814
virtual std::string class_name(void) const
Definition: ov-base.h:830
virtual octave_idx_type nnz(void) const
Definition: ov-base.cc:306
friend class octave_value
Definition: ov-base.h:206
virtual FloatComplexDiagMatrix float_complex_diag_matrix_value(bool=false) const
Definition: ov-base.cc:730
std::string type_name(void) const
Definition: ov.h:1047
octave_value(* assign_op_fcn)(octave_base_value &, const octave_value_list &, const octave_base_value &)
Definition: ov-typeinfo.h:57
octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
Definition: ov-base.cc:1570
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov.cc:1422
void reset(void) const
Definition: ov-base.cc:1510
virtual bool load_ascii(std::istream &is)
Definition: ov-base.cc:1073
virtual ComplexNDArray complex_array_value(bool=false) const
Definition: ov-base.cc:611
octave_base_value *(* type_conv_fcn)(const octave_base_value &)
Definition: ov-base.h:185
octave_value_list ovl(const octave_value &a0)
Definition: oct-obj.h:178
virtual FloatNDArray float_array_value(bool=false) const
Definition: ov-base.cc:566
OCTAVE_EMPTY_CPP_ARG std::string type_name(void) const
virtual int type_id(void) const
Definition: ov-base.h:830
static octave_value_list sanitize(const octave_value_list &ovl)
Definition: ov-base.cc:1556
virtual string_vector parent_class_names(void) const
Definition: ov-base.cc:983
void maybe_mutate(void)
Definition: ov.cc:1271
const octave_base_value & get_rep(void) const
Definition: ov.h:1085
octave_idx_type dims_to_numel(const dim_vector &dims, const octave_value_list &idx)
Definition: utils.cc:1221
virtual string_vector all_strings(bool pad=false) const
Definition: ov-base.cc:891
virtual octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition: ov-base.cc:385
virtual std::string type_name(void) const
Definition: ov-base.h:830
virtual octave_value squeeze(void) const
Definition: ov-base.cc:127
virtual mxArray * as_mxArray(void) const
Definition: ov-base.cc:1120
static void gripe_indexed_assignment(const std::string &tn1, const std::string &tn2)
Definition: ov-base.cc:1305
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1276
virtual sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Definition: ov-base.cc:1175
double fix(double x)
Definition: lo-mappers.h:39
bool Vsparse_auto_mutate
Definition: ov-base.cc:118
octave_scalar_map checkelem(octave_idx_type n) const
Definition: oct-map.cc:357
virtual octave_value any(int=0) const
Definition: ov-base.cc:367
std::complex< float > FloatComplex
Definition: oct-cmplx.h:30
virtual void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-base.cc:407
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:340
std::complex< double > Complex
Definition: oct-cmplx.h:29
virtual octave_function * function_value(bool silent=false)
Definition: ov-base.cc:992
virtual sortmode is_sorted(sortmode mode=UNSORTED) const
Definition: ov-base.cc:1159
static bool beginning_of_line
Definition: ov-base.h:828
#define INSTALL_ASSIGNCONV(t1, t2, tr)
Definition: ops.h:64
virtual NDArray array_value(bool=false) const
Definition: ov-base.cc:558
virtual Cell cell_value(void) const
Definition: ov-base.cc:533
virtual octave_idx_type nfields(void) const
Definition: ov-base.cc:319
virtual octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
Definition: ov-base.cc:373
virtual octave_int32 int32_scalar_value(void) const
Definition: ov-base.cc:765
virtual bool bool_value(bool=false) const
Definition: ov-base.cc:629
virtual PermMatrix perm_matrix_value(void) const
Definition: ov-base.cc:739
int length(void) const
Definition: dim-vector.h:281
virtual octave_user_script * user_script_value(bool silent=false)
Definition: ov-base.cc:1014
virtual void print_with_name(std::ostream &output_buf, const std::string &name, bool print_padding=true)
Definition: ov-base.cc:436
virtual boolNDArray bool_array_value(bool=false) const
Definition: ov-base.cc:646
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
Definition: ov.cc:2829
F77_RET_T const double * x
virtual octave_int64 int64_scalar_value(void) const
Definition: ov-base.cc:774
static octave_base_value::type_conv_fcn lookup_widening_op(int t, int t_result)
Definition: ov-typeinfo.h:182