78 retval = (x > y) ? x : y;
85 "double",
"single",
"double",
"single",
86 "int8",
"int16",
"int32",
"int64",
87 "uint8",
"uint16",
"uint32",
"uint64",
89 "struct",
"cell",
"function_handle"
114 "<unknown type>",
"unknown");
130 error (
"squeeze: invalid operation for %s type", nm.c_str ());
159 const std::list<octave_value_list>&)
162 error (
"can't perform indexing operations for %s type", nm.c_str ());
168 const std::list<octave_value_list>&,
int)
171 error (
"can't perform indexing operations for %s type", nm.c_str ());
177 const std::list<octave_value_list>& idx,
186 const std::list<octave_value_list>& idx,
188 const std::list<octave_lvalue> *)
191 return subsref (type, idx, nargout);
198 error (
"can't perform indexing operations for %s type", nm.c_str ());
206 error (
"can't perform indexing operations for %s type", nm.c_str ());
212 const std::list<octave_lvalue> *)
222 error (
"%s type invalid as index value", nm.c_str ());
228 const std::list<octave_value_list>& idx,
241 if (type.length () == 1)
252 retval = tmp.
subsasgn (type, idx, rhs);
257 error (
"in indexed assignment of %s, last rhs index must be ()",
267 error (
"%s cannot be indexed with %c", nm.c_str (), type[0]);
278 error (
"can't perform indexed assignment for %s type", nm.c_str ());
296 const std::list<octave_value_list>& idx,
396 (
"octave_base_value::convert_to_row_or_column_vector ()",
414 const std::string& name)
const
437 const std::string& name,
450 const std::string& )
const
452 os <<
"no info for type: " <<
type_name () <<
"\n";
455 #define INT_CONV_METHOD(T, F) \
457 octave_base_value::F ## _value (bool require_int, bool frc_str_conv) const \
461 double d = double_value (frc_str_conv); \
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 (); \
472 retval = static_cast<T> (::fix (d)); \
475 gripe_wrong_type_arg ("octave_base_value::" #F "_value ()", \
504 error (
"conversion of NaN to integer value failed");
508 retval =
static_cast<int> (
::fix (d));
946 if (tmp.
numel () == 1)
951 error (
"invalid conversion of multi-dimensional struct to scalar struct");
973 std::list<std::string>
976 std::list<std::string> retval;
1261 (
"Octave:load-save-unavailable",
1262 "%s: loading %s files not available in this version of Octave",
1270 (
"Octave:load-save-unavailable",
1271 "%s: saving %s files not available in this version of Octave",
1301 <<
" dims: " << dv.
str ();
1307 error (
"assignment of '%s' to indexed '%s' not implemented",
1308 tn2.c_str (), tn1.c_str ());
1313 const std::string& tn2)
1315 error (
"type conversion for assignment of '%s' to indexed '%s' failed",
1316 tn2.c_str (), tn1.c_str ());
1321 const std::string& tn2)
1323 error (
"operator %s: no conversion for assignment of '%s' to indexed '%s'",
1324 on.c_str (), tn2.c_str (), tn1.c_str ());
1329 const std::list<octave_value_list>& idx,
1334 if (idx.front ().empty ())
1336 error (
"missing index in indexed assignment");
1351 f (*
this, idx.front (), rhs.
get_rep ());
1379 retval = val.
subsasgn (type, idx, rhs);
1409 else if (cf_this.
type_id () >= 0
1449 if (cf_this || cf_rhs)
1451 retval = tmp_lhs.
subsasgn (type, idx, tmp_rhs);
1562 if (retval(i).is_magic_colon ())
1571 const std::list<octave_value_list>& idx,
1572 const std::string& who)
1576 size_t len = type.
length ();
1578 if (len == idx.size ())
1580 Cell type_field (1, len);
1581 Cell subs_field (1, len);
1583 std::list<octave_value_list>::const_iterator p = idx.begin ();
1585 for (
size_t i = 0; i < len; i++)
1592 type_field(i) =
"()";
1597 type_field(i) =
"{}";
1603 type_field(i) =
".";
1607 if (vlist.
length () == 1)
1612 subs_field(i) = val;
1615 error (
"string argument required for '.' index");
1621 error (
"only single argument permitted for '.' index");
1635 m.
assign (
"type", type_field);
1636 m.
assign (
"subs", subs_field);
1641 error (
"invalid index for %s", who.c_str ());
1657 return (fcn && fcn->
name () ==
"builtin");
1675 complex_matrix_conv);
1680 DEFUN (sparse_auto_mutate, args, nargout,
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\
1693 sparse_auto_mutate (false);\n\
1696 @result{} sparse matrix\n\
1697 sparse_auto_mutate (true);\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\
virtual idx_vector index_vector(bool require_integers=false) const
bool called_from_builtin(void)
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
virtual int16NDArray int16_array_value(void) const
void warning_with_id(const char *id, const char *fmt,...)
virtual dim_vector dims(void) const
virtual uint64NDArray uint64_array_value(void) const
virtual uint16NDArray uint16_array_value(void) const
virtual octave_value diag(octave_idx_type k=0) const
bool is_empty(void) const
virtual float float_value(bool=false) const
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
virtual octave_fcn_handle * fcn_handle_value(bool silent=false)
std::string str(char sep= 'x') const
virtual bool save_binary(std::ostream &os, bool &save_as_floats)
octave_refcount< octave_idx_type > count
virtual boolMatrix bool_matrix_value(bool=false) const
void gripe_wrong_type_arg(const char *name, const char *s, bool is_error)
virtual MatrixType matrix_type(void) const
virtual Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
static void gripe_no_conversion(const std::string &on, const std::string &tn1, const std::string &tn2)
virtual octave_value_list do_multi_index_op(int nargout, const octave_value_list &idx)
virtual type_conv_info numeric_conversion_function(void) const
virtual int32NDArray int32_array_value(void) const
void assign(const std::string &k, const Cell &val)
virtual octave_idx_type nzmax(void) const
virtual SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
octave_value numeric_assign(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
virtual octave_map map_value(void) const
virtual octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
virtual FloatDiagMatrix float_diag_matrix_value(bool=false) const
void gripe_load(const char *type) const
octave_idx_type length(void) const
virtual octave_uint32 uint32_scalar_value(void) const
virtual charNDArray char_array_value(bool=false) const
virtual Range range_value(void) const
virtual int nint_value(bool=false) const
virtual void unlock(void)
virtual octave_value fast_elem_extract(octave_idx_type n) const
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
virtual uint8NDArray uint8_array_value(void) const
static void gripe_assign_conversion_failed(const std::string &tn1, const std::string &tn2)
std::string name(void) const
#define SET_INTERNAL_VARIABLE(NM)
#define INT_CONV_METHOD(T, F)
void indent(std::ostream &os) const
#define INSTALL_WIDENOP(t1, t2, f)
static string_vector names(const map_type &lst)
virtual bool is_numeric_type(void) const
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
virtual bool fast_elem_insert(octave_idx_type n, const octave_value &x)
void gripe_save(const char *type) const
static std::string assign_op_as_string(assign_op)
virtual SparseBoolMatrix sparse_bool_matrix_value(bool=false) const
double lo_ieee_nan_value(void)
static int lookup_pref_assign_conv(int t_lhs, int t_rhs)
octave_idx_type numel(void) const
virtual octave_int8 int8_scalar_value(void) const
virtual octave_uint8 uint8_scalar_value(void) const
virtual bool save_ascii(std::ostream &os)
virtual octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
virtual bool fast_elem_insert_self(void *where, builtin_type_t btyp) const
static const char * get_umap_name(unary_mapper_t)
virtual Array< std::string > cellstr_value(void) const
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
void newline(std::ostream &os) const
virtual string_vector map_keys(void) const
virtual ComplexDiagMatrix complex_diag_matrix_value(bool=false) const
bool is_empty(void) const
octave_base_value * clone(void) const
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)
string_vector all_strings(bool pad=false) const
virtual void print(std::ostream &os, bool pr_as_read_syntax=false)
virtual void print_info(std::ostream &os, const std::string &prefix) const
virtual octave_idx_type numel(void) const
virtual FloatComplexMatrix float_complex_matrix_value(bool=false) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
static int curr_print_indent_level
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
virtual octave_value_list list_value(void) const
virtual octave_uint16 uint16_scalar_value(void) const
virtual octave_fcn_inline * fcn_inline_value(bool silent=false)
virtual size_t nparents(void) const
virtual Complex complex_value(bool=false) const
virtual std::list< std::string > parent_class_name_list(void) const
double double_value(bool=false) const
builtin_type_t btyp_mixed_numeric(builtin_type_t x, builtin_type_t y)
virtual octave_user_function * user_function_value(bool silent=false)
static octave_function * caller(void)
F77_RET_T const double const double * f
virtual uint32NDArray uint32_array_value(void) const
virtual octave_scalar_map scalar_map_value(void) const
virtual double double_value(bool=false) const
virtual octave_int16 int16_scalar_value(void) const
virtual octave_value full_value(void) const
virtual int64NDArray int64_array_value(void) const
std::string string_value(bool force=false) const
virtual std::string string_value(bool force=false) const
virtual bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
octave_base_value::type_conv_info numeric_conversion_function(void) const
std::string btyp_class_name[btyp_num_types]
virtual SparseMatrix sparse_matrix_value(bool=false) const
virtual int8NDArray int8_array_value(void) const
virtual octave_value reshape(const dim_vector &) const
virtual FloatComplexNDArray float_complex_array_value(bool=false) const
bool is_string(void) const
static const std::string t_name
virtual DiagMatrix diag_matrix_value(bool=false) const
virtual octave_value permute(const Array< int > &vec, bool=false) const
virtual octave_value all(int=0) const
virtual octave_base_value * empty_clone(void) const
#define panic_impossible()
virtual FloatComplex float_complex_value(bool=false) const
virtual charMatrix char_matrix_value(bool force=false) const
string_vector get_builtin_classes(void)
virtual bool print_as_scalar(void) const
virtual void dump(std::ostream &os) const
octave_idx_type length(void) const
void install_base_type_conversions(void)
virtual ComplexMatrix complex_matrix_value(bool=false) const
virtual bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
virtual octave_uint64 uint64_scalar_value(void) const
virtual Matrix matrix_value(bool=false) const
virtual Matrix size(void)
virtual octave_user_code * user_code_value(bool silent=false)
virtual bool load_hdf5(octave_hdf5_id loc_id, const char *name)
virtual void convert_to_row_or_column_vector(void)
virtual bool is_defined(void) const
float lo_ieee_float_nan_value(void)
virtual bool print_name_tag(std::ostream &os, const std::string &name) const
virtual FloatMatrix float_matrix_value(bool=false) const
charMatrix char_matrix_value(bool frc_str_conv=false) const
virtual std::string class_name(void) const
virtual octave_idx_type nnz(void) const
friend class octave_value
virtual FloatComplexDiagMatrix float_complex_diag_matrix_value(bool=false) const
std::string type_name(void) const
octave_value(* assign_op_fcn)(octave_base_value &, const octave_value_list &, const octave_base_value &)
octave_value make_idx_args(const std::string &type, const std::list< octave_value_list > &idx, const std::string &who)
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
virtual bool load_ascii(std::istream &is)
virtual ComplexNDArray complex_array_value(bool=false) const
octave_base_value *(* type_conv_fcn)(const octave_base_value &)
octave_value_list ovl(const octave_value &a0)
virtual FloatNDArray float_array_value(bool=false) const
OCTAVE_EMPTY_CPP_ARG std::string type_name(void) const
virtual int type_id(void) const
static octave_value_list sanitize(const octave_value_list &ovl)
virtual string_vector parent_class_names(void) const
const octave_base_value & get_rep(void) const
octave_idx_type dims_to_numel(const dim_vector &dims, const octave_value_list &idx)
virtual string_vector all_strings(bool pad=false) const
virtual octave_value convert_to_str_internal(bool pad, bool force, char type) const
virtual std::string type_name(void) const
virtual octave_value squeeze(void) const
virtual mxArray * as_mxArray(void) const
static void gripe_indexed_assignment(const std::string &tn1, const std::string &tn2)
virtual octave_value map(unary_mapper_t) const
virtual sortmode is_sorted_rows(sortmode mode=UNSORTED) const
octave_scalar_map checkelem(octave_idx_type n) const
virtual octave_value any(int=0) const
std::complex< float > FloatComplex
virtual void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
static assign_op_fcn lookup_assign_op(octave_value::assign_op op, int t_lhs, int t_rhs)
virtual octave_value resize(const dim_vector &, bool fill=false) const
std::complex< double > Complex
virtual octave_function * function_value(bool silent=false)
virtual sortmode is_sorted(sortmode mode=UNSORTED) const
static bool beginning_of_line
#define INSTALL_ASSIGNCONV(t1, t2, tr)
virtual NDArray array_value(bool=false) const
virtual Cell cell_value(void) const
virtual octave_idx_type nfields(void) const
virtual octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
virtual octave_int32 int32_scalar_value(void) const
virtual bool bool_value(bool=false) const
virtual PermMatrix perm_matrix_value(void) const
virtual octave_user_script * user_script_value(bool silent=false)
virtual void print_with_name(std::ostream &output_buf, const std::string &name, bool print_padding=true)
virtual boolNDArray bool_array_value(bool=false) const
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
F77_RET_T const double * x
virtual octave_int64 int64_scalar_value(void) const
static octave_base_value::type_conv_fcn lookup_widening_op(int t, int t_result)