26#if defined (HAVE_CONFIG_H)
106static bool Voptimize_diagonal_matrix =
true;
110static bool Voptimize_permutation_matrix =
true;
114static bool Voptimize_range =
true;
507#if defined (OCTAVE_HAVE_LONG_LONG_INT)
513#if defined (OCTAVE_HAVE_UNSIGNED_LONG_LONG_INT)
580 : m_rep (Voptimize_diagonal_matrix
588 : m_rep (Voptimize_diagonal_matrix
596 : m_rep (Voptimize_diagonal_matrix
604 : m_rep (Voptimize_diagonal_matrix
612 : m_rep (Voptimize_diagonal_matrix
620 : m_rep (Voptimize_diagonal_matrix
700 : m_rep (Voptimize_diagonal_matrix
708 : m_rep (Voptimize_diagonal_matrix
740 : m_rep (Voptimize_permutation_matrix
862 : m_rep (new octave_int8_scalar (i))
868 : m_rep (new octave_uint8_scalar (i))
874 : m_rep (new octave_int16_scalar (i))
880 : m_rep (new octave_uint16_scalar (i))
886 : m_rep (new octave_int32_scalar (i))
892 : m_rep (new octave_uint32_scalar (i))
898 : m_rep (new octave_int64_scalar (i))
910 : m_rep (new octave_int8_matrix (inda))
916 : m_rep (new octave_int8_matrix (inda))
922 : m_rep (new octave_uint8_matrix (inda))
928 : m_rep (new octave_uint8_matrix (inda))
934 : m_rep (new octave_int16_matrix (inda))
940 : m_rep (new octave_int16_matrix (inda))
946 : m_rep (new octave_uint16_matrix (inda))
952 : m_rep (new octave_uint16_matrix (inda))
958 : m_rep (new octave_int32_matrix (inda))
964 : m_rep (new octave_int32_matrix (inda))
970 : m_rep (new octave_uint32_matrix (inda))
976 : m_rep (new octave_uint32_matrix (inda))
982 : m_rep (new octave_int64_matrix (inda))
988 : m_rep (new octave_int64_matrix (inda))
1016 octave::range<double>
range;
1019 octave::idx_vector::idx_class_type idx_class;
1024 switch (idx.idx_class ())
1026 case octave::idx_vector::class_range:
1027 case octave::idx_vector::class_vector:
1037 idx.unconvert (idx_class, scalar,
range, array, mask);
1041 case octave::idx_vector::class_colon:
1045 case octave::idx_vector::class_range:
1049 case octave::idx_vector::class_scalar:
1053 case octave::idx_vector::class_vector:
1057 case octave::idx_vector::class_mask:
1061 case octave::idx_vector::class_invalid:
1062 error (
"unexpected: invalid index in conversion to octave_value - please report this bug");
1082 : m_rep (force_range || Voptimize_range
1106 const std::list<std::string>& plist)
1113 const std::list<std::string>& plist)
1163 if (tmp && tmp !=
m_rep)
1174DEFUN (
double, args, ,
1181 if (args.length () != 1)
1184 return ovl (args(0).as_double ());
1218DEFUN (single, args, ,
1225 if (args.length () != 1)
1228 return args(0).as_single ();
1266 if (args.length () != 1)
1269 return args(0).as_int8 ();
1281DEFUN (int16, args, ,
1288 if (args.length () != 1)
1291 return args(0).as_int16 ();
1303DEFUN (int32, args, ,
1310 if (args.length () != 1)
1313 return args(0).as_int32 ();
1325DEFUN (int64, args, ,
1332 if (args.length () != 1)
1335 return args(0).as_int64 ();
1347DEFUN (uint8, args, ,
1354 if (args.length () != 1)
1357 return args(0).as_uint8 ();
1369DEFUN (uint16, args, ,
1376 if (args.length () != 1)
1379 return args(0).as_uint16 ();
1391DEFUN (uint32, args, ,
1398 if (args.length () != 1)
1401 return args(0).as_uint32 ();
1413DEFUN (uint64, args, ,
1420 if (args.length () != 1)
1423 return args(0).as_uint64 ();
1435OCTAVE_END_NAMESPACE(octave)
1441 std::list<octave_value_list> i;
1457 const std::list<octave_value_list>& idx,
int nargout)
1464 const std::list<octave_value_list>& idx,
1467 if (idx.size () > skip)
1469 std::list<octave_value_list> new_idx (idx);
1470 for (std::size_t i = 0; i < skip; i++)
1471 new_idx.erase (new_idx.begin ());
1472 return subsref (type.substr (skip), new_idx);
1480 const std::list<octave_value_list>& idx,
1483 if (idx.size () > skip)
1485 std::list<octave_value_list> new_idx (idx);
1486 for (std::size_t i = 0; i < skip; i++)
1487 new_idx.erase (new_idx.begin ());
1488 return subsref (type.substr (skip), new_idx, nargout);
1496 const std::list<octave_value_list>& idx,
1499 if (idx.size () > skip)
1501 std::list<octave_value_list> new_idx (idx);
1502 for (std::size_t i = 0; i < skip; i++)
1503 new_idx.erase (new_idx.begin ());
1504 return subsref (type.substr (skip), new_idx, auto_add);
1517 if (num_indices <
ndims)
1519 for (
int i = num_indices; i <
ndims; i++)
1520 dv(num_indices-1) *= dv(i);
1522 if (num_indices == 1)
1530 ndims = num_indices;
1535 return (index_position <
ndims ? dv(index_position) : 1);
1540 const std::list<octave_value_list>& idx,
1548 const std::list<octave_value_list>& idx,
1556 const std::list<octave_value_list>& idx,
1566 error (
"in computed assignment A(index) OP= X, A must be defined first");
1570 binary_op binop = op_eq_to_binary_op (op);
1572 t_rhs = octave::binary_op (binop, t, rhs);
1575 *
this =
subsasgn (type, idx, t_rhs);
1588 octave::type_info::assign_op_fcn
f =
nullptr;
1596 octave::type_info& ti = octave::__get_type_info__ ();
1598 f = ti.lookup_assign_op (op, tthis, trhs);
1610 binary_op binop = op_eq_to_binary_op (op);
1612 octave_value t = octave::binary_op (binop, *
this, rhs);
1618 error (
"in computed assignment A OP= X, A must be defined first");
1650 for (
int i = 0; i < dv.
ndims (); i++)
1668 bool retval =
false;
1700#if defined (OCTAVE_ENABLE_64)
1703 return int_value (req_int, frc_str_conv);
1710#if defined (OCTAVE_ENABLE_64)
1778make_vector_dims (
const dim_vector& dv,
bool force_vector_conversion,
1779 const std::string& my_type,
const std::string& wanted_type)
1782 retval.chop_trailing_singletons ();
1785 if (retval.ndims () > 2 || (retval(0) != 1 && retval(1) != 1))
1787 if (! force_vector_conversion)
1789 my_type.c_str (), wanted_type.c_str ());
1798 bool frc_vec_conv)
const
1806 bool frc_vec_conv)
const
1814 bool frc_vec_conv)
const
1822 bool frc_vec_conv)
const
1830 bool force_vector_conversion)
const
1834 return retval.
reshape (make_vector_dims (retval.
dims (),
1835 force_vector_conversion,
1839template <
typename T>
1854 bool force_vector_conversion)
const
1888 double ai = a.
elem (i);
1889 int v =
static_cast<int> (ai);
1891 retval.
xelem (i) = v;
1903 return retval.
reshape (make_vector_dims (retval.
dims (),
1904 force_vector_conversion,
1908template <
typename T>
1923 bool force_string_conv,
1924 bool force_vector_conversion)
const
1958 double ai = a.
elem (i);
1961 retval.
xelem (i) = v;
1964 error_with_cfn (
"conversion of %g to octave_idx_type value failed", ai);
1973 return retval.
reshape (make_vector_dims (retval.
dims (),
1974 force_vector_conversion,
1980 bool force_vector_conversion)
const
1984 return retval.
reshape (make_vector_dims (retval.
dims (),
1985 force_vector_conversion,
1991 bool frc_vec_conv)
const
1999 bool frc_vec_conv)
const
2008 bool frc_vec_conv)
const
2016 bool frc_vec_conv)
const
2024 bool force_vector_conversion)
const
2028 return retval.
reshape (make_vector_dims (retval.
dims (),
2029 force_vector_conversion,
2035 bool force_vector_conversion)
const
2039 return retval.
reshape (make_vector_dims (retval.
dims (),
2040 force_vector_conversion,
2048#define XVALUE_EXTRACTOR(TYPE, NAME, FCN) \
2050 octave_value::NAME (const char *fmt, ...) const \
2058 catch (octave::execution_exception& ee) \
2063 va_start (args, fmt); \
2064 verror (ee, fmt, args); \
2205#undef XVALUE_EXTRACTOR
2217 error (
"range with infinite number of elements cannot be stored");
2242 error (
"range with infinite number of elements cannot be stored");
2256 octave::mach_info::float_format flt_fmt)
const
2258 return m_rep->
write (os, block_size, output_type, skip, flt_fmt);
2264 os << prefix <<
"type_name: " <<
type_name () <<
"\n"
2265 << prefix <<
"m_count: " <<
get_count () <<
"\n"
2266 << prefix <<
"m_rep info: ";
2284 octave::mach_info::float_format fmt)
2314 if (class_id != mxUNKNOWN_CLASS)
2316 bool type_ok =
false;
2320 case mxDOUBLE_CLASS:
2324 case mxSINGLE_CLASS:
2348 case mxUINT16_CLASS:
2352 case mxUINT32_CLASS:
2356 case mxUINT64_CLASS:
2362 error (
"mex_get_data: unexpected type requested");
2366 error (
"mex_get_data: type mismatch");
2368 if (complexity == mxCOMPLEX && !
iscomplex ())
2369 error (
"mex_get_data: objectis not complex as requested");
2375OCTAVE_NORETURN
static void
2376err_unary_op_conversion_failed (
const std::string& op,
2377 const std::string& tn)
2379 error (
"operator %s: type conversion for '%s' failed",
2380 op.c_str (), tn.c_str ());
2383OCTAVE_NORETURN
static void
2384err_unary_op (
const std::string& on,
const std::string& tn)
2386 error (
"unary operator '%s' not implemented for '%s' operands",
2387 on.c_str (), tn.c_str ());
2401 error (
"in x%s or %sx, x must be defined first",
2402 op_str.c_str (), op_str.c_str ());
2409 octave::type_info& ti = octave::__get_type_info__ ();
2411 octave::type_info::non_const_unary_op_fcn
f
2412 = ti.lookup_non_const_unary_op (op, t);
2430 err_unary_op_conversion_failed
2438 f = ti.lookup_non_const_unary_op (op, t);
2444 if (old_rep && --old_rep->
m_count == 0)
2467 octave::type_info::non_const_unary_op_fcn
f =
nullptr;
2472 octave::type_info& ti = octave::__get_type_info__ ();
2474 f = ti.lookup_non_const_unary_op (op, t);
2480 *
this = octave::unary_op (op, *
this);
2488 const std::list<octave_value_list>& idx)
2498 assign_op assop = unary_op_to_assign_op (op);
2500 assign (assop, type, idx, 1.0);
2507octave_value::unary_op_to_assign_op (unary_op op)
2520 error (
"operator %s: no assign operator found", on.c_str ());
2526octave_value::op_eq_to_binary_op (assign_op op)
2569 error (
"operator %s: no binary operator found", on.c_str ());
2577 if (type.length () > 0)
2582 if (type.length () > 1 && type[1] ==
'.')
2594 error (
"unexpected: index not '(', '{', or '.' in octave_value::empty_conv - please report this bug");
2603OCTAVE_NORETURN
static void
2604err_binary_op (
const std::string& on,
const std::string& tn1,
2605 const std::string& tn2)
2607 error (
"binary operator '%s' not implemented for '%s' by '%s' operations",
2608 on.c_str (), tn1.c_str (), tn2.c_str ());
2611OCTAVE_NORETURN
static void
2612err_binary_op_conv (
const std::string& on)
2614 error (
"type conversion failed for binary operator '%s'", on.c_str ());
2637 retval =
f (v1,
v2);
2808 error (
"invalid compound operator");
2829 retval =
f (v1,
v2);
2831 retval = decompose_binary_op (ti, op, v1,
v2);
2840 retval = decompose_binary_op (ti, op, v1,
v2);
2855OCTAVE_NORETURN
static void
2856err_cat_op (
const std::string& tn1,
const std::string& tn2)
2858 error (
"concatenation operator not implemented for '%s' by '%s' operations",
2859 tn1.c_str (), tn2.c_str ());
2862OCTAVE_NORETURN
static void
2865 error (
"type conversion failed for concatenation operator");
2949 if (op1_type == op2_type)
2977template <
typename T>
2979check_colon_operand (
const octave_value& val,
const char *op_str)
2986 static constexpr double out_of_range_top
2987 =
static_cast<double> (std::numeric_limits<typename T::val_type>::max ()) + 1.0;
2989 if (dval >= out_of_range_top
2990 || dval < std::numeric_limits<typename T::val_type>::min ()
2991 || std::modf (dval, &intpart) != 0.0)
2992 error (
"colon operator %s invalid (not an integer or out of range for given integer type)", op_str);
2998template <
typename UT,
2999 typename std::enable_if<(std::is_integral<UT>::value
3000 && std::is_unsigned<UT>::value),
3003integer_difference (UT a, UT b)
3005 return a > b ? a - b : b - a;
3011template <
typename ST,
3012 typename UT =
typename std::make_unsigned<ST>::type,
3013 typename std::enable_if<(std::is_integral<ST>::value
3014 && std::is_signed<ST>::value),
3017integer_difference (ST a, ST b)
3022 static const UT offset = UT (0) -
static_cast<UT
> (std::numeric_limits<ST>::min ());
3024 UT au =
static_cast<UT
> (a) + offset;
3025 UT bu =
static_cast<UT
> (b) + offset;
3027 return integer_difference (au, bu);
3040template <
typename T,
3041 typename UT =
typename std::make_unsigned<T>::type,
3042 typename std::enable_if<std::is_integral<T>::value,
3045range_numel_aux (T base, UT unsigned_increment, T limit)
3050 UT nel_m1 = integer_difference (limit, base) / unsigned_increment;
3053 if (nel_m1 > std::numeric_limits<octave_idx_type>::max () - 1)
3054 error (
"too many elements for range!");
3061template <
typename ST,
3062 typename UT =
typename std::make_unsigned<ST>::type,
3063 typename std::enable_if<(std::is_integral<ST>::value
3064 && std::is_signed<ST>::value),
3067range_increment (ST increment)
3069 return (increment < 0
3070 ? UT (0) -
static_cast<UT
> (increment)
3071 : static_cast<UT> (increment));
3078template <
typename T,
3079 typename UT =
typename std::make_unsigned<T>::type,
3080 typename std::enable_if<(std::is_integral<UT>::value
3081 && std::is_unsigned<UT>::value),
3084range_increment (UT increment)
3091template <
typename T,
3092 typename UT =
typename std::make_unsigned<T>::type>
3093typename std::enable_if<(std::is_integral<UT>::value
3094 && std::is_unsigned<UT>::value), UT>::type
3095range_increment (
double increment)
3097 double abs_increment = std::abs (increment);
3099 return static_cast<UT
> (abs_increment);
3105template <
typename ST,
3106 typename std::enable_if<(std::is_integral<ST>::value
3107 && std::is_signed<ST>::value),
3110range_numel (ST base, ST increment, ST limit)
3112 typedef typename std::make_unsigned<ST>::type UT;
3115 || (increment > 0 && base > limit)
3116 || (increment < 0 && base < limit))
3119 UT unsigned_increment = range_increment<ST> (increment);
3121 return range_numel_aux (base, unsigned_increment, limit);
3127template <
typename UT,
3128 typename std::enable_if<(std::is_integral<UT>::value
3129 && std::is_unsigned<UT>::value),
3132range_numel (UT base, UT increment, UT limit)
3135 if (increment == 0 || base > limit)
3138 return range_numel_aux (base, increment, limit);
3144template <
typename T,
3145 typename UT =
typename std::make_unsigned<T>::type,
3146 typename std::enable_if<std::is_integral<T>::value,
3149range_numel (T base,
double increment, T limit)
3152 if (math::isnan (increment) || std::modf (increment, &intpart) != 0.0)
3153 error (
"colon operator increment invalid (not an integer)");
3156 || (increment > 0 && base > limit)
3157 || (increment < 0 && base < limit))
3160 static constexpr double out_of_range_top
3161 =
static_cast<double> (std::numeric_limits<UT>::max ()) + 1.0;
3163 double abs_increment = std::abs (increment);
3171 if (abs_increment >= out_of_range_top)
3174 UT unsigned_increment = range_increment<T> (increment);
3176 return range_numel_aux (base, unsigned_increment, limit);
3181template <
typename T,
3183 typename std::enable_if<(std::is_integral<T>::value
3184 && std::is_arithmetic<IT>::value),
3187make_int_range (T base,
IT increment, T limit)
3198 typedef typename std::make_unsigned<T>::type UT;
3200 UT unsigned_increment = range_increment<T> (increment);
3203 result.xelem (0) = val;
3209 val += unsigned_increment;
3210 result.xelem (i) = val;
3217 val -= unsigned_increment;
3218 result.xelem (i) = val;
3242template <
typename T,
3243 typename std::enable_if<std::is_same<T, double>::value,
3246make_float_range (T base, T increment, T limit,
bool is_for_cmd_expr)
3248 if (math::isnan (base)
3249 || math::isnan (increment)
3250 || math::isnan (limit))
3254 || (increment > 0 && base > limit)
3255 || (increment < 0 && base < limit))
3261 range<T> r (base, increment, limit);
3263 if (! is_for_cmd_expr && ! r.is_storable ())
3264 error (
"range with infinite number of elements cannot be stored");
3269template <
typename T,
3270 typename std::enable_if<std::is_same<T, float>::value,
3273make_float_range (T base, T increment, T limit,
bool is_for_cmd_expr)
3275 if (math::isnan (base)
3276 || math::isnan (increment)
3277 || math::isnan (limit))
3281 || (increment > 0 && base > limit)
3282 || (increment < 0 && base < limit))
3288 range<T> r (base, increment, limit);
3290 if (! is_for_cmd_expr && ! r.is_storable ())
3291 error (
"range with infinite number of elements cannot be stored");
3296template <
typename T,
3297 typename std::enable_if<(std::is_same<T, octave_int8>::value
3298 || std::is_same<T, octave_uint8>::value
3299 || std::is_same<T, octave_int16>::value
3300 || std::is_same<T, octave_uint16>::value
3301 || std::is_same<T, octave_int32>::value
3302 || std::is_same<T, octave_uint32>::value
3303 || std::is_same<T, octave_int64>::value
3304 || std::is_same<T, octave_uint64>::value),
3313 check_colon_operand<T> (base,
"lower bound");
3314 check_colon_operand<T> (limit,
"upper bound");
3316 typename T::val_type base_val = octave_value_extract<T> (base).value ();
3317 typename T::val_type limit_val = octave_value_extract<T> (limit).value ();
3323 return make_int_range (base_val, increment_val, limit_val);
3326 check_colon_operand<T> (increment,
"increment");
3328 typename T::val_type increment_val
3329 = octave_value_extract<T> (increment).value ();
3331 return make_int_range (base_val, increment_val, limit_val);
3334template <
typename T,
3335 typename std::enable_if<std::is_floating_point<T>::value,
3344 T base_val = octave_value_extract<T> (base);
3345 T increment_val = octave_value_extract<T> (increment);
3346 T limit_val = octave_value_extract<T> (limit);
3348 return make_float_range (base_val, increment_val, limit_val,
3362 char type = dq_str ?
'"' :
'\'';
3372 range<double> tmp (mtx_base(0), mtx_increment(0), mtx_limit(0));
3391 tmp1(1) = increment_arg;
3417 if (base.
numel () > 1 || limit.
numel () > 1 || increment.
numel () > 1)
3419 "colon arguments should be scalars");
3423 "imaginary part of complex colon arguments is ignored");
3427 builtin_type_t type_id = get_colon_op_type (base, increment, limit);
3439 return make_float_range<double> (base, increment, limit, is_for_cmd_expr);
3443 return make_float_range<float> (base, increment, limit, is_for_cmd_expr);
3446 return make_int_range<octave_int8> (base, increment, limit);
3449 return make_int_range<octave_int16> (base, increment, limit);
3452 return make_int_range<octave_int32> (base, increment, limit);
3455 return make_int_range<octave_int64> (base, increment, limit);
3458 return make_int_range<octave_uint8> (base, increment, limit);
3461 return make_int_range<octave_uint16> (base, increment, limit);
3464 return make_int_range<octave_uint32> (base, increment, limit);
3467 return make_int_range<octave_uint64> (base, increment, limit);
3470 return make_char_range (base, increment, limit);
3473 error (
"incompatible types found in range expression");
3476 error (
"invalid types found in range expression");
3482OCTAVE_NORETURN
static void
3483err_unary_op_conv (
const std::string& on)
3485 error (
"type conversion failed for unary operator '%s'", on.c_str ());
3546OCTAVE_END_NAMESPACE(octave)
3572 octave_int8_scalar::register_type (ti);
3573 octave_int16_scalar::register_type (ti);
3574 octave_int32_scalar::register_type (ti);
3575 octave_int64_scalar::register_type (ti);
3576 octave_uint8_scalar::register_type (ti);
3577 octave_uint16_scalar::register_type (ti);
3578 octave_uint32_scalar::register_type (ti);
3580 octave_int8_matrix::register_type (ti);
3581 octave_int16_matrix::register_type (ti);
3582 octave_int32_matrix::register_type (ti);
3583 octave_int64_matrix::register_type (ti);
3584 octave_uint8_matrix::register_type (ti);
3585 octave_uint16_matrix::register_type (ti);
3586 octave_uint32_matrix::register_type (ti);
3620DEFUN (
sizeof, args, ,
3627 if (args.length () != 1)
3630 return ovl (args(0).byte_size ());
3640decode_subscripts (
const char *name,
const octave_value& arg,
3641 std::string& type_string,
3642 std::list<octave_value_list>& idx)
3644 const octave_map m = arg.
xmap_value (
"%s: second argument must be a structure with fields 'type' and 'subs'", name);
3647 error (
"%s: second argument must be a structure with fields 'type' and 'subs'",
3652 type_string = std::string (nel,
'\0');
3653 idx = std::list<octave_value_list> ();
3661 for (
int k = 0; k < nel; k++)
3663 std::string item = type(k).xstring_value (
"%s: type(%d) must be a string", name, k+1);
3666 type_string[k] =
'{';
3667 else if (item ==
"()")
3668 type_string[k] =
'(';
3669 else if (item ==
".")
3670 type_string[k] =
'.';
3672 error (
"%s: invalid indexing type '%s'", name, item.c_str ());
3676 if (subs(k).is_string ())
3677 idx_item(0) = subs(k);
3678 else if (subs(k).iscell ())
3680 Cell subs_cell = subs(k).cell_value ();
3682 for (
int n = 0; n < subs_cell.
numel (); n++)
3684 if (subs_cell(n).is_string ()
3685 && subs_cell(n).string_value () ==
":")
3688 idx_item(n) = subs_cell(n);
3692 error (
"%s: subs(%d) must be a string or cell array", name, k+1);
3694 idx.push_back (idx_item);
3698DEFUN (subsref, args, nargout,
3737 if (args.length () != 2)
3741 std::list<octave_value_list> idx;
3743 decode_subscripts (
"subsref", args(1), type, idx);
3750 return arg0.
subsref (type, idx, nargout);
3753DEFUN (subsasgn, args, ,
3789 if (args.length () != 3)
3793 std::list<octave_value_list> idx;
3795 decode_subscripts (
"subsasgn", args(1), type, idx);
3800 return ovl (args(2).storable_value ());
3895DEFUN (is_sq_string, args, ,
3902 if (args.length () != 1)
3905 return ovl (args(0).is_sq_string ());
3918DEFUN (is_dq_string, args, ,
3925 if (args.length () != 1)
3928 return ovl (args(0).is_dq_string ());
3941DEFUN (optimize_permutation_matrix, args, nargout,
3959 "optimize_permutation_matrix");
3972DEFUN (optimize_diagonal_matrix, args, nargout,
3990 "optimize_diagonal_matrix");
4017DEFUN (optimize_range, args, nargout,
4051OCTAVE_END_NAMESPACE(octave)
N Dimensional Array with copy-on-write semantics.
const dim_vector & dims() const
Return a const-reference so that dims ()(i) works efficiently.
T & xelem(octave_idx_type n)
Size of the specified dimension.
T & elem(octave_idx_type n)
Size of the specified dimension.
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Array< T, Alloc > reshape(octave_idx_type nr, octave_idx_type nc) const
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
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.
void resize(int n, int fill_value=0)
static dim_vector alloc(int n)
octave_idx_type ndims() const
Number of dimensions.
octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
symbol_table & get_symbol_table()
virtual bool load_hdf5(octave_hdf5_id loc_id, const char *name)
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
virtual octave_base_value * clone() const
virtual octave_user_script * user_script_value(bool silent=false)
virtual octave_value_list simple_subsref(char type, octave_value_list &idx, int nargout)
virtual octave_fcn_handle * fcn_handle_value(bool silent=false)
virtual octave_classdef * classdef_object_value(bool silent=false)
virtual float_display_format get_edit_display_format() const
octave_base_value *(* type_conv_fcn)(const octave_base_value &)
virtual octave_base_value * try_narrowing_conversion()
static void register_type()
octave::refcount< octave_idx_type > m_count
virtual type_conv_info numeric_conversion_function() const
virtual int type_id() const
virtual octave_value_list list_value() const
virtual const void * mex_get_data() const
virtual bool load_ascii(std::istream &is)
virtual bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
virtual octave_user_function * user_function_value(bool silent=false)
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 bool is_storable() const
virtual octave_map map_value() 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_scalar_map scalar_map_value() 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 void break_closure_cycles(const std::shared_ptr< octave::stack_frame > &)
virtual std::string type_name() const
virtual std::string class_name() const
virtual octave_base_value * empty_clone() const
virtual octave_function * function_value(bool silent=false)
virtual Cell cell_value() const
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static int static_type_id()
static int static_type_id()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
octave_value make_weak_anonymous_handle() const
bool is_anonymous() const
octave_value make_weak_nested_handle() const
static void register_type()
bool is_weak_anonymous() const
bool is_weak_nested() const
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
octave_idx_type nfields() const
const Cell & contents(const_iterator p) const
octave_idx_type numel() const
bool contains(const std::string &name) const
static void register_type()
static void register_type()
static const octave_value instance
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
static void register_type()
bool is_function_handle() const
octave_value_list list_value() const
octave_value & operator=(const octave_value &a)
bool is_magic_int() const
const octave_base_value & get_rep() const
static std::string unary_op_fcn_name(unary_op)
bool is_undefined() const
bool is_uint32_type() const
ComplexRowVector complex_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
std::string class_name() const
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
octave_function * function_value(bool silent=false) const
int32NDArray int32_array_value() const
uint16NDArray uint16_array_value() const
static std::string binary_op_as_string(binary_op)
octave_map xmap_value(const char *fmt,...) const
octave_classdef * classdef_object_value(bool silent=false) const
int16NDArray int16_array_value() const
int int_value(bool req_int=false, bool frc_str_conv=false) const
bool is_dq_string() const
int8NDArray int8_array_value() const
std::string get_dims_str() const
octave_idx_type rows() const
int64_t int64_value(bool req_int=false, bool frc_str_conv=false) const
Array< float > float_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_scalar_map scalar_map_value() const
octave_idx_type strict_idx_type_value(bool frc_str_conv=false) const
bool is_int8_type() const
octave_value_list simple_subsref(char type, octave_value_list &idx, int nargout)
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_user_script * user_script_value(bool silent=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 idx_type_value(bool req_int=false, bool frc_str_conv=false) const
octave_idx_type end_index(octave_idx_type index_position, octave_idx_type num_indices) const
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
static assign_op binary_op_to_assign_op(binary_op)
FloatComplexRowVector float_complex_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, std::size_t skip=1)
Array< FloatComplex > float_complex_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
FloatRowVector float_row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_single_type() const
void make_storable_value()
FloatColumnVector float_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
bool is_legacy_object() const
void break_closure_cycles(const std::shared_ptr< octave::stack_frame > &)
bool is_equal(const octave_value &) const
octave_value storable_value() const
bool is_uint8_type() const
bool is_uint64_type() const
float_display_format get_edit_display_format() const
octave_base_value::type_conv_info numeric_demotion_function() const
bool is_zero_by_zero() const
bool is_uint16_type() const
uint64NDArray uint64_array_value() const
octave_value & non_const_unary_op(unary_op op)
static std::string unary_op_as_string(unary_op)
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
const void * mex_get_data(mxClassID class_id=mxUNKNOWN_CLASS, mxComplexity complexity=mxREAL) const
bool is_int16_type() const
octave_value reshape(const dim_vector &dv) const
FloatComplexColumnVector float_complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_base_value::type_conv_info numeric_conversion_function() const
octave_idx_type numel() const
bool load_ascii(std::istream &is)
octave_map map_value() const
Array< int > int_vector_value(bool req_int=false, 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
octave_value & assign(assign_op op, const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
bool is_int64_type() const
void print_info(std::ostream &os, const std::string &prefix="") const
octave_base_value * clone() const
octave_value single_subsref(const std::string &type, const octave_value_list &idx)
octave_fcn_handle * fcn_handle_value(bool silent=false) const
ComplexColumnVector complex_column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
int64NDArray int64_array_value() const
octave_idx_type get_count() const
NDArray array_value(bool frc_str_conv=false) const
Array< double > vector_value(bool frc_str_conv=false, bool frc_vec_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)
octave_idx_type length() const
bool is_double_type() const
bool is_int32_type() 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
octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
uint8NDArray uint8_array_value() const
octave_user_function * user_function_value(bool silent=false) const
std::string type_name() const
octave_value all(int dim=0) const
octave_base_value * m_rep
The real representation.
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
ColumnVector column_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
static octave_base_value * nil_rep()
FloatNDArray float_array_value(bool frc_str_conv=false) const
octave_user_code * user_code_value(bool silent=false) const
uint32NDArray uint32_array_value() const
RowVector row_vector_value(bool frc_str_conv=false, bool frc_vec_conv=false) const
octave_idx_type columns() const
Matrix matrix_value(bool frc_str_conv=false) const
builtin_type_t builtin_type() const
octave_base_value * empty_clone() const
double double_value(bool frc_str_conv=false) const
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
static void register_type()
octave_value find_function(const std::string &name, const symbol_scope &search_scope=symbol_scope::invalid())
octave_value(* unary_op_fcn)(const octave_base_value &)
octave_value(* binary_op_fcn)(const octave_base_value &, const octave_base_value &)
octave_value(* binary_class_op_fcn)(const octave_value &, const octave_value &)
binary_class_op_fcn lookup_binary_class_op(octave_value::binary_op)
octave_value(* cat_op_fcn)(const octave_base_value &, const octave_base_value &, const Array< octave_idx_type > &ra_idx)
octave_value(* unary_class_op_fcn)(const octave_value &)
unary_class_op_fcn lookup_unary_class_op(octave_value::unary_op)
cat_op_fcn lookup_cat_op(int, int)
binary_op_fcn lookup_binary_op(octave_value::binary_op, int, int)
unary_op_fcn lookup_unary_op(octave_value::unary_op, int)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#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,...)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
type_info & __get_type_info__()
interpreter & __get_interpreter__()
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
std::complex< double > Complex
std::complex< float > FloatComplex
const octave_base_value const Array< octave_idx_type > & ra_idx
const octave_char_matrix & v2
octave_double_range octave_range
#define XVALUE_EXTRACTOR(TYPE, NAME, FCN)
octave_value colon_op(const octave_value &base, const octave_value &increment, const octave_value &limit, bool is_for_cmd_expr=false)
void install_types(octave::type_info &)
octave_value cat_op(type_info &ti, const octave_value &a, const octave_value &b, const Array< octave_idx_type > &ra_idx)
octave_value binary_op(type_info &ti, octave_value::binary_op op, const octave_value &a, const octave_value &b)
octave_value unary_op(type_info &ti, octave_value::unary_op op, const octave_value &a)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
octave_value set_internal_variable(bool &var, const octave_value_list &args, int nargout, const char *nm)