26 #if defined (HAVE_CONFIG_H)
111 const std::list<octave_value_list>& idx)
125 error (
"%s cannot be indexed with %c", nm.c_str (),
type[0]);
139 if (idx.
length () == 1 && ! resize_ok)
184 "non-integer range used as index");
200 "range",
"real scalar");
214 "range",
"real scalar");
283 double base =
r.base ();
284 double limit =
r.limit ();
287 if (((base > 0 && limit > 0) || (base < 0 && limit < 0)) &&
numel () > 0)
301 retval = !
m.isempty () &&
m(0, 0) != 0.0;
317 "range",
"complex scalar");
335 "range",
"complex scalar");
347 if (
m.any_element_is_nan ())
349 if (warn &&
m.any_element_not_one_or_zero ())
456 if (
n == 0 ||
n == 1)
500 if (c ==
' ' || c ==
'\t' || c ==
'\n')
519 std::ostringstream buf;
528 double base =
r.base ();
529 double limit =
r.limit ();
530 double inc =
r.inc ();
534 os <<
"# base, limit, increment\n";
536 os <<
"# base, length, increment\n";
557 double base, limit, inc;
558 is >> base >> limit >> inc;
561 error (
"load: failed to load range constant");
575 os.write (
reinterpret_cast<char *
> (&tmp), 1);
577 double bas =
r.base ();
578 double lim =
r.limit ();
579 double inc =
r.inc ();
583 os.write (
reinterpret_cast<char *
> (&bas), 8);
584 os.write (
reinterpret_cast<char *
> (&lim), 8);
585 os.write (
reinterpret_cast<char *
> (&inc), 8);
595 if (! is.read (
reinterpret_cast<char *
> (&tmp), 1))
597 double bas, lim, inc;
598 if (! is.read (
reinterpret_cast<char *
> (&bas), 8))
602 if (! is.read (
reinterpret_cast<char *
> (&lim), 8))
606 if (! is.read (
reinterpret_cast<char *
> (&inc), 8))
618 #if defined (HAVE_HDF5)
629 hid_t type_id = H5Tcreate (H5T_COMPOUND,
sizeof (
double) * 3);
631 H5Tinsert (type_id,
"base", 0 *
sizeof (
double), num_type);
632 H5Tinsert (type_id,
"limit", 1 *
sizeof (
double), num_type);
633 H5Tinsert (type_id,
"increment", 2 *
sizeof (
double), num_type);
646 #if defined (HAVE_HDF5)
649 hid_t space_hid, type_hid, data_hid;
650 space_hid = type_hid = data_hid = -1;
652 space_hid = H5Screate_simple (0, dimens,
nullptr);
653 if (space_hid < 0)
return false;
658 H5Sclose (space_hid);
661 #if defined (HAVE_HDF5_18)
662 data_hid = H5Dcreate (loc_id,
name, type_hid, space_hid,
669 H5Sclose (space_hid);
675 double range_vals[3];
676 range_vals[0] =
r.base ();
677 range_vals[1] = (
r.inc () != 0 ?
r.limit () :
r.numel ());
678 range_vals[2] =
r.inc ();
686 "OCTAVE_RANGE_NELEM", &nel) >= 0;
693 H5Sclose (space_hid);
696 octave_unused_parameter (loc_id);
697 octave_unused_parameter (
name);
710 #if defined (HAVE_HDF5)
712 #if defined (HAVE_HDF5_18)
715 hid_t data_hid = H5Dopen (loc_id,
name);
717 hid_t type_hid = H5Dget_type (data_hid);
723 H5Tclose (range_type);
728 hid_t space_hid = H5Dget_space (data_hid);
729 hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
733 H5Tclose (range_type);
734 H5Sclose (space_hid);
747 "OCTAVE_RANGE_NELEM", &nel))
748 range =
Range (rangevals[0], rangevals[2], nel);
751 if (rangevals[2] != 0)
752 range =
Range (rangevals[0], rangevals[1], rangevals[2]);
759 H5Tclose (range_type);
760 H5Sclose (space_hid);
764 octave_unused_parameter (loc_id);
765 octave_unused_parameter (
name);
778 double *pr =
static_cast<double *
> (
retval->get_data ());
784 const double *p =
m.data ();
786 for (
mwSize i = 0; i < nel; i++)
void swap_bytes< 8 >(void *ptr)
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
T & elem(octave_idx_type n)
Size of the specified dimension.
Matrix diag(octave_idx_type k=0) const
boolMatrix all(int dim=-1) const
double elem(octave_idx_type i) const
Matrix diag(octave_idx_type k=0) const
Matrix matrix_value(void) const
bool all_elements_are_ints(void) const
octave_idx_type numel(void) const
Array< double > index(const idx_vector &i) const
Vector representing the dimensions (size) of an Array.
bool is_scalar(void) const
void set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
int current_print_indent_level(void) const
void indent(std::ostream &os) const
void newline(std::ostream &os) const
void warn_load(const char *type) const
virtual octave_idx_type numel(void) const
friend class octave_value
void warn_save(const char *type) const
static int static_type_id(void)
octave_value as_uint32(void) const
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
octave_value fast_elem_extract(octave_idx_type n) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
octave_value as_uint16(void) const
void print(std::ostream &os, bool pr_as_read_syntax=false)
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
octave_value as_int8(void) const
bool save_ascii(std::ostream &os)
dim_vector dims(void) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
void short_disp(std::ostream &os) const
bool load_ascii(std::istream &is)
type_conv_info numeric_conversion_function(void) const
float_display_format get_edit_display_format(void) const
octave_value as_int16(void) const
octave_value any(int dim=0) const
octave_value as_uint8(void) const
octave_value as_single(void) const
FloatComplex float_complex_value(bool=false) const
bool print_name_tag(std::ostream &os, const std::string &name) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
bool save_binary(std::ostream &os, bool save_as_floats)
octave_value resize(const dim_vector &dv, bool fill=false) const
double double_value(bool=false) const
charNDArray char_array_value(bool=false) const
idx_vector set_idx_cache(const idx_vector &idx) const
NDArray array_value(bool=false) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
idx_vector index_vector(bool require_integers=false) const
octave_base_value * try_narrowing_conversion(void)
octave_value diag(octave_idx_type k=0) const
octave_value as_int32(void) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Complex complex_value(bool=false) const
octave_value as_double(void) const
Matrix matrix_value(bool=false) const
mxArray * as_mxArray(void) const
octave_value all(int dim=0) const
Range range_value(void) const
boolNDArray bool_array_value(bool warn=false) const
std::string type_name(void) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
octave_value as_uint64(void) const
float float_value(bool=false) const
octave_value as_int64(void) const
octave_idx_type length(void) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5S_ALL
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
#define panic_impossible()
void warn_array_as_logical(const dim_vector &dv)
void err_invalid_conversion(const std::string &from, const std::string &to)
void warn_logical_conversion(void)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
intNDArray< octave_int16 > int16NDArray
intNDArray< octave_int32 > int32NDArray
intNDArray< octave_int64 > int64NDArray
intNDArray< octave_int8 > int8NDArray
float lo_ieee_float_nan_value(void)
void octave_write_double(std::ostream &os, double d)
void skip_until_newline(std::istream &is, bool keep_newline)
bool hdf5_get_scalar_attr(octave_hdf5_id loc_id, octave_hdf5_id type_id, const char *attr_name, void *buf)
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
octave_hdf5_err hdf5_add_scalar_attr(octave_hdf5_id loc_id, octave_hdf5_id type_id, const char *attr_name, void *buf)
void err_nan_to_logical_conversion(void)
std::complex< double > Complex
std::complex< float > FloatComplex
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
static void skip_comments(std::istream &is)
static hid_t hdf5_make_range_type(hid_t num_type)
octave_value::octave_value(const Array< char > &chm, char type) return retval
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
float_display_format make_format(const double &d)
intNDArray< octave_uint16 > uint16NDArray
intNDArray< octave_uint32 > uint32NDArray
intNDArray< octave_uint64 > uint64NDArray
intNDArray< octave_uint8 > uint8NDArray