GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ls-mat5.cc File Reference
#include <cstring>
#include <iomanip>
#include <istream>
#include <limits>
#include <ostream>
#include <sstream>
#include <string>
#include <vector>
#include "byte-swap.h"
#include "dMatrix.h"
#include "data-conv.h"
#include "file-ops.h"
#include "file-stat.h"
#include "glob-match.h"
#include "lo-mappers.h"
#include "lo-sysdep.h"
#include "mach-info.h"
#include "oct-env.h"
#include "oct-locbuf.h"
#include "oct-time.h"
#include "quit.h"
#include "str-vec.h"
#include "unistr-wrappers.h"
#include "Cell.h"
#include "defaults.h"
#include "defun.h"
#include "error.h"
#include "errwarn.h"
#include "interpreter-private.h"
#include "interpreter.h"
#include "load-path.h"
#include "load-save.h"
#include "ls-mat5.h"
#include "ls-utils.h"
#include "oct-map.h"
#include "ov-cell.h"
#include "ov-class.h"
#include "ov.h"
#include "ovl.h"
#include "pager.h"
#include "parse.h"
#include "pt-eval.h"
#include "stack-frame.h"
#include "sysdep.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
#include "version.h"
#include <zlib.h>

Go to the source code of this file.

Macros

#define INT8(l)   ((l) == miINT8 || (l) == miUINT8 || (l) == miUTF8)
 
#define INT_LEN(nel, size)
 
#define MAT5_DO_WRITE(TYPE, data, count, stream)
 
#define OCTAVE_MAT5_INTEGER_READ(TYP)
 
#define PAD(l)   (((l) > 0 && (l) <= 4) ? 4 : (((l)+7)/8)*8)
 
#define READ_INTEGER_DATA(TYPE, swap, data, size, len, stream)
 
#define READ_PAD(is_small_data_element, l)   ((is_small_data_element) ? 4 : (((l)+7)/8)*8)
 

Enumerations

enum  arrayclasstype {
  MAT_FILE_CELL_CLASS =1 , MAT_FILE_STRUCT_CLASS , MAT_FILE_OBJECT_CLASS , MAT_FILE_CHAR_CLASS ,
  MAT_FILE_SPARSE_CLASS , MAT_FILE_DOUBLE_CLASS , MAT_FILE_SINGLE_CLASS , MAT_FILE_INT8_CLASS ,
  MAT_FILE_UINT8_CLASS , MAT_FILE_INT16_CLASS , MAT_FILE_UINT16_CLASS , MAT_FILE_INT32_CLASS ,
  MAT_FILE_UINT32_CLASS , MAT_FILE_INT64_CLASS , MAT_FILE_UINT64_CLASS , MAT_FILE_FUNCTION_CLASS ,
  MAT_FILE_WORKSPACE_CLASS
}
 

Functions

std::string read_mat5_binary_element (std::istream &is, const std::string &filename, bool swap, bool &global, octave_value &tc)
 
int read_mat5_binary_file_header (std::istream &is, bool &swap, bool quiet, const std::string &filename)
 
template void read_mat5_integer_data (std::istream &is, int *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template void read_mat5_integer_data (std::istream &is, octave_int16 *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template void read_mat5_integer_data (std::istream &is, octave_int32 *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template void read_mat5_integer_data (std::istream &is, octave_int64 *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template void read_mat5_integer_data (std::istream &is, octave_int8 *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template void read_mat5_integer_data (std::istream &is, octave_uint16 *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template void read_mat5_integer_data (std::istream &is, octave_uint32 *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template void read_mat5_integer_data (std::istream &is, octave_uint64 *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template void read_mat5_integer_data (std::istream &is, octave_uint8 *m, octave_idx_type count, bool swap, mat5_data_type type)
 
template<typename T >
void read_mat5_integer_data (std::istream &is, T *m, octave_idx_type count, bool swap, mat5_data_type type)
 
int save_mat5_array_length (const Complex *val, octave_idx_type nel, bool save_as_floats)
 
int save_mat5_array_length (const double *val, octave_idx_type nel, bool save_as_floats)
 
int save_mat5_array_length (const float *, octave_idx_type nel, bool)
 
int save_mat5_array_length (const FloatComplex *val, octave_idx_type nel, bool save_as_floats)
 
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)
 
int save_mat5_element_length (const octave_value &tc, const std::string &name, bool save_as_floats, bool mat7_format)
 
template void write_mat5_integer_data (std::ostream &os, const int *m, int size, octave_idx_type nel)
 
template void write_mat5_integer_data (std::ostream &os, const octave_int16 *m, int size, octave_idx_type nel)
 
template void write_mat5_integer_data (std::ostream &os, const octave_int32 *m, int size, octave_idx_type nel)
 
template void write_mat5_integer_data (std::ostream &os, const octave_int64 *m, int size, octave_idx_type nel)
 
template void write_mat5_integer_data (std::ostream &os, const octave_int8 *m, int size, octave_idx_type nel)
 
template void write_mat5_integer_data (std::ostream &os, const octave_uint16 *m, int size, octave_idx_type nel)
 
template void write_mat5_integer_data (std::ostream &os, const octave_uint32 *m, int size, octave_idx_type nel)
 
template void write_mat5_integer_data (std::ostream &os, const octave_uint64 *m, int size, octave_idx_type nel)
 
template void write_mat5_integer_data (std::ostream &os, const octave_uint8 *m, int size, octave_idx_type nel)
 
template<typename T >
void write_mat5_integer_data (std::ostream &os, const T *m, int size, octave_idx_type nel)
 

Macro Definition Documentation

◆ INT8

#define INT8 (   l)    ((l) == miINT8 || (l) == miUINT8 || (l) == miUTF8)

Definition at line 88 of file ls-mat5.cc.

◆ INT_LEN

#define INT_LEN (   nel,
  size 
)
Value:
{ \
ret += 8; \
octave_idx_type sz = nel * size; \
if (sz > 4) \
ret += PAD (sz); \
}
#define PAD(l)
Definition ls-mat5.cc:87

◆ MAT5_DO_WRITE

#define MAT5_DO_WRITE (   TYPE,
  data,
  count,
  stream 
)
Value:
do \
{ \
OCTAVE_LOCAL_BUFFER (TYPE, ptr, count); \
for (octave_idx_type i = 0; i < count; i++) \
ptr[i] = static_cast<TYPE> (data[i]); \
std::streamsize n_bytes = sizeof (TYPE) * static_cast<std::streamsize> (count); \
stream.write (reinterpret_cast<char *> (ptr), n_bytes); \
} \
while (0)
octave_idx_type write(const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)

Definition at line 1637 of file ls-mat5.cc.

◆ OCTAVE_MAT5_INTEGER_READ

#define OCTAVE_MAT5_INTEGER_READ (   TYP)

Definition at line 374 of file ls-mat5.cc.

◆ PAD

#define PAD (   l)    (((l) > 0 && (l) <= 4) ? 4 : (((l)+7)/8)*8)

Definition at line 87 of file ls-mat5.cc.

◆ READ_INTEGER_DATA

#define READ_INTEGER_DATA (   TYPE,
  swap,
  data,
  size,
  len,
  stream 
)
Value:
do \
{ \
if (len > 0) \
{ \
OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
std::streamsize n_bytes = size * static_cast<std::streamsize> (len); \
stream.read (reinterpret_cast<char *> (ptr), n_bytes); \
if (swap) \
swap_bytes< size > (ptr, len); \
for (octave_idx_type i = 0; i < len; i++) \
data[i] = ptr[i]; \
} \
} \
while (0)
octave_value read(const Array< double > &size, octave_idx_type block_size, oct_data_conv::data_type input_type, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt, octave_idx_type &count)
F77_RET_T len
Definition xerbla.cc:61

◆ READ_PAD

#define READ_PAD (   is_small_data_element,
 
)    ((is_small_data_element) ? 4 : (((l)+7)/8)*8)

Definition at line 86 of file ls-mat5.cc.

Enumeration Type Documentation

◆ arrayclasstype

Enumerator
MAT_FILE_CELL_CLASS 
MAT_FILE_STRUCT_CLASS 
MAT_FILE_OBJECT_CLASS 
MAT_FILE_CHAR_CLASS 
MAT_FILE_SPARSE_CLASS 
MAT_FILE_DOUBLE_CLASS 
MAT_FILE_SINGLE_CLASS 
MAT_FILE_INT8_CLASS 
MAT_FILE_UINT8_CLASS 
MAT_FILE_INT16_CLASS 
MAT_FILE_UINT16_CLASS 
MAT_FILE_INT32_CLASS 
MAT_FILE_UINT32_CLASS 
MAT_FILE_INT64_CLASS 
MAT_FILE_UINT64_CLASS 
MAT_FILE_FUNCTION_CLASS 
MAT_FILE_WORKSPACE_CLASS 

Definition at line 101 of file ls-mat5.cc.

Function Documentation

◆ read_mat5_binary_element()

std::string read_mat5_binary_element ( std::istream &  is,
const std::string &  filename,
bool  swap,
bool global,
octave_value tc 
)

Definition at line 479 of file ls-mat5.cc.

References octave_map::assign(), octave_scalar_map::begin(), octave_value::cell_value(), Sparse< T, Alloc >::cidx(), Array< T, Alloc >::clear(), octave_scalar_map::contents(), octave_value::convert_to_str(), Sparse< T, Alloc >::data(), Array< T, Alloc >::data(), octave_scalar_map::end(), err_disabled_feature(), error(), octave_value::fcn_handle_value(), octave_fcn_handle::fcn_val(), free(), imag(), INT8, octave_value::is_defined(), octave_value::isempty(), Array< T, Alloc >::isvector(), octave_scalar_map::key(), len, MAT_FILE_CELL_CLASS, MAT_FILE_CHAR_CLASS, MAT_FILE_DOUBLE_CLASS, MAT_FILE_FUNCTION_CLASS, MAT_FILE_INT16_CLASS, MAT_FILE_INT32_CLASS, MAT_FILE_INT64_CLASS, MAT_FILE_INT8_CLASS, MAT_FILE_OBJECT_CLASS, MAT_FILE_SINGLE_CLASS, MAT_FILE_SPARSE_CLASS, MAT_FILE_STRUCT_CLASS, MAT_FILE_UINT16_CLASS, MAT_FILE_UINT32_CLASS, MAT_FILE_UINT64_CLASS, MAT_FILE_UINT8_CLASS, MAT_FILE_WORKSPACE_CLASS, miCOMPRESSED, miINT32, miMATRIX, miUINT16, miUINT32, miUINT8, miUTF16, miUTF32, miUTF8, octave_scalar_map::nfields(), Array< T, Alloc >::numel(), dim_vector::numel(), OCTAVE_LOCAL_BUFFER, OCTAVE_MAT5_INTEGER_READ, octave_u16_to_u8_wrapper(), octave_u32_to_u8_wrapper(), read_int(), read_mat5_binary_element(), read_mat5_integer_data(), READ_PAD, octave_class::reconstruct_exemplar(), octave_class::reconstruct_parents(), dim_vector::resize(), Sparse< T, Alloc >::ridx(), Array< T, Alloc >::rwdata(), octave_value::scalar_map_value(), octave_value::string_value(), swap_bytes< 4 >(), octave_value::uint32_array_value(), octave_value::uint8_array_value(), warning_with_id(), and Sparse< T, Alloc >::xdata().

Referenced by load_save_system::load_vars(), read_mat5_binary_element(), and read_mat5_binary_file_header().

◆ read_mat5_binary_file_header()

int read_mat5_binary_file_header ( std::istream &  is,
bool swap,
bool  quiet,
const std::string &  filename 
)

◆ read_mat5_integer_data() [1/10]

template void read_mat5_integer_data ( std::istream &  is,
int m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [2/10]

template void read_mat5_integer_data ( std::istream &  is,
octave_int16 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [3/10]

template void read_mat5_integer_data ( std::istream &  is,
octave_int32 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [4/10]

template void read_mat5_integer_data ( std::istream &  is,
octave_int64 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [5/10]

template void read_mat5_integer_data ( std::istream &  is,
octave_int8 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [6/10]

template void read_mat5_integer_data ( std::istream &  is,
octave_uint16 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [7/10]

template void read_mat5_integer_data ( std::istream &  is,
octave_uint32 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [8/10]

template void read_mat5_integer_data ( std::istream &  is,
octave_uint64 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [9/10]

template void read_mat5_integer_data ( std::istream &  is,
octave_uint8 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ read_mat5_integer_data() [10/10]

template<typename T >
void read_mat5_integer_data ( std::istream &  is,
T *  m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)

◆ save_mat5_array_length() [1/4]

int save_mat5_array_length ( const Complex val,
octave_idx_type  nel,
bool  save_as_floats 
)

Definition at line 2072 of file ls-mat5.cc.

References OCTAVE_LOCAL_BUFFER, and save_mat5_array_length().

◆ save_mat5_array_length() [2/4]

int save_mat5_array_length ( const double val,
octave_idx_type  nel,
bool  save_as_floats 
)

◆ save_mat5_array_length() [3/4]

int save_mat5_array_length ( const float ,
octave_idx_type  nel,
bool   
)

Definition at line 2016 of file ls-mat5.cc.

References PAD.

◆ save_mat5_array_length() [4/4]

int save_mat5_array_length ( const FloatComplex val,
octave_idx_type  nel,
bool  save_as_floats 
)

Definition at line 2093 of file ls-mat5.cc.

References OCTAVE_LOCAL_BUFFER, and save_mat5_array_length().

◆ save_mat5_binary_element()

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 
)

Definition at line 2321 of file ls-mat5.cc.

References octave_value::array_value(), octave_value::bool_array_value(), octave_value::cell_value(), octave_value::char_array_value(), Sparse< T, Alloc >::cidx(), octave_value::class_name(), Sparse< T, Alloc >::cols(), octave_value::complex_array_value(), octave_map::contents(), Sparse< T, Alloc >::data(), Array< T, Alloc >::data(), octave_value::dims(), error(), octave_value::float_array_value(), octave_value::float_complex_array_value(), free(), imag(), octave_value::int16_array_value(), octave_value::int32_array_value(), octave_value::int64_array_value(), octave_value::int8_array_value(), octave_value::is_complex_matrix(), octave_value::is_complex_scalar(), octave_value::is_inline_function(), octave_value::is_range(), octave_value::is_real_matrix(), octave_value::is_real_scalar(), octave_value::is_single_type(), octave_value::is_string(), octave_value::iscell(), octave_value::iscomplex(), octave_value::islogical(), octave_value::isobject(), octave_value::issparse(), octave_value::isstruct(), octave_map::keys(), len, octave_value::map_value(), MAT_FILE_CELL_CLASS, MAT_FILE_CHAR_CLASS, MAT_FILE_DOUBLE_CLASS, MAT_FILE_INT16_CLASS, MAT_FILE_INT32_CLASS, MAT_FILE_INT64_CLASS, MAT_FILE_INT8_CLASS, MAT_FILE_OBJECT_CLASS, MAT_FILE_SINGLE_CLASS, MAT_FILE_SPARSE_CLASS, MAT_FILE_STRUCT_CLASS, MAT_FILE_UINT16_CLASS, MAT_FILE_UINT32_CLASS, MAT_FILE_UINT64_CLASS, MAT_FILE_UINT8_CLASS, miCOMPRESSED, miINT32, miINT8, miMATRIX, miUINT32, miUTF16, miUTF8, octave_value::ndims(), octave_map::nfields(), Sparse< T, Alloc >::nnz(), octave_map::numel(), Array< T, Alloc >::numel(), dim_vector::numel(), Sparse< T, Alloc >::nzmax(), OCTAVE_LOCAL_BUFFER, PAD, real(), Sparse< T, Alloc >::ridx(), save_mat5_binary_element(), save_mat5_element_length(), octave_value::sparse_complex_matrix_value(), octave_value::sparse_matrix_value(), octave_value::uint16_array_value(), octave_value::uint32_array_value(), octave_value::uint64_array_value(), octave_value::uint8_array_value(), warn_wrong_type_arg(), and write_mat5_integer_data().

Referenced by save_mat5_binary_element().

◆ save_mat5_element_length()

int save_mat5_element_length ( const octave_value tc,
const std::string &  name,
bool  save_as_floats,
bool  mat7_format 
)

Definition at line 2132 of file ls-mat5.cc.

References octave_value::array_value(), octave_map::begin(), octave_value::bool_array_value(), octave_value::cell_value(), octave_value::char_array_value(), octave_value::class_name(), Sparse< T, Alloc >::cols(), octave_value::complex_array_value(), octave_map::contents(), Sparse< T, Alloc >::data(), Array< T, Alloc >::data(), octave_map::end(), octave_value::float_array_value(), octave_value::float_complex_array_value(), free(), octave_value::int16_array_value(), octave_value::int32_array_value(), octave_value::int64_array_value(), octave_value::int8_array_value(), INT_LEN, octave_value::is_complex_matrix(), octave_value::is_complex_scalar(), octave_value::is_inline_function(), octave_value::is_range(), octave_value::is_real_matrix(), octave_value::is_real_scalar(), octave_value::is_single_type(), octave_value::is_string(), octave_value::iscell(), octave_value::iscomplex(), octave_value::islogical(), octave_value::isobject(), octave_value::issparse(), octave_value::isstruct(), len, octave_value::map_value(), octave_value::ndims(), Sparse< T, Alloc >::nnz(), octave_map::numel(), Array< T, Alloc >::numel(), PAD, save_mat5_array_length(), save_mat5_element_length(), octave_value::sparse_complex_matrix_value(), octave_value::sparse_matrix_value(), octave_value::uint16_array_value(), octave_value::uint32_array_value(), octave_value::uint64_array_value(), and octave_value::uint8_array_value().

Referenced by save_mat5_binary_element(), and save_mat5_element_length().

◆ write_mat5_integer_data() [1/10]

template void write_mat5_integer_data ( std::ostream &  os,
const int m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [2/10]

template void write_mat5_integer_data ( std::ostream &  os,
const octave_int16 m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [3/10]

template void write_mat5_integer_data ( std::ostream &  os,
const octave_int32 m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [4/10]

template void write_mat5_integer_data ( std::ostream &  os,
const octave_int64 m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [5/10]

template void write_mat5_integer_data ( std::ostream &  os,
const octave_int8 m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [6/10]

template void write_mat5_integer_data ( std::ostream &  os,
const octave_uint16 m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [7/10]

template void write_mat5_integer_data ( std::ostream &  os,
const octave_uint32 m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [8/10]

template void write_mat5_integer_data ( std::ostream &  os,
const octave_uint64 m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [9/10]

template void write_mat5_integer_data ( std::ostream &  os,
const octave_uint8 m,
int  size,
octave_idx_type  nel 
)

◆ write_mat5_integer_data() [10/10]

template<typename T >
void write_mat5_integer_data ( std::ostream &  os,
const T *  m,
int  size,
octave_idx_type  nel 
)

Definition at line 1833 of file ls-mat5.cc.

References len, miINT16, miINT32, miINT64, miINT8, miUINT16, miUINT32, miUINT64, miUINT8, and PAD.

Referenced by save_mat5_binary_element().