24 #if defined (HAVE_CONFIG_H) 500 #if defined (OCTAVE_HAVE_LONG_LONG_INT) 506 #if defined (OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT) 855 : rep (new octave_int8_scalar (
i))
861 : rep (new octave_uint8_scalar (
i))
867 : rep (new octave_int16_scalar (
i))
873 : rep (new octave_uint16_scalar (
i))
879 : rep (new octave_int32_scalar (
i))
885 : rep (new octave_uint32_scalar (
i))
891 : rep (new octave_int64_scalar (
i))
897 : rep (new octave_uint64_scalar (
i))
903 : rep (new octave_int8_matrix (inda))
909 : rep (new octave_int8_matrix (inda))
915 : rep (new octave_uint8_matrix (inda))
921 : rep (new octave_uint8_matrix (inda))
927 : rep (new octave_int16_matrix (inda))
933 : rep (new octave_int16_matrix (inda))
939 : rep (new octave_uint16_matrix (inda))
945 : rep (new octave_uint16_matrix (inda))
951 : rep (new octave_int32_matrix (inda))
957 : rep (new octave_int32_matrix (inda))
963 : rep (new octave_uint32_matrix (inda))
969 : rep (new octave_uint32_matrix (inda))
975 : rep (new octave_int64_matrix (inda))
981 : rep (new octave_int64_matrix (inda))
987 : rep (new octave_uint64_matrix (inda))
993 : rep (new octave_uint64_matrix (inda))
1098 const std::list<std::string>& plist)
1105 const std::list<std::string>& plist)
1148 DEFUN (
double, args, ,
1155 if (args.length () != 1)
1192 DEFUN (single, args, ,
1199 if (args.length () != 1)
1202 return args(0).as_single ();
1233 DEFUN (int8, args, ,
1240 if (args.length () != 1)
1243 return args(0).as_int8 ();
1255 DEFUN (int16, args, ,
1262 if (args.length () != 1)
1265 return args(0).as_int16 ();
1277 DEFUN (int32, args, ,
1284 if (args.length () != 1)
1287 return args(0).as_int32 ();
1299 DEFUN (int64, args, ,
1306 if (args.length () != 1)
1309 return args(0).as_int64 ();
1321 DEFUN (uint8, args, ,
1328 if (args.length () != 1)
1331 return args(0).as_uint8 ();
1343 DEFUN (uint16, args, ,
1350 if (args.length () != 1)
1353 return args(0).as_uint16 ();
1365 DEFUN (uint32, args, ,
1372 if (args.length () != 1)
1375 return args(0).as_uint32 ();
1387 DEFUN (uint64, args, ,
1394 if (args.length () != 1)
1397 return args(0).as_uint64 ();
1413 std::list<octave_value_list>
i;
1422 const std::list<octave_value_list>& idx,
int nargout)
1429 const std::list<octave_value_list>& idx,
1432 if (idx.size () > skip)
1434 std::list<octave_value_list> new_idx (idx);
1435 for (
size_t i = 0;
i < skip;
i++)
1436 new_idx.erase (new_idx.begin ());
1445 const std::list<octave_value_list>& idx,
1448 if (idx.size () > skip)
1450 std::list<octave_value_list> new_idx (idx);
1451 for (
size_t i = 0;
i < skip;
i++)
1452 new_idx.erase (new_idx.begin ());
1461 const std::list<octave_value_list>& idx,
1464 if (idx.size () > skip)
1466 std::list<octave_value_list> new_idx (idx);
1467 for (
size_t i = 0;
i < skip;
i++)
1468 new_idx.erase (new_idx.begin ());
1469 return subsref (
type.substr (skip), new_idx, auto_add);
1477 const std::list<octave_value_list>& idx,
1485 const std::list<octave_value_list>& idx,
1493 const std::list<octave_value_list>& idx,
1503 error (
"in computed assignment A(index) OP= X, A must be defined first");
1556 error (
"in computed assignment A OP= X, A must be defined first");
1595 if (
tmp.is_defined ())
1618 #if defined (OCTAVE_ENABLE_64) 1621 return int_value (req_int, frc_str_conv);
1692 make_vector_dims (
const dim_vector&
dv,
bool force_vector_conversion,
1696 retval.chop_trailing_singletons ();
1701 if (! force_vector_conversion)
1703 my_type.c_str (), wanted_type.c_str ());
1712 bool frc_vec_conv)
const 1720 bool frc_vec_conv)
const 1728 bool frc_vec_conv)
const 1736 bool frc_vec_conv)
const 1744 bool force_vector_conversion)
const 1749 force_vector_conversion,
1753 template <
typename T>
1768 bool force_vector_conversion)
const 1802 double ai =
a.elem (
i);
1803 int v =
static_cast<int> (ai);
1818 force_vector_conversion,
1822 template <
typename T>
1837 bool force_string_conv,
1838 bool force_vector_conversion)
const 1872 double ai =
a.elem (
i);
1888 force_vector_conversion,
1894 bool force_vector_conversion)
const 1899 force_vector_conversion,
1905 bool frc_vec_conv)
const 1913 bool frc_vec_conv)
const 1922 bool frc_vec_conv)
const 1930 bool frc_vec_conv)
const 1938 bool force_vector_conversion)
const 1943 force_vector_conversion,
1949 bool force_vector_conversion)
const 1954 force_vector_conversion,
1962 #define XVALUE_EXTRACTOR(TYPE, NAME, FCN) \ 1964 octave_value::NAME (const char *fmt, ...) const \ 1972 catch (octave::execution_exception& e) \ 1977 va_start (args, fmt); \ 1978 verror (e, fmt, args); \ 2108 #undef XVALUE_EXTRACTOR 2150 OCTAVE_NORETURN
static void 2154 error (
"binary operator '%s' not implemented for '%s' by '%s' operations",
2155 on.c_str (), tn1.c_str (), tn2.c_str ());
2158 OCTAVE_NORETURN
static void 2161 error (
"type conversion failed for binary operator '%s'",
on.c_str ());
2357 error (
"invalid compound operator");
2380 retval = decompose_binary_op (ti, op, v1,
v2);
2389 retval = decompose_binary_op (ti, op, v1,
v2);
2404 OCTAVE_NORETURN
static void 2407 error (
"concatenation operator not implemented for '%s' by '%s' operations",
2408 tn1.c_str (), tn2.c_str ());
2411 OCTAVE_NORETURN
static void 2412 err_cat_op_conv (
void)
2414 error (
"type conversion failed for concatenation operator");
2513 error (
"colon method not defined for %s class", dispatch_type.c_str ());
2520 args(1) = increment;
2529 if (
tmp.length () > 0)
2537 Matrix m_base, m_limit, m_increment;
2543 catch (octave::execution_exception&
e)
2545 error (
e,
"invalid base value in colon expression");
2552 catch (octave::execution_exception&
e)
2554 error (
e,
"invalid limit value in colon expression");
2563 catch (octave::execution_exception&
e)
2565 error (
e,
"invalid increment value in colon expression");
2568 bool base_empty = m_base.
isempty ();
2569 bool limit_empty = m_limit.
isempty ();
2570 bool increment_empty = m_increment.
isempty ();
2572 if (base_empty || limit_empty || increment_empty)
2576 Range r (m_base(0), m_limit(0), m_increment(0));
2584 retval = (
retval.convert_to_str (
false,
true, dq_str ?
'"' :
'\''));
2594 os << prefix <<
"type_name: " <<
type_name () <<
"\n" 2595 << prefix <<
"count: " <<
get_count () <<
"\n" 2596 << prefix <<
"rep info: ";
2601 OCTAVE_NORETURN
static void 2604 error (
"unary operator '%s' not implemented for '%s' operands",
2605 on.c_str (), tn.c_str ());
2608 OCTAVE_NORETURN
static void 2611 error (
"type conversion failed for unary operator '%s'",
on.c_str ());
2672 OCTAVE_NORETURN
static void 2676 error (
"operator %s: type conversion for '%s' failed",
2677 op.c_str (), tn.c_str ());
2691 error (
"in x%s or %sx, x must be defined first",
2692 op_str.c_str (), op_str.c_str ());
2735 if (old_rep && --old_rep->
count == 0)
2780 const std::list<octave_value_list>& idx)
2812 error (
"operator %s: no assign operator found",
on.c_str ());
2861 error (
"operator %s: no binary operator found",
on.c_str ());
2869 if (
type.length () > 0)
2874 if (
type.length () > 1 &&
type[1] ==
'.')
2953 DEFUN (
sizeof, args, ,
2963 return ovl (args(0).byte_size ());
2975 std::list<octave_value_list>& idx)
2980 error (
"%s: second argument must be a structure with fields 'type' and 'subs'",
2986 idx = std::list<octave_value_list> ();
2994 for (
int k = 0;
k < nel;
k++)
2999 type_string[
k] =
'{';
3000 else if (item ==
"()")
3001 type_string[
k] =
'(';
3002 else if (item ==
".")
3003 type_string[
k] =
'.';
3005 error (
"%s: invalid indexing type '%s'",
name, item.c_str ());
3009 if (
subs(
k).is_string ())
3010 idx_item(0) =
subs(
k);
3011 else if (
subs(
k).iscell ())
3015 for (
int n = 0; n < subs_cell.
numel (); n++)
3017 if (subs_cell(n).is_string ()
3018 && subs_cell(n).string_value () ==
":")
3021 idx_item(n) = subs_cell(n);
3025 error (
"%s: subs(%d) must be a string or cell array",
name,
k+1);
3027 idx.push_back (idx_item);
3071 std::list<octave_value_list> idx;
3120 std::list<octave_value_list> idx;
3127 return ovl (args(2).storable_value ());
3215 DEFUN (is_sq_string, args, ,
3225 return ovl (args(0).is_sq_string ());
3238 DEFUN (is_dq_string, args, ,
3248 return ovl (args(0).is_dq_string ());
OCTINTERP_API octave_value_list feval(const std::string &name, const octave_value_list &args=octave_value_list(), int nargout=0)
Array< int > int_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
static void register_type(void)
octave_base_value * clone(void) const
octave_idx_type idx_type_value(bool req_int=false, bool frc_str_conv=false) const
virtual octave_fcn_handle * fcn_handle_value(bool silent=false)
octave_value(* binary_class_op_fcn)(const octave_value &, const octave_value &)
bool contains(const std::string &name) const
octave_value::octave_value(const Array< char > &chm, char type) return retval
int int_value(bool req_int=false, bool frc_str_conv=false) const
bool is_uint32_type(void) const
static OCTAVE_NORETURN void err_unary_op_conv(const std::string &on)
idx_class_type idx_class(void) const
#define XVALUE_EXTRACTOR(TYPE, NAME, FCN)
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_value & operator=(const octave_value &a)
unary_op_fcn lookup_unary_op(octave_value::unary_op, int)
const octave_base_value const Array< octave_idx_type > & ra_idx
nd group nd example oindent but is performed more efficiently If only and it is a scalar
octave_value(* cat_op_fcn)(octave_base_value &, const octave_base_value &, const Array< octave_idx_type > &ra_idx)
octave_map map_value(void) const
static void register_type(void)
static void register_type(void)
FloatComplexColumnVector float_complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
OCTINTERP_API void print_usage(void)
static std::string binary_op_as_string(binary_op)
octave_value(* binary_op_fcn)(const octave_base_value &, const octave_base_value &)
static bool Vdisable_range
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE * f
octave_base_value * empty_clone(void) const
idx subsref(val, idx) esult
void install_types(octave::type_info &ti)
static void register_type(void)
static assign_op binary_op_to_assign_op(binary_op)
static void register_type(void)
FloatRowVector float_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
int64_t int64_value(bool req_int=false, bool frc_str_conv=false) const
static void register_type(void)
int32NDArray int32_array_value(void) const
virtual int type_id(void) const
virtual octave_base_value * clone(void) const
octave_user_script * user_script_value(bool silent=false) const
binary_op_fcn lookup_binary_op(octave_value::binary_op, int, int)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void(* non_const_unary_op_fcn)(octave_base_value &)
void error(const char *fmt,...)
#define SET_INTERNAL_VARIABLE(NM)
static std::string unary_op_fcn_name(unary_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 void register_type(void)
octave_fcn_inline * fcn_inline_value(bool silent=false) const
static void register_type(void)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
void unconvert(idx_class_type &iclass, double &scalar, Range &range, Array< double > &array, Array< bool > &mask) const
static void register_type(void)
static binary_op assign_op_to_binary_op(assign_op)
octave::mach_info::float_format flt_fmt
static void register_type(void)
virtual Cell cell_value(void) const
bool is_defined(void) const
static std::string assign_op_as_string(assign_op)
static void register_type(void)
static OCTAVE_NORETURN void err_unary_op_conversion_failed(const std::string &op, const std::string &tn)
friend OCTINTERP_API octave_value do_binary_op(octave::type_info &ti, binary_op op, const octave_value &a, const octave_value &b)
static void register_type(void)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
static void register_type(void)
binary_class_op_fcn lookup_binary_class_op(octave_value::binary_op)
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
FloatNDArray float_array_value(bool frc_str_conv=false) const
bool isobject(void) const
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
void print_info(std::ostream &os, const std::string &prefix="") const
static void register_type(void)
bool is_int16_type(void) const
octave_value(* unary_op_fcn)(const octave_base_value &)
binary_op op_eq_to_binary_op(assign_op op)
octave_value & do_non_const_unary_op(unary_op op)
virtual octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
octave_base_value * rep
The real representation.
Array< FloatComplex > float_complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_value(* assign_op_fcn)(octave_base_value &, const octave_value_list &, const octave_base_value &)
bool is_dq_string(void) const
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
uint32NDArray uint32_array_value(void) const
static double as_double(time_t sec, long usec)
virtual octave_map map_value(void) const
static bool Vdisable_permutation_matrix
virtual octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
assign_op_fcn lookup_assign_op(octave_value::assign_op, int, int)
static void register_type(void)
octave_value storable_value(void) const
octave_value single_subsref(const std::string &type, const octave_value_list &idx)
static void register_type(void)
bool is_equal(const octave_value &) const
virtual octave_fcn_inline * fcn_inline_value(bool silent=false)
static void register_type(void)
then the function must return scalars which will be concatenated into the return array(s). If code
int16NDArray int16_array_value(void) const
symbol_table & __get_symbol_table__(const std::string &who)
virtual octave_base_value * try_narrowing_conversion(void)
static void register_type(void)
ComplexRowVector complex_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
nd deftypefn *std::string name
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
static void register_type(void)
octave_value do_unary_op(octave::type_info &ti, octave_value::unary_op op, const octave_value &v)
virtual octave_user_function * user_function_value(bool silent=false)
F77_RET_T const F77_INT F77_CMPLX * A
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
static void register_type(void)
type_info & __get_type_info__(const std::string &who)
virtual octave_value_list list_value(void) const
cat_op_fcn lookup_cat_op(int, int)
static const octave_value instance
static void register_type(void)
static void register_type(void)
void error_with_cfn(const char *fmt,...)
octave_base_value::type_conv_info numeric_demotion_function(void) const
octave_idx_type columns(void) const
bool is_uint64_type(void) const
OCTINTERP_API octave_value do_binary_op(octave::type_info &ti, octave_value::binary_op op, const octave_value &a, const octave_value &b)
static void register_type(void)
virtual float_display_format get_edit_display_format(void) const
void maybe_economize(void)
static std::string binary_op_fcn_name(binary_op)
static void register_type(void)
dim_vector dims(void) const
static void register_type(void)
bool isinteger(void) const
static void register_type(void)
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
ComplexColumnVector complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type rows(void) const
octave_classdef * classdef_object_value(bool silent=false) const
#define panic_impossible()
uint64NDArray uint64_array_value(void) const
RowVector row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
static void register_type(void)
static int static_type_id(void)
Array< octave_idx_type > octave_idx_type_vector_value(bool req_int=false, bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_function * function_value(bool silent=false) const
const Cell & contents(const_iterator p) const
octave_user_function * user_function_value(bool silent=false) const
bool is_zero_by_zero(void) const
assign_op unary_op_to_assign_op(unary_op op)
std::string class_name(void) const
static void register_type(void)
octave_value find_method(const std::string &name, const std::string &dispatch_type)
bool is_int8_type(void) const
virtual octave_user_code * user_code_value(bool silent=false)
octave_idx_type get_count(void) const
FloatColumnVector float_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type numel(void) const
static void register_type(void)
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
void make_storable_value(void)
static void register_type(void)
bool is_int32_type(void) const
FloatComplexRowVector float_complex_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
virtual type_conv_info numeric_conversion_function(void) const
T & xelem(octave_idx_type n)
static octave_base_value * nil_rep(void)
octave_idx_type nfields(void) const
octave_base_value::type_conv_info numeric_conversion_function(void) const
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
octave_scalar_map scalar_map_value(void) const
static OCTAVE_NORETURN void err_unary_op(const std::string &on, const std::string &tn)
Array< float > float_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_value_list list_value(void) const
octave_value undef_subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
octave_user_code * user_code_value(bool silent=false) const
octave_fcn_handle * fcn_handle_value(bool silent=false) const
const octave_char_matrix & v2
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)
bool is_undefined(void) const
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).isinteger())
virtual std::string class_name(void) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
virtual octave_classdef * classdef_object_value(bool silent=false)
unary_class_op_fcn lookup_unary_class_op(octave_value::unary_op)
uint16NDArray uint16_array_value(void) const
int register_type(const std::string &t_name, const std::string &c_name, const octave_value &val)
bool is_int64_type(void) const
static bool Vdisable_diagonal_matrix
ColumnVector column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
void warn_implicit_conversion(const char *id, const char *from, const char *to)
float_display_format get_edit_display_format(void) const
idx subsasgn(val, idx, 0) esult
octave_idx_type length(void) const
int64NDArray int64_array_value(void) const
friend OCTINTERP_API octave_value do_unary_op(octave::type_info &ti, unary_op op, const octave_value &a)
int8NDArray int8_array_value(void) const
virtual std::string type_name(void) const
static void register_type(void)
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
octave_map xmap_value(const char *fmt,...) const
octave::refcount< octave_idx_type > count
octave_value(* unary_class_op_fcn)(const octave_value &)
static void decode_subscripts(const char *name, const octave_value &arg, std::string &type_string, std::list< octave_value_list > &idx)
bool is_string(void) const
std::complex< float > FloatComplex
bool is_double_type(void) const
void maybe_economize(void)
octave_idx_type ndims(void) const
Number of dimensions.
std::complex< double > Complex
virtual void print_info(std::ostream &os, const std::string &prefix) const
OCTAVE_EXPORT octave_value_list or cell arrays Arguments are concatenated vertically The returned values are padded with blanks as needed to make each row of the string array have the same length Empty input strings are significant and will concatenated in the output For numerical each element is converted to the corresponding ASCII character A range error results if an input is outside the ASCII range(0-255). For cell arrays
virtual octave_function * function_value(bool silent=false)
non_const_unary_op_fcn lookup_non_const_unary_op(octave_value::unary_op, int)
static std::string unary_op_as_string(unary_op)
octave_idx_type numel(void) const
Number of elements in the array.
octave_idx_type length(void) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
Vector representing the dimensions (size) of an Array.
static void register_type(void)
bool is_uint8_type(void) const
static void register_type(void)
std::string type_name(void) const
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
virtual octave_user_script * user_script_value(bool silent=false)
static int static_type_id(void)
OCTINTERP_API octave_value do_colon_op(const octave_value &base, const octave_value &limit, bool is_for_cmd_expr=false)
octave_base_value *(* type_conv_fcn)(const octave_base_value &)
static void register_type(void)
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
Cell cell_value(void) const
NDArray array_value(bool frc_str_conv=false) const
Matrix matrix_value(bool frc_str_conv=false) const
uint8NDArray uint8_array_value(void) const
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
virtual octave_base_value * empty_clone(void) const
static void register_type(void)
static void register_type(void)
Array< Complex > complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
virtual octave_scalar_map scalar_map_value(void) const
bool is_uint16_type(void) const
static void register_type(void)