24 #if defined (HAVE_CONFIG_H)
68 "bool matrix",
"logical");
97 if (nr == 1 && nc == 1)
111 "bool matrix",
"real scalar");
123 "bool matrix",
"real scalar");
135 "bool matrix",
"complex scalar");
151 "bool matrix",
"complex scalar");
228 bool pr_as_read_syntax)
const
241 os <<
"# ndims: " << dv.
ndims () <<
"\n";
243 for (
int i = 0;
i < dv.
ndims ();
i++)
252 os <<
"# rows: " <<
rows () <<
"\n"
253 <<
"# columns: " <<
columns () <<
"\n";
268 keywords[0] =
"ndims";
269 keywords[1] =
"rows";
275 error (
"load: failed to extract number of rows and columns");
279 int mdims =
static_cast<int> (
val);
282 error (
"load: failed to extract number of dimensions");
287 for (
int i = 0;
i < mdims;
i++)
291 error (
"load: failed to extract dimensions");
303 error (
"load: failed to load matrix constant");
306 btmp.
elem (
i) = (tmp.elem (
i) != 0.);
311 else if (kw ==
"rows")
317 error (
"load: failed to extract number of rows and columns");
319 if (nr > 0 && nc > 0)
324 error (
"load: failed to load matrix constant");
329 btmp.
elem (
i,j) = (tmp.elem (
i, j) != 0.);
333 else if (nr == 0 || nc == 0)
354 os.write (reinterpret_cast<char *> (&tmp), 4);
355 for (
int i = 0;
i < dv.
ndims ();
i++)
358 os.write (reinterpret_cast<char *> (&tmp), 4);
367 htmp[
i] = (mtmp[
i] ? 1 : 0);
369 os.write (htmp, nel);
379 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
394 for (
int i = 0;
i < mdims;
i++)
396 if (! is.read (reinterpret_cast<char *> (&di), 4))
417 if (! is.read (htmp, nel))
422 mtmp[
i] = (htmp[
i] ? 1 : 0);
434 #if defined (HAVE_HDF5)
441 int rank = dv.
ndims ();
442 hid_t space_hid, data_hid;
443 space_hid = data_hid = -1;
449 for (
int i = 0;
i < rank;
i++)
450 hdims[
i] =
dv(rank-
i-1);
452 space_hid = H5Screate_simple (rank, hdims, 0);
453 if (space_hid < 0)
return false;
454 #if defined (HAVE_HDF5_18)
455 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
458 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
463 H5Sclose (space_hid);
478 H5Sclose (space_hid);
481 octave_unused_parameter (loc_id);
482 octave_unused_parameter (name);
495 #if defined (HAVE_HDF5)
504 #if defined (HAVE_HDF5_18)
507 hid_t data_hid = H5Dopen (loc_id, name);
509 hid_t space_id = H5Dget_space (data_hid);
511 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
522 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
534 for (hsize_t
i = 0, j = rank - 1;
i < rank;
i++, j--)
556 octave_unused_parameter (loc_id);
557 octave_unused_parameter (name);
570 bool *pr =
static_cast<bool *
> (retval->
get_data ());
596 if (
args.length () != 1)
octave_value as_uint32(void) const
bool is_empty(void) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
intNDArray< octave_int64 > int64NDArray
else err_wrong_type_arg("logical", arg)
octave_idx_type columns(void) const
octave_value as_int8(void) const
OCTINTERP_API void print_usage(void)
octave_idx_type numel(void) const
Number of elements in the array.
identity matrix If supplied two scalar respectively For allows like xample val
const octave_hdf5_id octave_H5S_ALL
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector d)
intNDArray< octave_uint32 > uint32NDArray
bool is_scalar_type(void) const
intNDArray< octave_uint8 > uint8NDArray
bool is_numeric_type(void) const
intNDArray< octave_uint16 > uint16NDArray
octave_idx_type numel(void) const
void resize(int n, int fill_value=0)
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
void * get_data(void) const
octave_value as_int16(void) const
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
T & elem(octave_idx_type n)
intNDArray< octave_int16 > int16NDArray
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Complex complex_value(bool=false) const
boolNDArray bool_array_value(bool warn=false) const
octave_idx_type rows(void) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
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 as_int64(void) const
void warn_load(const char *type) const
double double_value(bool=false) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty
void swap_bytes< 4 >(void *ptr)
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
intNDArray< octave_int8 > int8NDArray
octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
bool is_sparse_type(void) const
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
bool is_bool_type(void) const
octave_value as_uint16(void) const
nd deftypefn *octave_map m
octave_value as_int32(void) const
static int static_type_id(void)
octave_value as_uint8(void) const
const T * data(void) const
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
bool save_binary(std::ostream &os, bool &save_as_floats)
void resize(const dim_vector &dv, const T &rfv)
#define panic_impossible()
octave_value as_single(void) const
issues an error eealso char nd deftypefn *octave_value retval
float lo_ieee_float_nan_value(void)
void warn_save(const char *type) const
friend class octave_value
octave_value as_double(void) const
bool save_ascii(std::ostream &os)
dim_vector dims(void) const
intNDArray< octave_int32 > int32NDArray
void err_invalid_conversion(const std::string &from, const std::string &to)
octave_value as_uint64(void) const
bool bool_value(bool warn=false) const
=val(i)}if ode{val(i)}occurs in table i
octave_base_value * try_narrowing_conversion(void)
int current_print_indent_level(void) const
type_conv_info numeric_conversion_function(void) const
NDArray array_value(bool=false) const
mxArray * as_mxArray(void) const
FloatComplex float_complex_value(bool=false) const
void octave_print_internal(std::ostream &, char, bool)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
octave_idx_type ndims(void) const
Number of dimensions.
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
float float_value(bool=false) const
const octave_hdf5_id octave_H5P_DEFAULT
std::complex< float > FloatComplex
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
std::complex< double > Complex
const T * fortran_vec(void) const
octave_idx_type cols(void) const
static const char *const keywords[]
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_idx_type rows(void) const
Matrix matrix_value(bool=false) const
boolNDArray bool_array_value(bool=false) const
intNDArray< octave_uint64 > uint64NDArray
bool load_ascii(std::istream &is)