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)
256 template <
typename T>
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;
461 read_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))
519 #if defined (HAVE_ZLIB)
526 is.read (inbuf, element_length);
531 uLongf elt_len = element_length;
533 if (uncompress2 (
reinterpret_cast<Bytef *
> (tmp), &destLen,
534 reinterpret_cast<Bytef *
> (inbuf), &elt_len)
536 error (
"load: error probing size of compressed data element");
542 destLen = tmp[1] + 8;
543 std::string outbuf (destLen,
' ');
547 elt_len = element_length;
548 int err = uncompress2 (
reinterpret_cast<Bytef *
>
549 (
const_cast<char *
> (outbuf.c_str ())),
550 &destLen,
reinterpret_cast<Bytef *
> (inbuf),
557 if (err == Z_BUF_ERROR && destLen == tmp[1] + 8
558 && elt_len ==
static_cast<uLongf
> (element_length))
579 msg =
"stream error";
594 case Z_VERSION_ERROR:
595 msg =
"version error";
599 error (
"load: error uncompressing data element (%s from zlib)",
604 std::istringstream gz_is (outbuf);
621 error (
"load: invalid element type = %d", type);
624 if (element_length == 0)
635 || type !=
miUINT32 ||
len != 8 || is_small_data_element)
636 error (
"load: invalid array flags subelement");
641 imag = (flags & 0x0800) != 0;
643 global = (flags & 0x0400) != 0;
645 logicalvar = (flags & 0x0200) != 0;
658 if (
read_mat5_tag (is, swap, type, dim_len, is_small_data_element)
660 error (
"load: invalid dimensions array subelement");
662 int ndims = dim_len / 4;
672 for (
int i = 0; i < ndims; i++)
679 std::streampos tmp_pos = is.tellg ();
680 is.seekg (tmp_pos +
static_cast<std::streamoff
>
681 (
READ_PAD (is_small_data_element, dim_len) - dim_len));
693 error (
"load: invalid array name subelement");
700 std::streampos tmp_pos = is.tellg ();
704 if (! is.read (name,
len))
705 goto data_read_error;
707 is.seekg (tmp_pos +
static_cast<std::streamoff
>
719 Cell cell_array (dims);
731 error (
"load: reading cell data for '%s'", nm.c_str ());
767 std::streampos tmp_pos;
770 error (
"load: reading sparse row data for '%s'", retval.c_str ());
772 tmp_pos = is.tellg ();
778 error (
"load: reading sparse row data for '%s'", retval.c_str ());
780 is.seekg (tmp_pos +
static_cast<std::streamoff
>
785 error (
"load: reading sparse column data for '%s'",
788 tmp_pos = is.tellg ();
794 error (
"load: reading sparse column data for '%s'",
797 is.seekg (tmp_pos +
static_cast<std::streamoff
>
802 error (
"load: reading sparse matrix data for '%s'",
813 tmp_pos = is.tellg ();
819 error (
"load: reading sparse matrix data for '%s'",
822 is.seekg (tmp_pos +
static_cast<std::streamoff
>
831 error (
"load: reading sparse matrix data for '%s'",
839 error (
"load: reading imaginary sparse matrix data for '%s'",
859 goto data_read_error;
871 if (ftype ==
"simple" || ftype ==
"scopedfunction")
875 octave::tree_evaluator& tw = interp.get_evaluator ();
879 tc = tw.make_fcn_handle (fname);
885 if ((fpath.length () >= mroot.length ())
886 && fpath.substr (0, mroot.length ()) == mroot
899 + fpath.substr (mroot.length ()));
900 octave::sys::file_stat fs (str);
907 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 ();
928 octave::directory_path p (lp.system_path ());
935 std::string dir_name = str.substr (0, xpos);
948 "load: can't find the file %s",
959 std::string dir_name = fpath.substr (0, xpos);
971 "load: can't find the file %s",
978 else if (ftype ==
"nested")
981 "load: can't load nested function");
984 else if (ftype ==
"anonymous")
995 octave::stack_frame::local_vars_map local_vars;
1005 for (
auto p0 = m2.
begin (); p0 != m2.
end (); p0++)
1007 std::string key = m2.
key (p0);
1010 local_vars[key] = val;
1020 octave::tree_evaluator& tw = interp.get_evaluator ();
1021 tw.push_dummy_scope (
"read_mat5_binary_element");
1023 octave::unwind_action act ([&tw] () { tw.pop_scope (); });
1034 = interp.eval_string (fname.substr (4),
true, parse_status);
1036 if (parse_status != 0)
1037 error (
"load: failed to load anonymous function handle");
1042 error (
"load: failed to load anonymous function handle");
1049 error (
"load: invalid function handle type");
1059 for (
int i = 0; i < n_fields; i++)
1063 if (
read_mat5_tag (is, swap, fn_type, fn_len, is_small_data_element)
1065 error (
"load: invalid field name subelement");
1069 std::streampos tmp_pos = is.tellg ();
1073 if (! is.read (elname, fn_len))
1074 goto data_read_error;
1076 is.seekg (tmp_pos +
static_cast<std::streamoff
>
1077 (
READ_PAD (is_small_data_element, fn_len)));
1080 elname[fn_len] =
'\0';
1085 std::vector<Cell> elt (n_fields);
1088 elt[i] =
Cell (dims);
1097 if (field(i) ==
"MCOS")
1103 goto data_read_error;
1105 elt[i](j) = fieldtc;
1113 m.assign (field (i), elt[i]);
1124 error (
"load: invalid class name");
1129 std::streampos tmp_pos = is.tellg ();
1133 if (! is.read (name,
len))
1134 goto data_read_error;
1136 is.seekg (tmp_pos +
static_cast<std::streamoff
>
1151 int32_t field_name_length;
1157 if (
read_mat5_tag (is, swap, fn_type, fn_len, is_small_data_element)
1159 error (
"load: invalid field name length subelement");
1161 if (! is.read (
reinterpret_cast<char *
> (&field_name_length), fn_len))
1162 goto data_read_error;
1169 if (
read_mat5_tag (is, swap, fn_type, fn_len, is_small_data_element)
1171 error (
"load: invalid field name subelement");
1177 fn_len =
READ_PAD (is_small_data_element, fn_len);
1181 if (! is.read (elname, fn_len))
1182 goto data_read_error;
1184 std::vector<Cell> elt (n_fields);
1187 elt[i] =
Cell (dims);
1199 elt[i](j) = fieldtc;
1205 const char *key = elname + i*field_name_length;
1207 m.assign (key, elt[i]);
1213 octave::cdef_manager& cdm = interp.get_cdef_manager ();
1215 if (cdm.find_class (classname,
false,
true).ok ())
1219 "load: classdef element has been converted to a struct");
1225 std::list<std::string> ());
1232 "load: unable to reconstruct object inheritance");
1236 octave::load_path& lp = interp.get_load_path ();
1238 if (lp.find_method (classname,
"loadobj") !=
"")
1246 catch (
const octave::execution_exception&)
1248 goto data_read_error;
1256 "load: element has been converted to a structure");
1284 out(i) = in(i).bool_value ();
1321 std::streampos tmp_pos;
1324 error (
"load: reading matrix data for '%s'", retval.c_str ());
1327 tmp_pos = is.tellg ();
1333 error (
"load: reading matrix data for '%s'", retval.c_str ());
1335 is.seekg (tmp_pos +
static_cast<std::streamoff
>
1345 error (
"load: reading matrix data for '%s'", retval.c_str ());
1353 error (
"load: reading imaginary matrix data for '%s'",
1378 std::streampos tmp_pos;
1381 error (
"load: reading matrix data for '%s'", retval.c_str ());
1384 tmp_pos = is.tellg ();
1390 error (
"load: reading matrix data for '%s'", retval.c_str ());
1392 is.seekg (tmp_pos +
static_cast<std::streamoff
>
1404 out (i) =
static_cast<bool> (re (i));
1415 error (
"load: reading matrix data for '%s'", retval.c_str ());
1423 error (
"load: reading imaginary matrix data for '%s'",
1429 ctmp(i) =
Complex (re(i), im(i));
1435 bool converted =
false;
1439 const uint16_t *u16_str
1440 =
reinterpret_cast<const uint16_t *
> (u16.
data ());
1451 tc =
charMatrix (std::string (
reinterpret_cast<char *
> (u8_str), n8));
1459 const uint32_t *u32_str
1460 =
reinterpret_cast<const uint32_t *
> (u32.
data ());
1471 tc =
charMatrix (std::string (
reinterpret_cast<char *
> (u8_str), n8));
1489 bool found_big_char =
false;
1495 found_big_char =
true;
1501 "load: failed to convert from input to UTF-8; "
1502 "replacing non-ASCII characters with '?'");
1514 is.seekg (pos +
static_cast<std::streamoff
> (element_length));
1523 error (
"load: trouble reading binary file '%s'", filename.c_str ());
1527 "load: skipping over '%s'", retval.c_str ());
1528 is.seekg (pos +
static_cast<std::streamoff
> (element_length));
1534 const std::string& filename)
1536 int16_t version = 0;
1538 uint64_t subsys_offset;
1540 is.seekg (116, std::ios::beg);
1541 is.read (
reinterpret_cast<char *
> (&subsys_offset), 8);
1543 is.seekg (124, std::ios::beg);
1544 is.read (
reinterpret_cast<char *
> (&version), 2);
1545 is.read (
reinterpret_cast<char *
> (&magic), 2);
1547 if (magic == 0x4d49)
1549 else if (magic == 0x494d)
1554 error (
"load: can't read binary file");
1560 version = ((version >> 8) & 0xff) + ((version & 0xff) << 8);
1562 if (version != 1 && ! quiet)
1564 "load: found version %d binary MAT file, but only prepared for version 1",
1570 if (subsys_offset != UINT64_C (0x2020202020202020)
1571 && subsys_offset != UINT64_C (0))
1574 is.seekg (subsys_offset, std::ios::beg);
1589 std::string outbuf (ilen - 7,
' ');
1592 char *ctmp =
const_cast<char *
> (outbuf.c_str ());
1594 ctmp[j-8] = itmp(j).char_value ();
1596 std::istringstream fh_ws (outbuf);
1607 is.seekg (128, std::ios::beg);
1618 if (bytes > 0 && bytes <= 4)
1619 temp = (bytes << 16) + type;
1623 if (! is.write (
reinterpret_cast<char *
> (&temp), 4))
1628 if (! is.write (
reinterpret_cast<char *
> (&temp), 4))
1637 #define MAT5_DO_WRITE(TYPE, data, count, stream) \
1640 OCTAVE_LOCAL_BUFFER (TYPE, ptr, count); \
1641 for (octave_idx_type i = 0; i < count; i++) \
1642 ptr[i] = static_cast<TYPE> (data[i]); \
1643 std::streamsize n_bytes = sizeof (TYPE) * static_cast<std::streamsize> (count); \
1644 stream.write (reinterpret_cast<char *> (ptr), n_bytes); \
1654 const double *data =
m.data ();
1658 if (
m.too_large_for_float ())
1661 "save: some values too large to save as floats -- saving as doubles instead");
1667 double max_val, min_val;
1668 if (
m.all_integers (max_val, min_val))
1731 os.write (
reinterpret_cast<const char *
> (data),
len);
1735 error (
"unrecognized data format requested");
1741 static char buf[9]=
"\x00\x00\x00\x00\x00\x00\x00\x00";
1750 const float *data =
m.data ();
1752 float max_val, min_val;
1753 if (
m.all_integers (max_val, min_val))
1812 os.write (
reinterpret_cast<const char *
> (data),
len);
1820 error (
"unrecognized data format requested");
1826 static char buf[9]=
"\x00\x00\x00\x00\x00\x00\x00\x00";
1831 template <
typename T>
1875 os.write (
reinterpret_cast<const char *
> (
m),
len);
1879 static char buf[9]=
"\x00\x00\x00\x00\x00\x00\x00\x00";
1925 bool mark_global,
bool save_as_floats)
1934 false, save_as_floats))
1943 bool save_as_floats)
1954 double tmp = val[i];
2009 return 8 + nel * size;
2065 return PAD ((nel * size <= 4 ? 4 : 8) + nel * size);
2073 bool save_as_floats)
2094 bool save_as_floats)
2119 if (chm.
ndims () == 2 && dv(0) == 1)
2121 const uint8_t *u8_str =
reinterpret_cast<const uint8_t *
> (chm.
data ());
2133 bool save_as_floats,
bool mat7_format)
2135 std::size_t max_namelen = 63;
2136 std::size_t
len = name.length ();
2141 ret +=
PAD (
len > max_namelen ? max_namelen :
len);
2149 std::size_t n16_str;
2154 std::size_t sz_of = 1;
2163 str_len = chm.
numel ();
2166 ret +=
PAD (sz_of * str_len);
2178 ret +=
PAD (nnz *
sizeof (int32_t));
2180 ret +=
PAD ((nc + 1) *
sizeof (int32_t));
2190 ret +=
PAD (nnz *
sizeof (int32_t));
2192 ret +=
PAD ((nc + 1) *
sizeof (int32_t));
2196 #define INT_LEN(nel, size) \
2199 octave_idx_type sz = nel * size; \
2204 else if (cname ==
"int8")
2206 else if (cname ==
"int16")
2208 else if (cname ==
"int32")
2210 else if (cname ==
"int64")
2212 else if (cname ==
"uint8")
2214 else if (cname ==
"uint16")
2216 else if (cname ==
"uint32")
2218 else if (cname ==
"uint64")
2240 for (
int i = 0; i < nel; i++)
2267 std::size_t classlen = tc.
class_name ().length ();
2269 ret += 8 +
PAD (classlen > max_namelen ? max_namelen : classlen);
2272 for (
auto i =
m.begin (); i !=
m.end (); i++)
2275 ret += 16 + fieldcnt * (max_namelen + 1);
2279 for (
auto i =
m.begin (); i !=
m.end (); i++)
2281 const Cell elts =
m.contents (i);
2299 int tmp =
sizeof (int32_t);
2304 tmp_idx[i] = idx[i];
2313 "save: skipping %s: dimension too large for MAT format",
2323 bool mark_global,
bool mat7_format,
2324 bool save_as_floats,
bool compressing)
2329 std::size_t max_namelen = 63;
2332 int nd = tc.
ndims ();
2337 for (
int i = 0; i < nd; i++)
2339 if (dv(i) > max_dim_val)
2364 if (nnz > max_dim_val || nc + 1 > max_dim_val)
2372 else if (dv.
numel () > max_dim_val)
2378 #if defined (HAVE_ZLIB)
2380 if (mat7_format && ! compressing)
2384 std::ostringstream buf;
2389 save_as_floats,
true);
2395 std::string buf_str = buf.str ();
2396 uLongf srcLen = buf_str.length ();
2397 uLongf destLen = compressBound (srcLen);
2400 if (compress (
reinterpret_cast<Bytef *
> (out_buf), &destLen,
2401 reinterpret_cast<const Bytef *
> (buf_str.c_str ()),
2404 error (
"save: error compressing data element");
2409 os.write (out_buf, destLen);
2417 octave_unused_parameter (compressing);
2422 (tc, name, save_as_floats, mat7_format));
2438 else if (cname ==
"int8")
2440 else if (cname ==
"int16")
2442 else if (cname ==
"int32")
2444 else if (cname ==
"int64")
2446 else if (cname ==
"uint8" || tc.
islogical ())
2448 else if (cname ==
"uint16")
2450 else if (cname ==
"uint32")
2452 else if (cname ==
"uint64")
2474 error (
"save: error while writing '%s' to MAT file", name.c_str ());
2477 os.write (
reinterpret_cast<char *
> (&flags), 4);
2482 os.write (
reinterpret_cast<char *
> (&nnz_32), 4);
2489 std::size_t n16_str;
2490 bool conv_u16 =
false;
2503 os.write (
reinterpret_cast<char *
> (&
n), 4);
2504 os.write (
reinterpret_cast<char *
> (&n16_str), 4);
2507 for (
int i = 0; i < nd; i++)
2510 os.write (
reinterpret_cast<char *
> (&
n), 4);
2513 if (
PAD (dim_len) > dim_len)
2515 static char buf[9] =
"\x00\x00\x00\x00\x00\x00\x00\x00";
2516 os.write (buf,
PAD (dim_len) - dim_len);
2521 std::size_t namelen = name.length ();
2523 if (namelen > max_namelen)
2524 namelen = max_namelen;
2526 int paddedlength =
PAD (namelen);
2530 memset (paddedname, 0, paddedlength);
2531 strncpy (paddedname, name.c_str (), namelen);
2532 os.write (paddedname, paddedlength);
2545 paddedlength =
PAD (
len);
2549 os.write (
reinterpret_cast<char *
> (u16_str),
len);
2557 paddedlength =
PAD (
len);
2564 if (paddedlength >
len)
2566 static char padbuf[9] =
"\x00\x00\x00\x00\x00\x00\x00\x00";
2567 os.write (padbuf, paddedlength -
len);
2606 for (
int i = 0; i < nnz; i++)
2607 buf (i) =
m.data (i);
2612 else if (cname ==
"int8")
2618 else if (cname ==
"int16")
2624 else if (cname ==
"int32")
2630 else if (cname ==
"int64")
2636 else if (cname ==
"uint8")
2642 else if (cname ==
"uint16")
2648 else if (cname ==
"uint32")
2654 else if (cname ==
"uint64")
2686 error (
"save: error while writing '%s' to MAT file", name.c_str ());
2711 std::size_t namelen = classname.length ();
2713 if (namelen > max_namelen)
2714 namelen = max_namelen;
2716 int paddedlength =
PAD (namelen);
2720 memset (paddedname, 0, paddedlength);
2721 strncpy (paddedname, classname.c_str (), namelen);
2722 os.write (paddedname, paddedlength);
2730 && lp.find_method (tc.
class_name (),
"saveobj") !=
"")
2736 m = tmp(0).map_value ();
2738 catch (
const octave::execution_exception&)
2740 error (
"save: error while writing '%s' to MAT file",
2751 int32_t maxfieldnamelength = max_namelen + 1;
2756 os.write (
reinterpret_cast<char *
> (&maxfieldnamelength), 4);
2765 std::string key = keys(i);
2768 memset (buf, 0, max_namelen + 1);
2770 strncpy (buf, key.c_str (), max_namelen);
2771 os.write (buf, max_namelen + 1);
2778 std::vector<const octave_value *> elts (nf);
2780 elts[i] =
m.contents (keys(i)).data ();
2795 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)
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API bool isvector(void) const
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
OCTARRAY_OVERRIDABLE_FUNC_API const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
OCTARRAY_OVERRIDABLE_FUNC_API int ndims(void) const
Size of the specified dimension.
octave_idx_type * cidx(void)
octave_idx_type * ridx(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 bool reconstruct_parents(void)
OCTINTERP_API bool reconstruct_exemplar(void)
octave_value fcn_val(void)
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
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
OCTINTERP_API octave_fcn_handle * fcn_handle_value(bool silent=false) 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)
std::string octave_exec_home(void)
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)
interpreter & __get_interpreter__(void)
load_path & __get_load_path__(void)
bool too_large_for_float(double x)
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 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)
static uint16_t * maybe_convert_to_u16(const charNDArray &chm, std::size_t &n16_str)
#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)
save_type get_save_type(double, double)
float_format native_float_format(void)
@ flt_fmt_ieee_big_endian
@ flt_fmt_ieee_little_endian
class OCTAVE_API charMatrix
class OCTAVE_API SparseMatrix
class OCTAVE_API SparseComplexMatrix
std::complex< double > Complex
std::complex< float > FloatComplex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
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)
octave_value_list feval(const char *name, const octave_value_list &args, int nargout)
Evaluate an Octave function (built-in or interpreted) and return the list of result values.
return octave_value(v1.char_array_value() . concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string()) ? '\'' :'"'))
static std::string dir_sep_chars
uint8_t * octave_u16_to_u8_wrapper(const uint16_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_u32_to_u8_wrapper(const uint32_t *src, size_t src_len, uint8_t *result_buf, size_t *lengthp)
static string_vector make_absolute(const string_vector &sv)