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