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);
365 bool *mtmp =
m.fortran_vec ();
370 htmp[i] = (mtmp[i] ? 1 : 0);
372 os.write (htmp, nel);
382 if (! is.read (
reinterpret_cast<char *
> (&mdims), 4))
397 for (
int i = 0; i < mdims; i++)
399 if (! is.read (
reinterpret_cast<char *
> (&di), 4))
420 if (! is.read (htmp, nel))
423 bool *mtmp =
m.fortran_vec ();
425 mtmp[i] = (htmp[i] ? 1 : 0);
437 #if defined (HAVE_HDF5)
444 int rank = dv.
ndims ();
445 hid_t space_hid, data_hid;
446 space_hid = data_hid = -1;
452 for (
int i = 0; i < rank; i++)
453 hdims[i] = dv(rank-i-1);
455 space_hid = H5Screate_simple (rank, hdims,
nullptr);
456 if (space_hid < 0)
return false;
457 #if defined (HAVE_HDF5_18)
458 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
462 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_HBOOL, space_hid,
467 H5Sclose (space_hid);
472 bool *mtmp =
m.fortran_vec ();
482 H5Sclose (space_hid);
485 octave_unused_parameter (loc_id);
486 octave_unused_parameter (name);
499 #if defined (HAVE_HDF5)
508 #if defined (HAVE_HDF5_18)
511 hid_t data_hid = H5Dopen (loc_id, name);
513 hid_t space_id = H5Dget_space (data_hid);
515 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
526 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
538 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
552 btmp.
elem (i) = htmp[i];
560 octave_unused_parameter (loc_id);
561 octave_unused_parameter (name);
574 mxLogical *pd =
static_cast<mxLogical *
> (retval->
get_data ());
576 mwSize nel =
numel ();
580 for (mwIndex i = 0; i < nel; i++)
588 DEFUN (logical, args, ,
602 if (args.length () != 1)
void swap_bytes< 4 >(void *ptr)
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API bool isempty(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type rows(void) const
OCTARRAY_OVERRIDABLE_FUNC_API int ndims(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API T & elem(octave_idx_type n)
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type cols(void) const
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(void) const
Number of dimensions.
void * get_data(void) const
octave_idx_type numel(void) const
dim_vector dims(void) const
octave_idx_type columns(void) const
int current_print_indent_level(void) const
OCTINTERP_API void warn_load(const char *type) const
octave_idx_type rows(void) const
friend class octave_value
OCTINTERP_API void warn_save(const char *type) const
FloatComplex float_complex_value(bool=false) const
octave_value as_uint8(void) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_value as_int8(void) const
octave_base_value * try_narrowing_conversion(void)
float float_value(bool=false) const
octave_value as_uint64(void) const
boolNDArray bool_array_value(bool=false) const
mxArray * as_mxArray(bool interleaved) const
type_conv_info numeric_conversion_function(void) 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_uint32(void) const
octave_value as_double(void) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_value as_single(void) const
bool save_binary(std::ostream &os, bool save_as_floats)
double double_value(bool=false) const
bool save_ascii(std::ostream &os)
octave_value as_int16(void) const
bool load_ascii(std::istream &is)
octave_value as_uint16(void) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
octave_value as_int64(void) const
Matrix matrix_value(bool=false) const
octave_value as_int32(void) const
static int static_type_id(void)
boolNDArray bool_array_value(bool warn=false) const
bool bool_value(bool warn=false) const
bool issparse(void) const
bool isnumeric(void) const
bool is_scalar_type(void) const
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
bool islogical(void) const
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5S_ALL
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#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(void)
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)
class OCTAVE_API boolMatrix
class OCTAVE_API FloatNDArray
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)
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
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