26 #if defined (HAVE_CONFIG_H)
84 retval = (
x > y) ?
x : y;
91 "double",
"single",
"double",
"single",
92 "int8",
"int16",
"int32",
"int64",
93 "uint8",
"uint16",
"uint32",
"uint64",
95 "struct",
"cell",
"function_handle",
"unknown"
99 "<unknown type>",
"unknown");
114 error (
"squeeze: invalid operation for %s type", nm.c_str ());
201 const std::list<octave_value_list>&)
204 error (
"can't perform indexing operations for %s type", nm.c_str ());
209 const std::list<octave_value_list>&,
int)
212 error (
"can't perform indexing operations for %s type", nm.c_str ());
217 const std::list<octave_value_list>& idx,
228 error (
"can't perform indexing operations for %s type", nm.c_str ());
234 std::string nm =
'<' +
type_name () +
'>';
240 const std::list<octave_value_list>& idx,
250 error (
"can't perform indexed assignment for %s type", nm.c_str ());
257 if (type.length () == 1)
268 retval = tmp.
subsasgn (type, idx, rhs);
273 error (
"in indexed assignment of %s, last rhs index must be ()",
283 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
306 const std::list<octave_value_list>& idx,
398 (
"octave_base_value::convert_to_row_or_column_vector ()",
type_name ());
415 const std::string& name)
const
436 const std::string& name,
455 const std::string& )
const
457 os <<
"no info for type: " <<
type_name () <<
"\n";
460 #define INT_CONV_METHOD(T, F) \
462 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
470 d = double_value (frc_str_conv); \
472 catch (octave::execution_exception& ee) \
474 err_wrong_type_arg (ee, "octave_base_value::" #F "_value ()", type_name ()); \
477 static const double out_of_range_top \
478 = static_cast<double>(std::numeric_limits<T>::max ()) + 1.; \
479 if (require_int && octave::math::x_nint (d) != d) \
480 error_with_cfn ("conversion of %g to " #T " value failed", d); \
481 else if (d < std::numeric_limits<T>::min ()) \
482 retval = std::numeric_limits<T>::min (); \
483 else if (d >= out_of_range_top) \
484 retval = std::numeric_limits<T>::max (); \
486 retval = static_cast<T> (octave::math::fix (d)); \
510 d = double_value (frc_str_conv);
512 catch (octave::execution_exception& ee)
518 error (
"conversion of NaN to integer value failed");
806 return std::string ();
815 octave::range<double>
826 octave_base_value::float_range_value (
void)
const
831 octave::range<octave_int8>
832 octave_base_value::int8_range_value (
void)
const
837 octave::range<octave_int16>
838 octave_base_value::int16_range_value (
void)
const
843 octave::range<octave_int32>
844 octave_base_value::int32_range_value (
void)
const
849 octave::range<octave_int64>
850 octave_base_value::int64_range_value (
void)
const
855 octave::range<octave_uint8>
856 octave_base_value::uint8_range_value (
void)
const
861 octave::range<octave_uint16>
862 octave_base_value::uint16_range_value (
void)
const
867 octave::range<octave_uint32>
868 octave_base_value::uint32_range_value (
void)
const
873 octave::range<octave_uint64>
874 octave_base_value::uint64_range_value (
void)
const
892 if (tmp.
numel () != 1)
893 error (
"invalid conversion of multi-dimensional struct to scalar struct");
916 std::list<std::string>
1160 (
"Octave:load-save-unavailable",
1161 "%s: loading %s files not available in this version of Octave",
1169 (
"Octave:load-save-unavailable",
1170 "%s: saving %s files not available in this version of Octave",
1201 std::map<std::string, octave_value>
m
1210 OCTAVE_NORETURN
static
1214 error (
"assignment of '%s' to indexed '%s' not implemented",
1215 tn2.c_str (), tn1.c_str ());
1218 OCTAVE_NORETURN
static
1222 error (
"type conversion for assignment of '%s' to indexed '%s' failed",
1223 tn2.c_str (), tn1.c_str ());
1226 OCTAVE_NORETURN
static
1229 const std::string& tn2)
1231 error (
"operator %s: no conversion for assignment of '%s' to indexed '%s'",
1232 on.c_str (), tn2.c_str (), tn1.c_str ());
1237 const std::list<octave_value_list>& idx,
1242 if (idx.front ().empty ())
1243 error (
"missing index in indexed assignment");
1257 f (*
this, idx.front (), rhs.
get_rep ());
1269 int t_result = ti.lookup_pref_assign_conv (t_lhs, t_rhs);
1274 = ti.lookup_widening_op (t_lhs, t_result);
1286 retval = val.
subsasgn (type, idx, rhs);
1305 || ti.lookup_pref_assign_conv (t_lhs,
1308 else if (cf_this.
type_id () >= 0
1311 || ti.lookup_pref_assign_conv (cf_this.
type_id (),
1340 if (! cf_this && ! cf_rhs)
1345 retval = tmp_lhs.
subsasgn (type, idx, tmp_rhs);
1453 if (retval(i).is_magic_colon ())
1462 const std::list<octave_value_list>& idx,
1463 const std::string& who)
1465 std::size_t
len = type.length ();
1467 if (
len != idx.size ())
1468 error (
"invalid index for %s", who.c_str ());
1473 auto p = idx.begin ();
1475 for (std::size_t i = 0; i <
len; i++)
1482 type_field(i) =
"()";
1487 type_field(i) =
"{}";
1493 type_field(i) =
".";
1497 if (vlist.
length () != 1)
1498 error (
"only single argument permitted for '.' index");
1503 error (
"string argument required for '.' index");
1505 subs_field(i) = val;
1517 m.assign (
"type", type_field);
1518 m.assign (
"subs", subs_field);
1536 return (fcn && fcn->
name () ==
"builtin");
1557 complex_matrix_conv);
Vector representing the dimensions (size) of an Array.
OCTAVE_API Array< octave_idx_type > as_array(void) const
octave_idx_type ndims(void) const
Number of dimensions.
virtual bool load_hdf5(octave_hdf5_id loc_id, const char *name)
virtual SparseMatrix sparse_matrix_value(bool=false) const
virtual type_conv_info numeric_conversion_function(void) const
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
virtual float float_value(bool=false) const
virtual bool save_ascii(std::ostream &os)
octave::refcount< octave_idx_type > count
virtual int8NDArray int8_array_value(void) const
virtual FloatComplexDiagMatrix float_complex_diag_matrix_value(bool=false) const
virtual octave_value as_uint8(void) const
virtual octave_int8 int8_scalar_value(void) const
OCTINTERP_API void wrong_type_arg_error(void) const
virtual octave_value as_uint32(void) const
static int s_curr_print_indent_level
virtual ComplexNDArray complex_array_value(bool=false) const
virtual void print_with_name(std::ostream &output_buf, const std::string &name, bool print_padding=true)
virtual octave_value fast_elem_extract(octave_idx_type n) const
virtual boolNDArray bool_array_value(bool=false) const
virtual Cell cell_value(void) const
virtual PermMatrix perm_matrix_value(void) const
virtual bool print_name_tag(std::ostream &os, const std::string &name) const
virtual octave_scalar_map scalar_map_value(void) const
static bool s_beginning_of_line
virtual octave::range< double > range_value(void) const
virtual octave_value as_uint64(void) const
virtual octave_int32 int32_scalar_value(void) const
virtual FloatComplexNDArray float_complex_array_value(bool=false) const
virtual octave_user_script * user_script_value(bool silent=false)
virtual octave_value as_int16(void) const
virtual charNDArray char_array_value(bool=false) const
virtual Array< std::string > cellstr_value(void) const
octave_base_value *(* type_conv_fcn)(const octave_base_value &)
virtual octave_value diag(octave_idx_type k=0) const
virtual octave_idx_type nfields(void) const
virtual octave_map map_value(void) const
OCTINTERP_API void indent(std::ostream &os) const
virtual octave_value permute(const Array< int > &vec, bool=false) const
virtual octave_fcn_handle * fcn_handle_value(bool silent=false)
virtual octave_value as_double(void) const
virtual charMatrix char_matrix_value(bool force=false) const
virtual octave_uint32 uint32_scalar_value(void) const
virtual bool print_as_scalar(void) const
OCTINTERP_API void newline(std::ostream &os) const
virtual octave_classdef * classdef_object_value(bool silent=false)
virtual octave_idx_type nnz(void) const
virtual octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
virtual octave_value all(int=0) const
virtual octave_uint8 uint8_scalar_value(void) const
virtual bool isfield(const std::string &) const
virtual sortmode is_sorted_rows(sortmode mode=UNSORTED) const
static const std::string t_name
virtual uint64NDArray uint64_array_value(void) const
virtual octave_value as_int8(void) const
virtual boolMatrix bool_matrix_value(bool=false) const
virtual octave_value as_int32(void) const
virtual FloatComplex float_complex_value(bool=false) const
virtual octave_value map(unary_mapper_t) const
virtual octave_value convert_to_str_internal(bool pad, bool force, char type) const
virtual octave_value_list list_value(void) const
virtual FloatComplexMatrix float_complex_matrix_value(bool=false) const
virtual octave_value squeeze(void) const
virtual ComplexMatrix complex_matrix_value(bool=false) const
virtual octave_int16 int16_scalar_value(void) const
virtual octave_base_value * empty_clone(void) const
virtual octave_idx_type nzmax(void) const
virtual void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
virtual octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
virtual int type_id(void) const
virtual Matrix size(void)
virtual std::string class_name(void) const
virtual octave::idx_vector index_vector(bool require_integers=false) const
virtual octave_uint16 uint16_scalar_value(void) const
virtual uint32NDArray uint32_array_value(void) const
virtual FloatDiagMatrix float_diag_matrix_value(bool=false) const
virtual bool save_binary(std::ostream &os, bool save_as_floats)
virtual octave_value as_single(void) const
OCTINTERP_API octave_value numeric_assign(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTINTERP_API void warn_load(const char *type) const
virtual octave_value reshape(const dim_vector &) const
virtual mxArray * as_mxArray(bool interleaved) const
virtual SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
virtual string_vector parent_class_names(void) const
static OCTINTERP_API const char * get_umap_name(unary_mapper_t)
virtual octave_value full_value(void) const
virtual bool load_ascii(std::istream &is)
virtual bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
virtual FloatNDArray float_array_value(bool=false) const
virtual Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
virtual FloatMatrix float_matrix_value(bool=false) const
virtual octave_idx_type xnumel(const octave_value_list &)
virtual DiagMatrix diag_matrix_value(bool=false) const
virtual SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
virtual dim_vector dims(void) const
virtual octave_idx_type numel(void) const
virtual octave_value as_int64(void) const
virtual bool fast_elem_insert(octave_idx_type n, const octave_value &x)
virtual octave_user_function * user_function_value(bool silent=false)
virtual bool bool_value(bool=false) const
virtual void unlock(void)
virtual octave_int64 int64_scalar_value(void) const
virtual void print_info(std::ostream &os, const std::string &prefix) const
virtual int64NDArray int64_array_value(void) const
virtual std::string xstring_value() const
virtual bool fast_elem_insert_self(void *where, builtin_type_t btyp) const
virtual ComplexDiagMatrix complex_diag_matrix_value(bool=false) const
virtual bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
virtual int32NDArray int32_array_value(void) const
virtual void print(std::ostream &os, bool pr_as_read_syntax=false)
virtual octave_value resize(const dim_vector &, bool fill=false) const
virtual int16NDArray int16_array_value(void) const
OCTINTERP_API void reset(void) const
virtual void convert_to_row_or_column_vector(void)
virtual octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
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
virtual MatrixType matrix_type(void) const
virtual std::list< std::string > parent_class_name_list(void) const
virtual std::string type_name(void) const
virtual NDArray array_value(bool=false) const
virtual octave_uint64 uint64_scalar_value(void) const
virtual std::string string_value(bool force=false) const
virtual float_display_format get_edit_display_format(void) const
virtual octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
virtual octave_user_code * user_code_value(bool silent=false)
virtual uint8NDArray uint8_array_value(void) const
virtual uint16NDArray uint16_array_value(void) const
virtual double double_value(bool=false) const
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
virtual Matrix matrix_value(bool=false) const
virtual octave_value as_uint16(void) const
virtual sortmode issorted(sortmode mode=UNSORTED) const
virtual octave_value dump(void) const
virtual octave_function * function_value(bool silent=false)
virtual string_vector string_vector_value(bool pad=false) const
friend class octave_value
virtual octave_value any(int=0) const
virtual string_vector map_keys(void) const
virtual bool isnumeric(void) const
virtual bool is_defined(void) const
virtual std::size_t nparents(void) const
virtual Complex complex_value(bool=false) const
OCTINTERP_API void warn_save(const char *type) const
std::string name(void) const
octave_scalar_map checkelem(octave_idx_type n) const
octave_idx_type numel(void) const
octave_idx_type length(void) const
const octave_base_value & get_rep(void) const
charMatrix char_matrix_value(bool frc_str_conv=false) const
octave_base_value::type_conv_info numeric_conversion_function(void) const
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)
bool is_string(void) const
OCTINTERP_API octave_base_value * clone(void) const
std::string string_value(bool force=false) const
string_vector string_vector_value(bool pad=false) const
OCTINTERP_API octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTINTERP_API octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
OCTINTERP_API void maybe_mutate(void)
std::string type_name(void) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
void panic_unless(bool cond)
#define panic_impossible()
void err_wrong_type_arg(const char *name, const char *s)
void err_invalid_conversion(const std::string &from, const std::string &to)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
octave::idx_vector idx_vector
type_info & __get_type_info__(void)
tree_evaluator & __get_evaluator__(void)
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
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
std::complex< double > Complex
std::complex< float > FloatComplex
#define INSTALL_ASSIGNCONV_TI(ti, t1, t2, tr)
#define INSTALL_WIDENOP_TI(ti, t1, t2, f)
static octave_base_value * oct_conv_string_conv(const octave_base_value &)
std::string btyp_class_name[btyp_num_types+1]
void install_base_type_conversions(octave::type_info &ti)
static OCTAVE_NORETURN void err_indexed_assignment(const std::string &tn1, const std::string &tn2)
static octave_base_value * oct_conv_complex_matrix_conv(const octave_base_value &)
static octave_base_value * oct_conv_matrix_conv(const octave_base_value &)
static octave_base_value * oct_conv_cell_conv(const octave_base_value &)
octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
static octave_value_list sanitize(const octave_value_list &ovl)
static OCTAVE_NORETURN void err_assign_conversion_failed(const std::string &tn1, const std::string &tn2)
bool called_from_builtin(void)
builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
Determine the resulting type for a possible mixed-type operation.
static OCTAVE_NORETURN void err_no_conversion(const std::string &on, const std::string &tn1, const std::string &tn2)
#define INT_CONV_METHOD(T, F)
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
octave::type_info::assign_op_fcn assign_op_fcn
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
octave_idx_type dims_to_numel(const dim_vector &dims, const octave_value_list &idx_arg)