23 #if defined (HAVE_CONFIG_H) 106 const std::list<octave_value_list>& idx)
120 error (
"%s cannot be indexed with %c",
nm.c_str (),
type[0]);
134 if (idx.
length () == 1 && ! resize_ok)
153 e.set_pos_if_unset (1, 1);
163 return tmp.do_index_op (idx, resize_ok);
179 "non-integer range used as index");
195 "range",
"real scalar");
209 "range",
"real scalar");
262 return mat.
diag (m, n);
278 double base = r.
base ();
279 double limit = r.
limit ();
282 if (((base > 0 && limit > 0) || (base < 0 && limit < 0)) &&
numel () > 0)
312 "range",
"complex scalar");
330 "range",
"complex scalar");
365 return tmp.convert_to_str (pad, force,
type);
451 if (n == 0 || n == 1)
495 if (
c ==
' ' ||
c ==
'\t' ||
c ==
'\n')
514 std::ostringstream buf;
523 double base = r.
base ();
524 double limit = r.
limit ();
525 double inc = r.
inc ();
529 os <<
"# base, limit, increment\n";
531 os <<
"# base, length, increment\n";
552 double base, limit, inc;
553 is >> base >> limit >> inc;
556 error (
"load: failed to load range constant");
561 range =
Range (base, inc, static_cast<octave_idx_type> (limit));
570 os.
write (reinterpret_cast<char *> (&
tmp), 1);
572 double bas = r.
base ();
573 double lim = r.
limit ();
574 double inc = r.
inc ();
578 os.
write (reinterpret_cast<char *> (&bas), 8);
579 os.
write (reinterpret_cast<char *> (&lim), 8);
580 os.
write (reinterpret_cast<char *> (&inc), 8);
590 if (!
is.read (reinterpret_cast<char *> (&
tmp), 1))
592 double bas, lim, inc;
593 if (!
is.read (reinterpret_cast<char *> (&bas), 8))
597 if (!
is.read (reinterpret_cast<char *> (&lim), 8))
601 if (!
is.read (reinterpret_cast<char *> (&inc), 8))
608 range =
Range (bas, inc, static_cast<octave_idx_type> (lim));
613 #if defined (HAVE_HDF5) 624 hid_t type_id = H5Tcreate (H5T_COMPOUND,
sizeof (
double) * 3);
626 H5Tinsert (type_id,
"base", 0 *
sizeof (
double), num_type);
627 H5Tinsert (type_id,
"limit", 1 *
sizeof (
double), num_type);
628 H5Tinsert (type_id,
"increment", 2 *
sizeof (
double), num_type);
641 #if defined (HAVE_HDF5) 644 hid_t space_hid, type_hid, data_hid;
645 space_hid = type_hid = data_hid = -1;
647 space_hid = H5Screate_simple (0, dimens,
nullptr);
648 if (space_hid < 0)
return false;
653 H5Sclose (space_hid);
656 #if defined (HAVE_HDF5_18) 657 data_hid = H5Dcreate (loc_id,
name, type_hid, space_hid,
664 H5Sclose (space_hid);
670 double range_vals[3];
671 range_vals[0] = r.
base ();
673 range_vals[2] = r.
inc ();
681 "OCTAVE_RANGE_NELEM", &nel) >= 0;
688 H5Sclose (space_hid);
691 octave_unused_parameter (loc_id);
692 octave_unused_parameter (
name);
705 #if defined (HAVE_HDF5) 707 #if defined (HAVE_HDF5_18) 710 hid_t data_hid = H5Dopen (loc_id,
name);
712 hid_t type_hid = H5Dget_type (data_hid);
718 H5Tclose (range_type);
723 hid_t space_hid = H5Dget_space (data_hid);
724 hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
728 H5Tclose (range_type);
729 H5Sclose (space_hid);
742 "OCTAVE_RANGE_NELEM", &nel))
743 range =
Range (rangevals[0], rangevals[2], nel);
746 if (rangevals[2] != 0)
747 range =
Range (rangevals[0], rangevals[1], rangevals[2]);
750 static_cast<octave_idx_type> (rangevals[1]));
754 H5Tclose (range_type);
755 H5Sclose (space_hid);
759 octave_unused_parameter (loc_id);
760 octave_unused_parameter (
name);
773 double *pr =
static_cast<double *
> (
retval->get_data ());
779 const double *
p = m.
data ();
octave_idx_type write(const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)
void octave_write_double(std::ostream &os, double d)
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
void warning_with_id(const char *id, const char *fmt,...)
static hid_t hdf5_make_range_type(hid_t num_type)
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
octave_hdf5_err hdf5_add_scalar_attr(octave_hdf5_id loc_id, octave_hdf5_id type_id, const char *attr_name, void *buf)
Matrix diag(octave_idx_type k=0) const
charNDArray char_array_value(bool=false) const
intNDArray< octave_int64 > int64NDArray
characters Given a string matrix
Matrix matrix_value(bool=false) const
const T * data(void) const
FloatComplex float_complex_value(bool=false) const
void short_disp(std::ostream &os) const
static void skip_comments(std::istream &is)
void warn_logical_conversion(void)
int current_print_indent_level(void) const
bool all_elements_are_ints(void) const
const octave_hdf5_id octave_H5S_ALL
intNDArray< octave_uint32 > uint32NDArray
void newline(std::ostream &os) const
intNDArray< octave_uint8 > uint8NDArray
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
intNDArray< octave_uint16 > uint16NDArray
void skip_until_newline(std::istream &is, bool keep_newline)
octave_value as_double(void) const
idx_vector index_vector(bool require_integers=false) const
void swap_bytes< 8 >(void *ptr)
void error(const char *fmt,...)
octave_base_value * try_narrowing_conversion(void)
bool load_ascii(std::istream &is)
bool save_binary(std::ostream &os, bool &save_as_floats)
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
octave_value as_uint8(void) const
intNDArray< octave_int16 > int16NDArray
double double_value(bool=false) const
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
std::string type_name(void) const
void err_nan_to_logical_conversion(void)
Range range_value(void) const
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
octave_value as_uint64(void) const
octave_value all(int dim=0) const
bool hdf5_get_scalar_attr(octave_hdf5_id loc_id, octave_hdf5_id type_id, const char *attr_name, void *buf)
float float_value(bool=false) const
void warn_load(const char *type) const
bool save_ascii(std::ostream &os)
octave_value resize(const dim_vector &dv, bool fill=false) const
boolMatrix all(int dim=-1) const
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
octave_value fast_elem_extract(octave_idx_type n) const
octave_value any(int dim=0) const
Array< double > index(const idx_vector &i) const
Complex complex_value(bool=false) const
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
mxArray * as_mxArray(void) const
nd deftypefn *std::string name
Matrix diag(octave_idx_type k=0) const
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
intNDArray< octave_int8 > int8NDArray
boolNDArray bool_array_value(bool warn=false) const
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
octave_value as_uint32(void) const
static int static_type_id(void)
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Matrix matrix_value(void) const
octave_idx_type numel(void) const
idx_vector set_idx_cache(const idx_vector &idx) const
#define panic_impossible()
virtual octave_idx_type numel(void) const
void warn_save(const char *type) const
double elem(octave_idx_type i) const
boolMatrix any(int dim=-1) const
float lo_ieee_float_nan_value(void)
void indent(std::ostream &os) const
friend class octave_value
octave_value as_uint16(void) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_value diag(octave_idx_type k=0) const
intNDArray< octave_int32 > int32NDArray
void err_invalid_conversion(const std::string &from, const std::string &to)
octave_value as_int32(void) const
dim_vector dims(void) const
float_display_format make_format(const double &d)
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
octave_value as_int64(void) const
octave_value as_int16(void) const
bool any_element_not_one_or_zero(void) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
octave_value resize(const dim_vector &dv, bool fill=false) const
NDArray array_value(bool=false) const
void warn_implicit_conversion(const char *id, const char *from, const char *to)
float_display_format get_edit_display_format(void) const
void print(std::ostream &os, bool pr_as_read_syntax=false)
octave_value as_single(void) const
octave_idx_type length(void) const
void warn_array_as_logical(const dim_vector &dv)
const octave_hdf5_id octave_H5P_DEFAULT
std::complex< float > FloatComplex
std::complex< double > Complex
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
type_conv_info numeric_conversion_function(void) const
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
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
octave_value as_int8(void) const
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
bool any_element_is_nan(void) const
bool print_name_tag(std::ostream &os, const std::string &name) const
intNDArray< octave_uint64 > uint64NDArray