26 #if defined (HAVE_CONFIG_H)
501 #if defined (OCTAVE_HAVE_LONG_LONG_INT)
507 #if defined (OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT)
856 : rep (new octave_int8_scalar (i))
862 : rep (new octave_uint8_scalar (i))
868 : rep (new octave_int16_scalar (i))
874 : rep (new octave_uint16_scalar (i))
880 : rep (new octave_int32_scalar (i))
886 : rep (new octave_uint32_scalar (i))
892 : rep (new octave_int64_scalar (i))
904 : rep (new octave_int8_matrix (inda))
910 : rep (new octave_int8_matrix (inda))
916 : rep (new octave_uint8_matrix (inda))
922 : rep (new octave_uint8_matrix (inda))
928 : rep (new octave_int16_matrix (inda))
934 : rep (new octave_int16_matrix (inda))
940 : rep (new octave_uint16_matrix (inda))
946 : rep (new octave_uint16_matrix (inda))
952 : rep (new octave_int32_matrix (inda))
958 : rep (new octave_int32_matrix (inda))
964 : rep (new octave_uint32_matrix (inda))
970 : rep (new octave_uint32_matrix (inda))
976 : rep (new octave_int64_matrix (inda))
982 : rep (new octave_int64_matrix (inda))
1099 const std::list<std::string>& plist)
1106 const std::list<std::string>& plist)
1136 if (tmp && tmp !=
rep)
1145 DEFUN (
double, args, ,
1152 if (args.length () != 1)
1189 DEFUN (single, args, ,
1196 if (args.length () != 1)
1199 return args(0).as_single ();
1230 DEFUN (int8, args, ,
1237 if (args.length () != 1)
1240 return args(0).as_int8 ();
1252 DEFUN (int16, args, ,
1259 if (args.length () != 1)
1262 return args(0).as_int16 ();
1274 DEFUN (int32, args, ,
1281 if (args.length () != 1)
1284 return args(0).as_int32 ();
1296 DEFUN (int64, args, ,
1303 if (args.length () != 1)
1306 return args(0).as_int64 ();
1318 DEFUN (uint8, args, ,
1325 if (args.length () != 1)
1328 return args(0).as_uint8 ();
1340 DEFUN (uint16, args, ,
1347 if (args.length () != 1)
1350 return args(0).as_uint16 ();
1362 DEFUN (uint32, args, ,
1369 if (args.length () != 1)
1372 return args(0).as_uint32 ();
1384 DEFUN (uint64, args, ,
1391 if (args.length () != 1)
1394 return args(0).as_uint64 ();
1410 std::list<octave_value_list> i;
1419 const std::list<octave_value_list>& idx,
int nargout)
1426 const std::list<octave_value_list>& idx,
1429 if (idx.size () > skip)
1431 std::list<octave_value_list> new_idx (idx);
1432 for (
size_t i = 0; i < skip; i++)
1433 new_idx.erase (new_idx.begin ());
1442 const std::list<octave_value_list>& idx,
1445 if (idx.size () > skip)
1447 std::list<octave_value_list> new_idx (idx);
1448 for (
size_t i = 0; i < skip; i++)
1449 new_idx.erase (new_idx.begin ());
1450 return subsref (
type.substr (skip), new_idx, nargout);
1458 const std::list<octave_value_list>& idx,
1461 if (idx.size () > skip)
1463 std::list<octave_value_list> new_idx (idx);
1464 for (
size_t i = 0; i < skip; i++)
1465 new_idx.erase (new_idx.begin ());
1466 return subsref (
type.substr (skip), new_idx, auto_add);
1474 const std::list<octave_value_list>& idx,
1482 const std::list<octave_value_list>& idx,
1490 const std::list<octave_value_list>& idx,
1500 error (
"in computed assignment A(index) OP= X, A must be defined first");
1553 error (
"in computed assignment A OP= X, A must be defined first");
1585 for (
int i = 0; i < dv.
ndims (); i++)
1635 #if defined (OCTAVE_ENABLE_64)
1638 return int_value (req_int, frc_str_conv);
1703 make_vector_dims (
const dim_vector& dv,
bool force_vector_conversion,
1704 const std::string& my_type,
const std::string& wanted_type)
1707 retval.chop_trailing_singletons ();
1712 if (! force_vector_conversion)
1714 my_type.c_str (), wanted_type.c_str ());
1723 bool frc_vec_conv)
const
1731 bool frc_vec_conv)
const
1739 bool frc_vec_conv)
const
1747 bool frc_vec_conv)
const
1755 bool force_vector_conversion)
const
1760 force_vector_conversion,
1764 template <
typename T>
1779 bool force_vector_conversion)
const
1813 double ai = a.
elem (i);
1814 int v =
static_cast<int> (ai);
1829 force_vector_conversion,
1833 template <
typename T>
1848 bool force_string_conv,
1849 bool force_vector_conversion)
const
1883 double ai = a.
elem (i);
1889 error_with_cfn (
"conversion of %g to octave_idx_type value failed", ai);
1899 force_vector_conversion,
1905 bool force_vector_conversion)
const
1910 force_vector_conversion,
1916 bool frc_vec_conv)
const
1924 bool frc_vec_conv)
const
1933 bool frc_vec_conv)
const
1941 bool frc_vec_conv)
const
1949 bool force_vector_conversion)
const
1954 force_vector_conversion,
1960 bool force_vector_conversion)
const
1965 force_vector_conversion,
1973 #define XVALUE_EXTRACTOR(TYPE, NAME, FCN) \
1975 octave_value::NAME (const char *fmt, ...) const \
1983 catch (octave::execution_exception& e) \
1988 va_start (args, fmt); \
1989 verror (e, fmt, args); \
2118 #undef XVALUE_EXTRACTOR
2157 return rep->
write (os, block_size, output_type, skip, flt_fmt);
2160 OCTAVE_NORETURN
static void
2161 err_binary_op (
const std::string& on,
const std::string& tn1,
2162 const std::string& tn2)
2164 error (
"binary operator '%s' not implemented for '%s' by '%s' operations",
2165 on.c_str (), tn1.c_str (), tn2.c_str ());
2168 OCTAVE_NORETURN
static void
2169 err_binary_op_conv (
const std::string& on)
2171 error (
"type conversion failed for binary operator '%s'", on.c_str ());
2367 error (
"invalid compound operator");
2390 retval = decompose_binary_op (ti, op, v1,
v2);
2399 retval = decompose_binary_op (ti, op, v1,
v2);
2414 OCTAVE_NORETURN
static void
2415 err_cat_op (
const std::string& tn1,
const std::string& tn2)
2417 error (
"concatenation operator not implemented for '%s' by '%s' operations",
2418 tn1.c_str (), tn2.c_str ());
2421 OCTAVE_NORETURN
static void
2422 err_cat_op_conv (
void)
2424 error (
"type conversion failed for concatenation operator");
2509 std::string dispatch_type;
2523 error (
"colon method not defined for %s class", dispatch_type.c_str ());
2530 args(1) = increment;
2550 "colon arguments should be scalars");
2555 "imaginary part of complex colon arguments is ignored");
2557 Matrix m_base, m_limit, m_increment;
2563 catch (octave::execution_exception& e)
2565 error (e,
"invalid base value in colon expression");
2572 catch (octave::execution_exception& e)
2574 error (e,
"invalid limit value in colon expression");
2583 catch (octave::execution_exception& e)
2585 error (e,
"invalid increment value in colon expression");
2588 bool base_empty = m_base.
isempty ();
2589 bool limit_empty = m_limit.
isempty ();
2590 bool increment_empty = m_increment.
isempty ();
2592 if (base_empty || limit_empty || increment_empty)
2596 Range r (m_base(0), m_limit(0), m_increment(0));
2604 retval = (
retval.convert_to_str (
false,
true, dq_str ?
'"' :
'\''));
2614 os << prefix <<
"type_name: " <<
type_name () <<
"\n"
2615 << prefix <<
"count: " <<
get_count () <<
"\n"
2616 << prefix <<
"rep info: ";
2621 OCTAVE_NORETURN
static void
2624 error (
"unary operator '%s' not implemented for '%s' operands",
2625 on.c_str (), tn.c_str ());
2628 OCTAVE_NORETURN
static void
2631 error (
"type conversion failed for unary operator '%s'", on.c_str ());
2692 OCTAVE_NORETURN
static void
2694 const std::string& tn)
2696 error (
"operator %s: type conversion for '%s' failed",
2697 op.c_str (), tn.c_str ());
2711 error (
"in x%s or %sx, x must be defined first",
2712 op_str.c_str (), op_str.c_str ());
2755 if (old_rep && --old_rep->
count == 0)
2800 const std::list<octave_value_list>& idx)
2832 error (
"operator %s: no assign operator found", on.c_str ());
2881 error (
"operator %s: no binary operator found", on.c_str ());
2889 if (
type.length () > 0)
2894 if (
type.length () > 1 &&
type[1] ==
'.')
2972 DEFUN (
sizeof, args, ,
2982 return ovl (args(0).byte_size ());
2993 std::string& type_string,
2994 std::list<octave_value_list>& idx)
2998 if (
m.nfields () != 2 || !
m.contains (
"type") || !
m.contains (
"subs"))
2999 error (
"%s: second argument must be a structure with fields 'type' and 'subs'",
3004 type_string = std::string (nel,
'\0');
3005 idx = std::list<octave_value_list> ();
3011 const Cell subs =
m.contents (
"subs");
3013 for (
int k = 0; k < nel; k++)
3015 std::string item =
type(k).xstring_value (
"%s: type(%d) must be a string",
name, k+1);
3018 type_string[k] =
'{';
3019 else if (item ==
"()")
3020 type_string[k] =
'(';
3021 else if (item ==
".")
3022 type_string[k] =
'.';
3024 error (
"%s: invalid indexing type '%s'",
name, item.c_str ());
3028 if (subs(k).is_string ())
3029 idx_item(0) = subs(k);
3030 else if (subs(k).iscell ())
3032 Cell subs_cell = subs(k).cell_value ();
3034 for (
int n = 0;
n < subs_cell.
numel ();
n++)
3036 if (subs_cell(
n).is_string ()
3037 && subs_cell(
n).string_value () ==
":")
3040 idx_item(
n) = subs_cell(
n);
3044 error (
"%s: subs(%d) must be a string or cell array",
name, k+1);
3046 idx.push_back (idx_item);
3050 DEFUN (subsref, args, nargout,
3090 std::list<octave_value_list> idx;
3102 DEFUN (subsasgn, args, ,
3139 std::list<octave_value_list> idx;
3146 return ovl (args(2).storable_value ());
3234 DEFUN (is_sq_string, args, ,
3244 return ovl (args(0).is_sq_string ());
3257 DEFUN (is_dq_string, args, ,
3267 return ovl (args(0).is_dq_string ());
3280 DEFUN (disable_permutation_matrix, args, nargout,
3310 DEFUN (disable_diagonal_matrix, args, nargout,
3354 DEFUN (disable_range, args, nargout,
template class OCTAVE_API Array< octave_idx_type >
template class OCTAVE_API Array< int >
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
T & xelem(octave_idx_type n)
Size of the specified dimension.
octave_idx_type numel(void) const
Number of elements in the array.
T & elem(octave_idx_type n)
Size of the specified dimension.
void maybe_economize(void)
Size of the specified dimension.
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
Size of the specified dimension.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
int ndims(void) const
Size of the specified dimension.
bool isempty(void) const
Size of the specified dimension.
Vector representing the dimensions (size) of an Array.
std::string str(char sep='x') const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
static dim_vector alloc(int n)
octave_idx_type ndims(void) const
Number of dimensions.
void unconvert(idx_class_type &iclass, double &scalar, Range &range, Array< double > &array, Array< bool > &mask) const
idx_class_type idx_class(void) const
octave_value find_method(const std::string &name, const std::string &dispatch_type)
unary_class_op_fcn lookup_unary_class_op(octave_value::unary_op)
unary_op_fcn lookup_unary_op(octave_value::unary_op, int)
octave_value(* binary_class_op_fcn)(const octave_value &, const octave_value &)
non_const_unary_op_fcn lookup_non_const_unary_op(octave_value::unary_op, int)
assign_op_fcn lookup_assign_op(octave_value::assign_op, int, int)
octave_value(* unary_class_op_fcn)(const octave_value &)
octave_value(* assign_op_fcn)(octave_base_value &, const octave_value_list &, const octave_base_value &)
octave_value(* binary_op_fcn)(const octave_base_value &, const octave_base_value &)
octave_value(* unary_op_fcn)(const octave_base_value &)
octave_value(* cat_op_fcn)(octave_base_value &, const octave_base_value &, const Array< octave_idx_type > &ra_idx)
binary_class_op_fcn lookup_binary_class_op(octave_value::binary_op)
binary_op_fcn lookup_binary_op(octave_value::binary_op, int, int)
cat_op_fcn lookup_cat_op(int, int)
void(* non_const_unary_op_fcn)(octave_base_value &)
virtual type_conv_info numeric_conversion_function(void) const
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
octave::refcount< octave_idx_type > count
virtual Cell cell_value(void) const
virtual octave_scalar_map scalar_map_value(void) const
virtual octave_user_script * user_script_value(bool silent=false)
octave_base_value *(* type_conv_fcn)(const octave_base_value &)
virtual octave_map map_value(void) const
virtual octave_fcn_handle * fcn_handle_value(bool silent=false)
virtual octave_classdef * classdef_object_value(bool silent=false)
virtual octave_value_list list_value(void) const
virtual octave_base_value * empty_clone(void) const
virtual int type_id(void) const
virtual std::string class_name(void) const
virtual octave_user_function * user_function_value(bool silent=false)
virtual octave_base_value * try_narrowing_conversion(void)
virtual void print_info(std::ostream &os, const std::string &prefix) 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 std::string type_name(void) 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 octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
static void register_type(void)
virtual octave_function * function_value(bool silent=false)
virtual octave_base_value * clone(void) const
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static int static_type_id(void)
static int static_type_id(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static const octave_value instance
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
static void register_type(void)
octave_idx_type length(void) const
void maybe_economize(void)
std::string get_dims_str(void) const
assign_op unary_op_to_assign_op(unary_op op)
octave_idx_type get_count(void) const
octave_idx_type length(void) const
static std::string unary_op_fcn_name(unary_op)
int32NDArray int32_array_value(void) const
uint16NDArray uint16_array_value(void) const
ComplexRowVector complex_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
static std::string binary_op_as_string(binary_op)
octave_map xmap_value(const char *fmt,...) const
octave_base_value::type_conv_info numeric_conversion_function(void) const
void make_storable_value(void)
octave_user_function * user_function_value(bool silent=false) const
octave_value & operator=(const octave_value &a)
int int_value(bool req_int=false, bool frc_str_conv=false) const
bool is_uint16_type(void) const
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
int64_t int64_value(bool req_int=false, bool frc_str_conv=false) const
friend OCTINTERP_API octave_value do_unary_op(octave::type_info &ti, unary_op op, const octave_value &a)
bool is_int8_type(void) const
octave_idx_type rows(void) const
Array< FloatComplex > float_complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
static std::string assign_op_as_string(assign_op)
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
octave_idx_type numel(void) const
octave_idx_type idx_type_value(bool req_int=false, bool frc_str_conv=false) const
bool is_dq_string(void) const
static assign_op binary_op_to_assign_op(binary_op)
bool is_string(void) const
FloatComplexRowVector float_complex_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_user_code * user_code_value(bool silent=false) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
FloatRowVector float_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_base_value * empty_clone(void) const
bool is_defined(void) const
bool isinteger(void) const
bool is_double_type(void) const
FloatColumnVector float_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
Cell cell_value(void) const
bool is_equal(const octave_value &) const
std::string class_name(void) const
bool is_uint32_type(void) const
octave_idx_type columns(void) const
Array< octave_idx_type > octave_idx_type_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
int8NDArray int8_array_value(void) const
static std::string unary_op_as_string(unary_op)
octave_value & do_non_const_unary_op(unary_op op)
bool is_int64_type(void) const
int64NDArray int64_array_value(void) const
octave_function * function_value(bool silent=false) const
uint8NDArray uint8_array_value(void) const
octave_value reshape(const dim_vector &dv) const
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
FloatComplexColumnVector float_complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_zero_by_zero(void) const
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
octave_fcn_handle * fcn_handle_value(bool silent=false) const
friend OCTINTERP_API octave_value do_binary_op(octave::type_info &ti, binary_op op, const octave_value &a, const octave_value &b)
void print_info(std::ostream &os, const std::string &prefix="") const
octave_scalar_map scalar_map_value(void) const
bool is_int32_type(void) const
static octave_base_value * nil_rep(void)
octave_value storable_value(void) const
bool is_uint64_type(void) const
bool is_int16_type(void) const
uint64NDArray uint64_array_value(void) const
octave_base_value::type_conv_info numeric_demotion_function(void) const
octave_value single_subsref(const std::string &type, const octave_value_list &idx)
ComplexColumnVector complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_classdef * classdef_object_value(bool silent=false) const
NDArray array_value(bool frc_str_conv=false) const
static binary_op assign_op_to_binary_op(assign_op)
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
static std::string binary_op_fcn_name(binary_op)
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
binary_op op_eq_to_binary_op(assign_op op)
uint32NDArray uint32_array_value(void) const
octave_value_list list_value(void) const
octave_value all(int dim=0) const
Array< float > float_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool isobject(void) const
octave_map map_value(void) const
bool is_undefined(void) const
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
octave_base_value * rep
The real representation.
ColumnVector column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
Array< Complex > complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
Array< int > int_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
FloatNDArray float_array_value(bool frc_str_conv=false) const
bool is_uint8_type(void) const
RowVector row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
int16NDArray int16_array_value(void) const
float_display_format get_edit_display_format(void) const
octave_base_value * clone(void) const
Matrix matrix_value(bool frc_str_conv=false) const
bool iscomplex(void) const
std::string type_name(void) const
dim_vector dims(void) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
octave_user_script * user_script_value(bool silent=false) const
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void warning_with_id(const char *id, const char *fmt,...)
void error_with_cfn(const char *fmt,...)
void error(const char *fmt,...)
#define panic_impossible()
void warn_implicit_conversion(const char *id, const char *from, const char *to)
F77_RET_T const F77_INT F77_CMPLX * A
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
F77_RET_T const F77_DBLE const F77_DBLE * f
int register_type(const std::string &t_name, const std::string &c_name, const octave_value &val)
type_info & __get_type_info__(const std::string &who)
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
symbol_table & __get_symbol_table__(const std::string &who)
std::complex< double > Complex
std::complex< float > FloatComplex
static double as_double(time_t sec, long usec)
const octave_base_value const Array< octave_idx_type > & ra_idx
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
const octave_char_matrix & v2
static bool scalar(const dim_vector &dims)
octave_value::octave_value(const Array< char > &chm, char type) return retval
static void decode_subscripts(const char *name, const octave_value &arg, std::string &type_string, std::list< octave_value_list > &idx)
octave_value do_unary_op(octave::type_info &ti, octave_value::unary_op op, const octave_value &v)
static bool Vdisable_diagonal_matrix
static OCTAVE_NORETURN void err_unary_op_conv(const std::string &on)
void install_types(octave::type_info &ti)
static OCTAVE_NORETURN void err_unary_op_conversion_failed(const std::string &op, const std::string &tn)
#define XVALUE_EXTRACTOR(TYPE, NAME, FCN)
static OCTAVE_NORETURN void err_unary_op(const std::string &on, const std::string &tn)
static bool Vdisable_range
static bool Vdisable_permutation_matrix
OCTINTERP_API octave_value do_cat_op(octave::type_info &ti, const octave_value &a, const octave_value &b, const Array< octave_idx_type > &ra_idx)
OCTINTERP_API octave_value do_colon_op(const octave_value &base, const octave_value &limit, bool is_for_cmd_expr=false)
OCTINTERP_API octave_value do_binary_op(octave::type_info &ti, octave_value::binary_op op, const octave_value &a, const octave_value &b)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
#define SET_INTERNAL_VARIABLE(NM)