26 #if defined (HAVE_CONFIG_H)
71 "bool matrix",
"logical");
100 if (nr == 1 && nc == 1)
114 "bool matrix",
"real scalar");
126 "bool matrix",
"real scalar");
138 "bool matrix",
"complex scalar");
154 "bool matrix",
"complex scalar");
231 bool pr_as_read_syntax)
const
244 os <<
"# ndims: " << dv.
ndims () <<
"\n";
246 for (
int i = 0; i < dv.
ndims (); i++)
255 os <<
"# rows: " <<
rows () <<
"\n"
256 <<
"# columns: " <<
columns () <<
"\n";
271 keywords[0] =
"ndims";
272 keywords[1] =
"rows";
278 error (
"load: failed to extract number of rows and columns");
282 int mdims =
static_cast<int> (val);
285 error (
"load: failed to extract number of dimensions");
290 for (
int i = 0; i < mdims; i++)
294 error (
"load: failed to extract dimensions");
306 error (
"load: failed to load matrix constant");
309 btmp.
elem (i) = (tmp.
elem (i) != 0.);
314 else if (kw ==
"rows")
320 error (
"load: failed to extract number of rows and columns");
322 if (nr > 0 && nc > 0)
327 error (
"load: failed to load matrix constant");
332 btmp.
elem (i, j) = (tmp.
elem (i, j) != 0.);
336 else if (nr == 0 || nc == 0)
356 int32_t tmp = - dv.
ndims ();
357 os.write (
reinterpret_cast<char *
> (&tmp), 4);
358 for (
int i = 0; i < dv.
ndims (); i++)
361 os.write (
reinterpret_cast<char *
> (&tmp), 4);
366 os.write (
reinterpret_cast<const char *
> (mtmp), nel);
376 if (! is.read (
reinterpret_cast<char *
> (&mdims), 4))
391 for (
int i = 0; i < mdims; i++)
393 if (! is.read (
reinterpret_cast<char *
> (&di), 4))
414 if (! is.read (htmp, nel))
417 bool *mtmp =
m.fortran_vec ();
419 mtmp[i] = (htmp[i] ? 1 : 0);
431 #if defined (HAVE_HDF5)
438 int rank = dv.
ndims ();
439 hid_t space_hid, data_hid;
440 space_hid = data_hid = -1;
445 for (
int i = 0; i < rank; i++)
446 hdims[i] = dv(rank-i-1);
448 space_hid = H5Screate_simple (rank, hdims,
nullptr);
449 if (space_hid < 0)
return false;
450 #if defined (HAVE_HDF5_18)
451 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
455 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
460 H5Sclose (space_hid);
468 reinterpret_cast<const char *
> (mtmp)) >= 0;
471 H5Sclose (space_hid);
474 octave_unused_parameter (loc_id);
475 octave_unused_parameter (name);
488 #if defined (HAVE_HDF5)
497 #if defined (HAVE_HDF5_18)
500 hid_t data_hid = H5Dopen (loc_id, name);
502 hid_t space_id = H5Dget_space (data_hid);
504 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
515 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
527 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
541 btmp.
elem (i) = htmp[i];
549 octave_unused_parameter (loc_id);
550 octave_unused_parameter (name);
569 for (
mwIndex i = 0; i < nel; i++)
577 DEFUN (logical, args, ,
591 if (args.length () != 1)
626 OCTAVE_END_NAMESPACE(
octave)
void swap_bytes< 4 >(void *ptr)
T & elem(octave_idx_type n)
Size of the specified dimension.
int ndims() const
Size of the specified dimension.
octave_idx_type rows() const
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
const T * data() const
Size of the specified dimension.
octave_idx_type cols() const
bool isempty() 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.
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)
octave_idx_type ndims() const
Number of dimensions.
octave_idx_type numel() const
octave_idx_type rows() const
octave_idx_type columns() const
int current_print_indent_level() const
void warn_load(const char *type) const
friend class octave_value
void warn_save(const char *type) const
FloatComplex float_complex_value(bool=false) const
octave_value as_int16() const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
octave_base_value * try_narrowing_conversion()
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
float float_value(bool=false) const
octave_value as_uint8() const
boolNDArray bool_array_value(bool=false) const
octave_value as_int8() const
mxArray * as_mxArray(bool interleaved) const
type_conv_info numeric_conversion_function() const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
NDArray array_value(bool=false) const
Complex complex_value(bool=false) const
octave_value as_single() const
octave_value as_double() const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
bool save_binary(std::ostream &os, bool save_as_floats)
octave_value as_int64() const
double double_value(bool=false) const
bool save_ascii(std::ostream &os)
bool load_ascii(std::istream &is)
octave_value as_uint64() const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Matrix matrix_value(bool=false) const
octave_value as_uint16() const
octave_value as_int32() const
octave_value as_uint32() const
static int static_type_id()
boolNDArray bool_array_value(bool warn=false) const
bool bool_value(bool warn=false) const
bool is_scalar_type() const
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
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
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
void() error(const char *fmt,...)
#define panic_impossible()
void err_wrong_type_arg(const char *name, const char *s)
void err_invalid_conversion(const std::string &from, const std::string &to)
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()
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector &d)
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
std::complex< double > Complex
std::complex< float > FloatComplex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
intNDArray< octave_uint16 > uint16NDArray
intNDArray< octave_uint32 > uint32NDArray
intNDArray< octave_uint64 > uint64NDArray
intNDArray< octave_uint8 > uint8NDArray