75 template <
typename T,
bool is_
signed = true,
bool can_be_too_big = true>
100 template <
typename T>
112 template <
typename T>
136 template <
typename T>
142 if (this->
matrix.numel () == 1)
149 template <
typename T>
165 typename T::element_type
tmp = this->
matrix(
i);
167 typedef typename T::element_type::val_type val_type;
169 val_type ival = tmp.value ();
171 static const bool is_signed = std::numeric_limits<val_type>::is_signed;
172 static const bool can_be_larger_than_uchar_max
176 can_be_larger_than_uchar_max>::char_value_out_of_range (ival))
184 ::warning (
"range error for conversion to character value");
189 chm (
i) =
static_cast<char> (ival);
197 template <
typename MT>
204 template <
typename MT>
211 template <
typename MT>
218 template <
typename MT>
225 template <
typename MT>
232 template <
typename MT>
239 template <
typename MT>
246 template <
typename MT>
253 template <
typename MT>
260 template <
typename MT>
267 template <
typename T>
273 os <<
"# ndims: " << dv.
ndims () <<
"\n";
275 for (
int i = 0;
i < dv.
ndims ();
i++)
278 os <<
"\n" << this->
matrix;
283 template <
typename T>
290 error (
"load: failed to extract number of dimensions");
293 error (
"load: failed to extract number of rows and columns");
298 for (
int i = 0;
i < mdims;
i++)
306 error (
"load: failed to load matrix constant");
313 template <
typename T>
323 os.write (reinterpret_cast<char *> (&tmp), 4);
327 os.write (reinterpret_cast<char *> (&tmp), 4);
330 os.write (reinterpret_cast<const char *> (this->
matrix.data ()),
336 template <
typename T>
342 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
354 for (
int i = 0;
i < mdims;
i++)
356 if (! is.read (reinterpret_cast<char *> (&di), 4))
377 if (! is.read (reinterpret_cast<char *> (m.fortran_vec ()), m.byte_size ()))
382 int nel = dv.
numel ();
383 int bytes = nel / m.byte_size ();
384 for (
int i = 0;
i < nel;
i++)
406 template <
typename T>
413 #if defined (HAVE_HDF5)
421 int rank = dv.
ndims ();
422 hid_t space_hid, data_hid;
423 space_hid = data_hid = -1;
427 for (
int i = 0;
i < rank;
i++)
428 hdims[
i] =
dv(rank-
i-1);
430 space_hid = H5Screate_simple (rank, hdims, 0);
432 if (space_hid < 0)
return false;
433 #if defined (HAVE_HDF5_18)
434 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
437 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
442 H5Sclose (space_hid);
450 H5Sclose (space_hid);
453 octave_unused_parameter (loc_id);
454 octave_unused_parameter (name);
456 this->warn_save (
"hdf5");
462 template <
typename T>
468 #if defined (HAVE_HDF5)
478 #if defined (HAVE_HDF5_18)
481 hid_t data_hid = H5Dopen (loc_id, name);
483 hid_t space_id = H5Dget_space (data_hid);
485 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
497 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
509 for (hsize_t
i = 0, j = rank - 1;
i < rank;
i++, j--)
525 octave_unused_parameter (loc_id);
526 octave_unused_parameter (name);
528 this->warn_load (
"hdf5");
534 template <
typename T>
537 bool pr_as_read_syntax)
const
540 this->current_print_indent_level ());
543 template <
typename T>
551 typedef typename T::val_type val_type;
553 val_type ival = tmp.value ();
555 static const bool is_signed = std::numeric_limits<val_type>::is_signed;
556 static const bool can_be_larger_than_uchar_max
560 can_be_larger_than_uchar_max>::char_value_out_of_range (ival))
566 ::warning (
"range error for conversion to character value");
574 template <
typename T>
578 return static_cast<double> (this->
scalar);
581 template <
typename T>
585 return static_cast<float> (this->
scalar);
588 template <
typename T>
595 template <
typename T>
602 template <
typename T>
609 template <
typename T>
616 template <
typename T>
623 template <
typename T>
630 template <
typename T>
637 template <
typename T>
644 template <
typename T>
648 os << this->
scalar <<
"\n";
652 template <
typename T>
658 error (
"load: failed to load scalar constant");
663 template <
typename T>
667 os.write (reinterpret_cast<char *> (&(this->
scalar)), this->byte_size ());
671 template <
typename T>
677 if (! is.read (reinterpret_cast<char *> (&tmp),
this->byte_size ()))
681 switch (this->byte_size ())
700 template <
typename T>
707 #if defined (HAVE_HDF5)
711 hid_t space_hid, data_hid;
712 space_hid = data_hid = -1;
714 space_hid = H5Screate_simple (0, dimens, 0);
715 if (space_hid < 0)
return false;
717 #if defined (HAVE_HDF5_18)
718 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
721 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
726 H5Sclose (space_hid);
734 H5Sclose (space_hid);
737 octave_unused_parameter (loc_id);
738 octave_unused_parameter (name);
740 this->warn_save (
"hdf5");
746 template <
typename T>
750 #if defined (HAVE_HDF5)
753 #if defined (HAVE_HDF5_18)
756 hid_t data_hid = H5Dopen (loc_id, name);
758 hid_t space_id = H5Dget_space (data_hid);
760 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
783 octave_unused_parameter (loc_id);
784 octave_unused_parameter (name);
786 this->warn_load (
"hdf5");
octave_int< uint64_t > octave_uint64
octave_value as_uint16(void) const
octave_value as_uint32(void) const
intNDArray< octave_int64 > int64NDArray
octave_value as_int32(void) const
nd group nd example oindent but is performed more efficiently If only and it is a scalar
static bool char_value_out_of_range(T)
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
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
intNDArray< octave_uint8 > uint8NDArray
intNDArray< octave_uint16 > uint16NDArray
bool save_binary(std::ostream &os, bool &)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the then the first element defines the pivoting tolerance for the unsymmetric the values defined such that for full matrix
void resize(int n, int fill_value=0)
octave_int< uint16_t > octave_uint16
void swap_bytes< 8 >(void *ptr)
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format)
bool load_ascii(std::istream &is)
void error(const char *fmt,...)
void swap_bytes< 2 >(void *ptr)
static bool char_value_out_of_range(T val)
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
intNDArray< octave_int16 > int16NDArray
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
bool save_binary(std::ostream &os, bool &)
octave_value as_uint64(void) const
octave_value as_int64(void) const
octave_value as_uint8(void) const
octave_value as_uint8(void) 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
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool)
void swap_bytes< 4 >(void *ptr)
octave_base_value * try_narrowing_conversion(void)
intNDArray< octave_int8 > int8NDArray
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
octave_value as_uint16(void) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool)
nd deftypefn *octave_map m
octave_value as_int8(void) const
returns the type of the matrix and caches it for future use Called with more than one the function will not attempt to guess the type if it is still unknown This is useful for debugging purposes The possible matrix types depend on whether the matrix is full or and can be one of the following able sis tem and mark type as unknown tem as the structure of the matrix explicitly gives this(Sparse matrices only) tem code
octave_value convert_to_str_internal(bool, bool, char type) const
bool load_ascii(std::istream &is)
octave_value as_int8(void) const
octave_value as_int16(void) const
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
octave_value as_int64(void) const
octave_int< uint32_t > octave_uint32
static bool char_value_out_of_range(T val)
octave_value as_int32(void) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format)
static const bool can_be_larger_than_uchar_max
void warning(const char *fmt,...)
octave_value as_single(void) const
charNDArray max(char d, const charNDArray &m)
intNDArray< octave_int32 > int32NDArray
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
octave_value convert_to_str_internal(bool, bool, char type) const
=val(i)}if ode{val(i)}occurs in table i
void octave_print_internal(std::ostream &, char, bool)
octave_int< int64_t > octave_int64
octave_idx_type ndims(void) const
Number of dimensions.
bool save_ascii(std::ostream &os)
octave_value as_double(void) const
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
octave_value as_single(void) const
const octave_hdf5_id octave_H5P_DEFAULT
octave_int< int16_t > octave_int16
octave_value as_uint64(void) const
octave_value as_int16(void) const
bool save_ascii(std::ostream &os)
write the output to stdout if nargout is
octave_int< uint8_t > octave_uint8
Vector representing the dimensions (size) of an Array.
octave_int< int32_t > octave_int32
octave_value as_double(void) const
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
static bool char_value_out_of_range(T val)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
octave_value as_uint32(void) const
octave_int< int8_t > octave_int8
intNDArray< octave_uint64 > uint64NDArray