26#if defined (HAVE_CONFIG_H)
81#if defined (HAVE_ZLIB)
85#define READ_PAD(is_small_data_element, l) ((is_small_data_element) ? 4 : (((l)+7)/8)*8)
86#define PAD(l) (((l) > 0 && (l) <= 4) ? 4 : (((l)+7)/8)*8)
87#define INT8(l) ((l) == miINT8 || (l) == miUINT8 || (l) == miUTF8)
262#define READ_INTEGER_DATA(TYPE, swap, data, size, len, stream) \
267 OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
268 std::streamsize n_bytes = size * static_cast<std::streamsize> (len); \
269 stream.read (reinterpret_cast<char *> (ptr), n_bytes); \
271 swap_bytes< size > (ptr, len); \
272 for (octave_idx_type i = 0; i < len; i++) \
324#undef READ_INTEGER_DATA
373#define OCTAVE_MAT5_INTEGER_READ(TYP) \
377 std::streampos tmp_pos; \
379 if (read_mat5_tag (is, swap, type, len, is_small_data_element)) \
380 error ("load: reading matrix data for '%s'", retval.c_str ()); \
382 octave_idx_type n = re.numel (); \
383 tmp_pos = is.tellg (); \
384 read_mat5_integer_data (is, re.fortran_vec (), n, swap, \
385 static_cast<enum mat5_data_type> (type)); \
388 error ("load: reading matrix data for '%s'", retval.c_str ()); \
390 is.seekg (tmp_pos + static_cast<std::streamoff> \
391 (READ_PAD (is_small_data_element, len))); \
398 if (read_mat5_tag (is, swap, type, len, is_small_data_element)) \
399 error ("load: reading matrix data for '%s'", \
403 read_mat5_binary_data (is, im.fortran_vec (), n, swap, \
404 static_cast<enum mat5_data_type> (type), flt_fmt); \
407 error ("load: reading imaginary matrix data for '%s'", \
410 ComplexNDArray ctmp (dims); \
412 for (octave_idx_type i = 0; i < n; i++) \
413 ctmp(i) = Complex (re(i).double_value (), im(i)); \
427 bool& is_small_data_element)
432 if (! is.read (
reinterpret_cast<char *
> (&temp), 4))
438 upper = (temp >> 16) & 0xffff;
439 type = temp & 0xffff;
445 is_small_data_element =
true;
449 if (! is.read (
reinterpret_cast<char *
> (&temp), 4))
454 is_small_data_element =
false;
461read_int (std::istream& is,
bool swap, int32_t& val)
463 is.read (
reinterpret_cast<char *
> (&val), 4);
490 bool isclass =
false;
495 std::string classname;
497 bool flt_fmt_is_big_endian
503 if ((flt_fmt_is_big_endian && ! swap) || (! flt_fmt_is_big_endian && swap))
510 int32_t element_length;
511 bool is_small_data_element;
512 if (
read_mat5_tag (is, swap, type, element_length, is_small_data_element))
515 octave::interpreter& interp
520#if defined (HAVE_ZLIB)
527 is.read (inbuf, element_length);
532 uLongf elt_len = element_length;
534 if (uncompress2 (
reinterpret_cast<Bytef *
> (tmp), &destLen,
535 reinterpret_cast<Bytef *
> (inbuf), &elt_len)
537 error (
"load: error probing size of compressed data element");
543 destLen = tmp[1] + 8;
544 std::string outbuf (destLen,
' ');
548 elt_len = element_length;
549 int err = uncompress2 (
reinterpret_cast<Bytef *
>
550 (
const_cast<char *
> (outbuf.c_str ())),
551 &destLen,
reinterpret_cast<Bytef *
> (inbuf),
558 if (err == Z_BUF_ERROR && destLen == tmp[1] + 8
559 && elt_len ==
static_cast<uLongf
> (element_length))
580 msg =
"stream error";
595 case Z_VERSION_ERROR:
596 msg =
"version error";
600 error (
"load: error uncompressing data element (%s from zlib)",
605 std::istringstream gz_is (outbuf);
622 error (
"load: invalid element type = %d", type);
625 if (element_length == 0)
636 || type !=
miUINT32 ||
len != 8 || is_small_data_element)
637 error (
"load: invalid array flags subelement");
642 imag = (flags & 0x0800) != 0;
644 global = (flags & 0x0400) != 0;
646 logicalvar = (flags & 0x0200) != 0;
659 if (
read_mat5_tag (is, swap, type, dim_len, is_small_data_element)
661 error (
"load: invalid dimensions array subelement");
663 int ndims = dim_len / 4;
673 for (
int i = 0; i < ndims; i++)
680 std::streampos tmp_pos = is.tellg ();
681 is.seekg (tmp_pos +
static_cast<std::streamoff
>
682 (
READ_PAD (is_small_data_element, dim_len) - dim_len));
694 error (
"load: invalid array name subelement");
701 std::streampos tmp_pos = is.tellg ();
706 goto data_read_error;
708 is.seekg (tmp_pos +
static_cast<std::streamoff
>
720 Cell cell_array (dims);
732 error (
"load: reading cell data for '%s'", nm.c_str ());
768 std::streampos tmp_pos;
771 error (
"load: reading sparse row data for '%s'", retval.c_str ());
773 tmp_pos = is.tellg ();
779 error (
"load: reading sparse row data for '%s'", retval.c_str ());
781 is.seekg (tmp_pos +
static_cast<std::streamoff
>
786 error (
"load: reading sparse column data for '%s'",
789 tmp_pos = is.tellg ();
795 error (
"load: reading sparse column data for '%s'",
798 is.seekg (tmp_pos +
static_cast<std::streamoff
>
803 error (
"load: reading sparse matrix data for '%s'",
814 tmp_pos = is.tellg ();
820 error (
"load: reading sparse matrix data for '%s'",
823 is.seekg (tmp_pos +
static_cast<std::streamoff
>
832 error (
"load: reading sparse matrix data for '%s'",
840 error (
"load: reading imaginary sparse matrix data for '%s'",
860 goto data_read_error;
872 if (ftype ==
"simple" || ftype ==
"scopedfunction")
876 octave::tree_evaluator& tw = interp.get_evaluator ();
880 tc = tw.make_fcn_handle (fname);
886 if ((fpath.length () >= mroot.length ())
887 && fpath.substr (0, mroot.length ()) == mroot
900 + fpath.substr (mroot.length ()));
908 std::string dir_name = str.substr (0, xpos);
921 std::list<std::string> names;
922 names.push_back (fname +
".oct");
923 names.push_back (fname +
".mex");
924 names.push_back (fname +
".m");
926 octave::load_path& lp = interp.get_load_path ();
935 std::string dir_name = str.substr (0, xpos);
947 "load: can't find the file %s",
958 std::string dir_name = fpath.substr (0, xpos);
970 "load: can't find the file %s",
977 else if (ftype ==
"nested")
980 "load: can't load nested function");
983 else if (ftype ==
"anonymous")
1004 for (
auto p0 = m2.
begin (); p0 != m2.
end (); p0++)
1006 std::string key = m2.
key (p0);
1009 local_vars[key] = val;
1019 octave::tree_evaluator& tw = interp.get_evaluator ();
1020 tw.push_dummy_scope (
"read_mat5_binary_element");
1033 = interp.eval_string (fname.substr (4),
true, parse_status);
1035 if (parse_status != 0)
1036 error (
"load: failed to load anonymous function handle");
1041 error (
"load: failed to load anonymous function handle");
1047 error (
"load: invalid function handle type");
1057 for (
int i = 0; i < n_fields; i++)
1061 if (
read_mat5_tag (is, swap, fn_type, fn_len, is_small_data_element)
1063 error (
"load: invalid field name subelement");
1067 std::streampos tmp_pos = is.tellg ();
1071 if (! is.read (elname, fn_len))
1072 goto data_read_error;
1074 is.seekg (tmp_pos +
static_cast<std::streamoff
>
1075 (
READ_PAD (is_small_data_element, fn_len)));
1078 elname[fn_len] =
'\0';
1083 std::vector<Cell> elt (n_fields);
1086 elt[i] =
Cell (dims);
1095 if (field(i) ==
"MCOS")
1101 goto data_read_error;
1103 elt[i](j) = fieldtc;
1111 m.
assign (field (i), elt[i]);
1122 error (
"load: invalid class name");
1127 std::streampos tmp_pos = is.tellg ();
1132 goto data_read_error;
1134 is.seekg (tmp_pos +
static_cast<std::streamoff
>
1149 int32_t field_name_length;
1155 if (
read_mat5_tag (is, swap, fn_type, fn_len, is_small_data_element)
1157 error (
"load: invalid field name length subelement");
1159 if (! is.read (
reinterpret_cast<char *
> (&field_name_length), fn_len))
1160 goto data_read_error;
1167 if (
read_mat5_tag (is, swap, fn_type, fn_len, is_small_data_element)
1169 error (
"load: invalid field name subelement");
1175 fn_len =
READ_PAD (is_small_data_element, fn_len);
1179 if (! is.read (elname, fn_len))
1180 goto data_read_error;
1182 std::vector<Cell> elt (n_fields);
1185 elt[i] =
Cell (dims);
1197 elt[i](j) = fieldtc;
1203 const char *key = elname + i*field_name_length;
1217 "load: classdef element has been converted to a struct");
1223 std::list<std::string> ());
1230 "load: unable to reconstruct object inheritance");
1234 octave::load_path& lp = interp.get_load_path ();
1236 if (lp.find_method (classname,
"loadobj") !=
"")
1244 catch (
const octave::execution_exception&)
1246 goto data_read_error;
1254 "load: element has been converted to a structure");
1282 out(i) = in(i).bool_value ();
1319 std::streampos tmp_pos;
1322 error (
"load: reading matrix data for '%s'", retval.c_str ());
1325 tmp_pos = is.tellg ();
1331 error (
"load: reading matrix data for '%s'", retval.c_str ());
1333 is.seekg (tmp_pos +
static_cast<std::streamoff
>
1343 error (
"load: reading matrix data for '%s'", retval.c_str ());
1351 error (
"load: reading imaginary matrix data for '%s'",
1376 std::streampos tmp_pos;
1379 error (
"load: reading matrix data for '%s'", retval.c_str ());
1382 tmp_pos = is.tellg ();
1388 error (
"load: reading matrix data for '%s'", retval.c_str ());
1390 is.seekg (tmp_pos +
static_cast<std::streamoff
>
1402 out (i) =
static_cast<bool> (re (i));
1413 error (
"load: reading matrix data for '%s'", retval.c_str ());
1421 error (
"load: reading imaginary matrix data for '%s'",
1427 ctmp(i) =
Complex (re(i), im(i));
1433 bool converted =
false;
1437 const uint16_t *u16_str
1438 =
reinterpret_cast<const uint16_t *
> (u16.
data ());
1449 tc =
charMatrix (std::string (
reinterpret_cast<char *
> (u8_str), n8));
1457 const uint32_t *u32_str
1458 =
reinterpret_cast<const uint32_t *
> (u32.
data ());
1469 tc =
charMatrix (std::string (
reinterpret_cast<char *
> (u8_str), n8));
1487 bool found_big_char =
false;
1493 found_big_char =
true;
1499 "load: failed to convert from input to UTF-8; "
1500 "replacing non-ASCII characters with '?'");
1512 is.seekg (pos +
static_cast<std::streamoff
> (element_length));
1521 error (
"load: trouble reading binary file '%s'", filename.c_str ());
1525 "load: skipping over '%s'", retval.c_str ());
1526 is.seekg (pos +
static_cast<std::streamoff
> (element_length));
1532 const std::string& filename)
1534 int16_t version = 0;
1536 uint64_t subsys_offset;
1538 is.seekg (116, std::ios::beg);
1539 is.read (
reinterpret_cast<char *
> (&subsys_offset), 8);
1541 is.seekg (124, std::ios::beg);
1542 is.read (
reinterpret_cast<char *
> (&version), 2);
1543 is.read (
reinterpret_cast<char *
> (&magic), 2);
1545 if (magic == 0x4d49)
1547 else if (magic == 0x494d)
1552 error (
"load: can't read binary file");
1558 version = ((version >> 8) & 0xff) + ((version & 0xff) << 8);
1560 if (version != 1 && ! quiet)
1562 "load: found version %d binary MAT file, but only prepared for version 1",
1568 if (subsys_offset != 0x2020202020202020ULL && subsys_offset != 0ULL)
1571 is.seekg (subsys_offset, std::ios::beg);
1586 std::string outbuf (ilen - 7,
' ');
1589 char *ctmp =
const_cast<char *
> (outbuf.c_str ());
1591 ctmp[j-8] = itmp(j).char_value ();
1593 std::istringstream fh_ws (outbuf);
1604 is.seekg (128, std::ios::beg);
1615 if (bytes > 0 && bytes <= 4)
1616 temp = (bytes << 16) + type;
1620 if (! is.write (
reinterpret_cast<char *
> (&temp), 4))
1625 if (! is.write (
reinterpret_cast<char *
> (&temp), 4))
1634#define MAT5_DO_WRITE(TYPE, data, count, stream) \
1637 OCTAVE_LOCAL_BUFFER (TYPE, ptr, count); \
1638 for (octave_idx_type i = 0; i < count; i++) \
1639 ptr[i] = static_cast<TYPE> (data[i]); \
1640 std::streamsize n_bytes = sizeof (TYPE) * static_cast<std::streamsize> (count); \
1641 stream.write (reinterpret_cast<char *> (ptr), n_bytes); \
1651 const double *data = m.
data ();
1658 "save: some values too large to save as floats -- saving as doubles instead");
1664 double max_val, min_val;
1728 os.write (
reinterpret_cast<const char *
> (data),
len);
1732 error (
"unrecognized data format requested");
1738 static char buf[9]=
"\x00\x00\x00\x00\x00\x00\x00\x00";
1747 const float *data = m.
data ();
1749 float max_val, min_val;
1809 os.write (
reinterpret_cast<const char *
> (data),
len);
1817 error (
"unrecognized data format requested");
1823 static char buf[9]=
"\x00\x00\x00\x00\x00\x00\x00\x00";
1828template <
typename T>
1872 os.write (
reinterpret_cast<const char *
> (m),
len);
1876 static char buf[9]=
"\x00\x00\x00\x00\x00\x00\x00\x00";
1922 bool mark_global,
bool save_as_floats)
1931 false, save_as_floats))
1940 bool save_as_floats)
1951 double tmp = val[i];
2006 return 8 + nel * size;
2062 return PAD ((nel * size <= 4 ? 4 : 8) + nel * size);
2070 bool save_as_floats)
2091 bool save_as_floats)
2116 if (chm.
ndims () == 2 && dv(0) == 1)
2118 const uint8_t *u8_str =
reinterpret_cast<const uint8_t *
> (chm.
data ());
2130 bool save_as_floats,
bool mat7_format)
2132 std::size_t max_namelen = 63;
2133 std::size_t
len =
name.length ();
2138 ret +=
PAD (
len > max_namelen ? max_namelen :
len);
2146 std::size_t n16_str;
2151 std::size_t sz_of = 1;
2160 str_len = chm.
numel ();
2163 ret +=
PAD (sz_of * str_len);
2175 ret +=
PAD (nnz *
sizeof (int32_t));
2177 ret +=
PAD ((nc + 1) *
sizeof (int32_t));
2187 ret +=
PAD (nnz *
sizeof (int32_t));
2189 ret +=
PAD ((nc + 1) *
sizeof (int32_t));
2193#define INT_LEN(nel, size) \
2196 octave_idx_type sz = nel * size; \
2201 else if (cname ==
"int8")
2203 else if (cname ==
"int16")
2205 else if (cname ==
"int32")
2207 else if (cname ==
"int64")
2209 else if (cname ==
"uint8")
2211 else if (cname ==
"uint16")
2213 else if (cname ==
"uint32")
2215 else if (cname ==
"uint64")
2237 for (
int i = 0; i < nel; i++)
2264 std::size_t classlen = tc.
class_name ().length ();
2266 ret += 8 +
PAD (classlen > max_namelen ? max_namelen : classlen);
2269 for (
auto i = m.
begin (); i != m.
end (); i++)
2272 ret += 16 + fieldcnt * (max_namelen + 1);
2276 for (
auto i = m.
begin (); i != m.
end (); i++)
2296 int tmp =
sizeof (int32_t);
2301 tmp_idx[i] = idx[i];
2310 "save: skipping %s: dimension too large for MAT format",
2320 bool mark_global,
bool mat7_format,
2321 bool save_as_floats,
bool compressing)
2326 std::size_t max_namelen = 63;
2329 int nd = tc.
ndims ();
2334 for (
int i = 0; i < nd; i++)
2336 if (dv(i) > max_dim_val)
2361 if (nnz > max_dim_val || nc + 1 > max_dim_val)
2369 else if (dv.
numel () > max_dim_val)
2375#if defined (HAVE_ZLIB)
2377 if (mat7_format && ! compressing)
2381 std::ostringstream buf;
2386 save_as_floats,
true);
2392 std::string buf_str = buf.str ();
2393 uLongf srcLen = buf_str.length ();
2394 uLongf destLen = compressBound (srcLen);
2397 if (compress (
reinterpret_cast<Bytef *
> (out_buf), &destLen,
2398 reinterpret_cast<const Bytef *
> (buf_str.c_str ()),
2401 error (
"save: error compressing data element");
2406 os.write (out_buf, destLen);
2414 octave_unused_parameter (compressing);
2419 (tc,
name, save_as_floats, mat7_format));
2435 else if (cname ==
"int8")
2437 else if (cname ==
"int16")
2439 else if (cname ==
"int32")
2441 else if (cname ==
"int64")
2443 else if (cname ==
"uint8" || tc.
islogical ())
2445 else if (cname ==
"uint16")
2447 else if (cname ==
"uint32")
2449 else if (cname ==
"uint64")
2471 error (
"save: error while writing '%s' to MAT file",
name.c_str ());
2474 os.write (
reinterpret_cast<char *
> (&flags), 4);
2479 os.write (
reinterpret_cast<char *
> (&nnz_32), 4);
2486 std::size_t n16_str;
2487 bool conv_u16 =
false;
2500 os.write (
reinterpret_cast<char *
> (&n), 4);
2501 os.write (
reinterpret_cast<char *
> (&n16_str), 4);
2504 for (
int i = 0; i < nd; i++)
2507 os.write (
reinterpret_cast<char *
> (&n), 4);
2510 if (
PAD (dim_len) > dim_len)
2512 static char buf[9] =
"\x00\x00\x00\x00\x00\x00\x00\x00";
2513 os.write (buf,
PAD (dim_len) - dim_len);
2518 std::size_t namelen =
name.length ();
2520 if (namelen > max_namelen)
2521 namelen = max_namelen;
2523 int paddedlength =
PAD (namelen);
2527 memset (paddedname, 0, paddedlength);
2528 strncpy (paddedname,
name.c_str (), namelen);
2529 os.write (paddedname, paddedlength);
2542 paddedlength =
PAD (
len);
2546 os.write (
reinterpret_cast<char *
> (u16_str),
len);
2554 paddedlength =
PAD (
len);
2561 if (paddedlength >
len)
2563 static char padbuf[9] =
"\x00\x00\x00\x00\x00\x00\x00\x00";
2564 os.write (padbuf, paddedlength -
len);
2603 for (
int i = 0; i < nnz; i++)
2604 buf (i) = m.
data (i);
2609 else if (cname ==
"int8")
2615 else if (cname ==
"int16")
2621 else if (cname ==
"int32")
2627 else if (cname ==
"int64")
2633 else if (cname ==
"uint8")
2639 else if (cname ==
"uint16")
2645 else if (cname ==
"uint32")
2651 else if (cname ==
"uint64")
2683 error (
"save: error while writing '%s' to MAT file",
name.c_str ());
2707 std::size_t namelen = classname.length ();
2709 if (namelen > max_namelen)
2710 namelen = max_namelen;
2712 int paddedlength =
PAD (namelen);
2716 memset (paddedname, 0, paddedlength);
2717 strncpy (paddedname, classname.c_str (), namelen);
2718 os.write (paddedname, paddedlength);
2723 octave::load_path& lp
2727 && lp.find_method (tc.
class_name (),
"saveobj") !=
"")
2733 m = tmp(0).map_value ();
2735 catch (
const octave::execution_exception&)
2737 error (
"save: error while writing '%s' to MAT file",
2748 int32_t maxfieldnamelength = max_namelen + 1;
2753 os.write (
reinterpret_cast<char *
> (&maxfieldnamelength), 4);
2762 std::string key = keys(i);
2765 memset (buf, 0, max_namelen + 1);
2767 strncpy (buf, key.c_str (), max_namelen);
2768 os.write (buf, max_namelen + 1);
2775 std::vector<const octave_value *> elts (nf);
2792 error (
"save: error while writing '%s' to MAT file",
void swap_bytes< 8 >(void *ptr)
void swap_bytes< 4 >(void *ptr)
charNDArray max(char d, const charNDArray &m)
OCTARRAY_API void clear(void)
octave_idx_type numel(void) const
Number of elements in the array.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
bool isvector(void) const
Size of the specified dimension.
const T * data(void) const
Size of the specified dimension.
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
int ndims(void) const
Size of the specified dimension.
OCTAVE_API bool all_integers(float &max_val, float &min_val) const
OCTAVE_API bool all_integers(double &max_val, double &min_val) const
OCTAVE_API bool too_large_for_float(void) const
octave_idx_type nnz(void) const
Actual number of nonzero terms.
octave_idx_type * ridx(void)
octave_idx_type * cidx(void)
octave_idx_type nzmax(void) const
Amount of storage for nonzero elements.
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)
OCTINTERP_API cdef_class find_class(const std::string &name, bool error_if_not_found=true, bool load_if_not_found=true)
std::string find_first_of(const std::list< std::string > &names)
std::map< std::string, octave_value > local_vars_map
static std::string make_absolute(const std::string &s, const std::string &dot_path=get_current_directory())
OCTINTERP_API bool reconstruct_parents(void)
OCTINTERP_API bool reconstruct_exemplar(void)
octave_value fcn_val(void)
octave_idx_type nfields(void) const
const Cell & contents(const_iterator p) const
octave_idx_type numel(void) const
void assign(const std::string &k, const Cell &val)
const_iterator begin(void) const
const_iterator end(void) const
string_vector keys(void) const
const octave_value & contents(const_iterator p) const
octave_idx_type nfields(void) const
const_iterator end(void) const
const_iterator begin(void) const
std::string key(const_iterator p) const
int32NDArray int32_array_value(void) const
boolNDArray bool_array_value(bool warn=false) const
uint16NDArray uint16_array_value(void) const
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
bool is_complex_matrix(void) const
bool issparse(void) const
OCTINTERP_API octave_scalar_map scalar_map_value(void) const
OCTINTERP_API octave_fcn_handle * fcn_handle_value(bool silent=false) const
bool is_string(void) const
ComplexNDArray complex_array_value(bool frc_str_conv=false) const
bool is_defined(void) const
charNDArray char_array_value(bool frc_str_conv=false) const
Cell cell_value(void) const
std::string class_name(void) const
int8NDArray int8_array_value(void) const
int64NDArray int64_array_value(void) const
bool isstruct(void) const
uint8NDArray uint8_array_value(void) const
std::string string_value(bool force=false) const
uint64NDArray uint64_array_value(void) const
bool is_range(void) const
NDArray array_value(bool frc_str_conv=false) const
bool is_real_matrix(void) const
bool is_single_type(void) const
uint32NDArray uint32_array_value(void) const
octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
OCTINTERP_API octave_map map_value(void) const
bool isobject(void) const
bool is_real_scalar(void) const
FloatComplexNDArray float_complex_array_value(bool frc_str_conv=false) const
FloatNDArray float_array_value(bool frc_str_conv=false) const
bool is_uint8_type(void) const
int16NDArray int16_array_value(void) const
bool is_inline_function(void) const
bool iscomplex(void) const
bool is_complex_scalar(void) const
bool islogical(void) const
dim_vector dims(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
void read_doubles(std::istream &is, double *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
void read_floats(std::istream &is, float *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
void warning_with_id(const char *id, const char *fmt,...)
void error(const char *fmt,...)
void err_disabled_feature(const std::string &fcn, const std::string &feature, const std::string &pkg)
void warn_wrong_type_arg(const char *name, const octave_value &tc)
static octave_value subsys_ov
#define READ_INTEGER_DATA(TYPE, swap, data, size, len, stream)
static void read_int(std::istream &is, bool swap, int32_t &val)
void write_mat5_integer_data(std::ostream &os, const T *m, int size, octave_idx_type nel)
static int write_mat5_tag(std::ostream &is, int type, octave_idx_type bytes)
static int read_mat5_tag(std::istream &is, bool swap, int32_t &type, int32_t &bytes, bool &is_small_data_element)
static bool write_mat5_cell_array(std::ostream &os, const Cell &cell, bool mark_global, bool save_as_floats)
#define MAT5_DO_WRITE(TYPE, data, count, stream)
int save_mat5_array_length(const double *val, octave_idx_type nel, bool save_as_floats)
#define OCTAVE_MAT5_INTEGER_READ(TYP)
@ MAT_FILE_WORKSPACE_CLASS
@ MAT_FILE_FUNCTION_CLASS
static uint16_t * maybe_convert_to_u16(const charNDArray &chm, std::size_t &n16_str)
static void read_mat5_binary_data(std::istream &is, double *data, octave_idx_type count, bool swap, mat5_data_type type, octave::mach_info::float_format flt_fmt)
int read_mat5_binary_file_header(std::istream &is, bool &swap, bool quiet, const std::string &filename)
#define INT_LEN(nel, size)
bool save_mat5_binary_element(std::ostream &os, const octave_value &tc, const std::string &name, bool mark_global, bool mat7_format, bool save_as_floats, bool compressing)
static void write_mat5_array(std::ostream &os, const NDArray &m, bool save_as_floats)
int save_mat5_element_length(const octave_value &tc, const std::string &name, bool save_as_floats, bool mat7_format)
static void warn_dim_too_large(const std::string &name)
std::string read_mat5_binary_element(std::istream &is, const std::string &filename, bool swap, bool &global, octave_value &tc)
#define READ_PAD(is_small_data_element, l)
static void write_mat5_sparse_index_vector(std::ostream &os, const octave_idx_type *idx, octave_idx_type nel)
void read_mat5_integer_data(std::istream &is, T *m, octave_idx_type count, bool swap, mat5_data_type type)
OCTAVE_NAMESPACE_BEGIN save_type get_save_type(double, double)
class OCTAVE_API charMatrix
class OCTAVE_API SparseMatrix
class OCTAVE_API SparseComplexMatrix
std::string octave_exec_home(void)
float_format native_float_format(void)
@ flt_fmt_ieee_big_endian
@ flt_fmt_ieee_little_endian
std::string dir_sep_chars(void)
OCTINTERP_API octave_value_list feval(const char *name, const octave_value_list &args=octave_value_list(), int nargout=0)
interpreter & __get_interpreter__(const std::string &who)
OCTINTERP_API octave_value load_fcn_from_file(const std::string &file_name, const std::string &dir_name="", const std::string &dispatch_type="", const std::string &package_name="", const std::string &fcn_name="", bool autoload=false)
load_path & __get_load_path__(const std::string &who)
bool too_large_for_float(double x)
std::complex< double > Complex
std::complex< float > FloatComplex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
uint8_t * octave_u32_to_u8_wrapper(const uint32_t *src, size_t src_len, uint8_t *result_buf, size_t *lengthp)
uint16_t * octave_u8_to_u16_wrapper(const uint8_t *src, size_t src_len, uint16_t *result_buf, size_t *lengthp)
uint8_t * octave_u16_to_u8_wrapper(const uint16_t *src, size_t src_len, uint8_t *result_buf, size_t *lengthp)