Defines | Enumerations | Functions | Variables

ls-mat5.cc File Reference

#include <cfloat>
#include <cstring>
#include <cctype>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "byte-swap.h"
#include "data-conv.h"
#include "file-ops.h"
#include "glob-match.h"
#include "lo-mappers.h"
#include "mach-info.h"
#include "oct-env.h"
#include "oct-time.h"
#include "quit.h"
#include "str-vec.h"
#include "file-stat.h"
#include "oct-locbuf.h"
#include "Cell.h"
#include "defun.h"
#include "error.h"
#include "gripes.h"
#include "load-save.h"
#include "load-path.h"
#include "oct-obj.h"
#include "oct-map.h"
#include "ov-cell.h"
#include "ov-class.h"
#include "ov-fcn-inline.h"
#include "pager.h"
#include "pt-exp.h"
#include "sysdep.h"
#include "toplev.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
#include "version.h"
#include "dMatrix.h"
#include "ls-utils.h"
#include "ls-mat5.h"
#include "parse.h"
#include "defaults.h"
Include dependency graph for ls-mat5.cc:

Go to the source code of this file.

Defines

#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)

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

static void gripe_dim_too_large (const std::string &name)
static void read_int (std::istream &is, bool swap, int32_t &val)
static void read_mat5_binary_data (std::istream &is, float *data, octave_idx_type count, bool swap, mat5_data_type type, oct_mach_info::float_format flt_fmt)
static void read_mat5_binary_data (std::istream &is, double *data, octave_idx_type count, bool swap, mat5_data_type type, oct_mach_info::float_format flt_fmt)
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, octave_int8 *m, octave_idx_type count, bool swap, mat5_data_type type)
template void read_mat5_integer_data (std::istream &is, int *m, octave_idx_type count, bool swap, mat5_data_type type)
template<class T >
void read_mat5_integer_data (std::istream &is, T *m, octave_idx_type count, bool swap, mat5_data_type type)
static int read_mat5_tag (std::istream &is, bool swap, int32_t &type, int32_t &bytes)
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)
bool save_mat5_binary_element (std::ostream &os, const octave_value &tc, const std::string &name, bool mark_as_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)
static void write_mat5_array (std::ostream &os, const NDArray &m, bool save_as_floats)
static void write_mat5_array (std::ostream &os, const FloatNDArray &m, bool)
static bool write_mat5_cell_array (std::ostream &os, const Cell &cell, bool mark_as_global, bool save_as_floats)
template void write_mat5_integer_data (std::ostream &os, const octave_int8 *m, int size, octave_idx_type nel)
template<class T >
void write_mat5_integer_data (std::ostream &os, const T *m, int size, octave_idx_type nel)
template void write_mat5_integer_data (std::ostream &os, const int *m, int size, octave_idx_type nel)
static void write_mat5_sparse_index_vector (std::ostream &os, const octave_idx_type *idx, octave_idx_type nel)
static int write_mat5_tag (std::ostream &is, int type, octave_idx_type bytes)

Variables

static octave_value subsys_ov

Define Documentation

#define INT_LEN (   nel,
  size 
)
Value:
{ \
    ret += 8; \
    octave_idx_type sz = nel * size; \
    if (sz > 4) \
      ret += PAD (sz);  \
  }

Referenced by save_mat5_element_length().

#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]); \
      stream.write (reinterpret_cast<char *> (ptr), count * sizeof (TYPE)); \
    } \
  while (0)

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

Referenced by write_mat5_array().

#define OCTAVE_MAT5_INTEGER_READ (   TYP  ) 

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

Referenced by read_mat5_binary_element().

#define PAD (   l  )     (((l) > 0 && (l) <= 4) ? 4 : (((l)+7)/8)*8)
#define READ_INTEGER_DATA (   TYPE,
  swap,
  data,
  size,
  len,
  stream 
)
Value:
do \
    { \
      if (len > 0) \
        { \
          OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
          stream.read (reinterpret_cast<char *> (ptr), size * len); \
          if (swap) \
            swap_bytes< size > (ptr, len); \
          for (octave_idx_type i = 0; i < len; i++) \
            data[i] = ptr[i]; \
        } \
    } \
  while (0)

Referenced by read_mat5_integer_data().


Enumeration Type Documentation

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 97 of file ls-mat5.cc.


Function Documentation

static void gripe_dim_too_large ( const std::string &  name  )  [static]

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

References warning().

Referenced by save_mat5_binary_element().

static void read_int ( std::istream &  is,
bool  swap,
int32_t &  val 
) [static]

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

References swap_bytes< 4 >().

Referenced by read_mat5_binary_element().

static void read_mat5_binary_data ( std::istream &  is,
float data,
octave_idx_type  count,
bool  swap,
mat5_data_type  type,
oct_mach_info::float_format  flt_fmt 
) [static]
static void read_mat5_binary_data ( std::istream &  is,
double data,
octave_idx_type  count,
bool  swap,
mat5_data_type  type,
oct_mach_info::float_format  flt_fmt 
) [static]
std::string read_mat5_binary_element ( std::istream &  is,
const std::string &  filename,
bool  swap,
bool global,
octave_value tc 
)

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

References unwind_protect::add_fcn(), symbol_table::alloc_scope(), Octave_map::assign(), Octave_map::begin(), Sparse< T >::cidx(), Array< T >::clear(), Octave_map::contents(), octave_value::convert_to_str(), Sparse< T >::data(), file_ops::dir_sep_chars(), Octave_map::end(), symbol_table::erase_scope(), error(), error_state, eval_string(), base_file_stat::exists(), octave_value::fcn_handle_value(), octave_fcn_handle::fcn_val(), feval(), dir_path::find_first_of(), load_path::find_method(), oct_mach_info::flt_fmt_ieee_big_endian, Array< T >::fortran_vec(), Octave_map::key(), load_fcn_from_file(), octave_env::make_absolute(), make_fcn_handle(), octave_value::map_value(), 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, miINT8, miMATRIX, miUINT32, miUTF16, miUTF32, miUTF8, names(), NDArray, Octave_map::nfields(), dim_vector::numel(), Array< T >::numel(), OCTAVE_LOCAL_BUFFER, OCTAVE_MAT5_INTEGER_READ, octave_value(), PAD, octave_call_stack::pop(), octave_call_stack::push(), read_int(), read_mat5_binary_data(), read_mat5_binary_element(), read_mat5_integer_data(), read_mat5_tag(), octave_class::reconstruct_exemplar(), octave_class::reconstruct_parents(), dim_vector::resize(), Sparse< T >::ridx(), unwind_protect::run(), symbol_table::set_scope(), SparseComplexMatrix, swap_bytes< 4 >(), load_path::system_path(), octave_value::uint8_array_value(), symbol_table::varref(), warning(), and Sparse< T >::xdata().

Referenced by do_load(), read_mat5_binary_element(), and read_mat5_binary_file_header().

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,
octave_int8 m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)
template void read_mat5_integer_data ( std::istream &  is,
int m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)
template<class T >
void read_mat5_integer_data ( std::istream &  is,
T *  m,
octave_idx_type  count,
bool  swap,
mat5_data_type  type 
)
static int read_mat5_tag ( std::istream &  is,
bool  swap,
int32_t &  type,
int32_t &  bytes 
) [static]

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

References swap_bytes< 4 >().

Referenced by read_mat5_binary_element().

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

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

References imag(), OCTAVE_LOCAL_BUFFER, real, and save_mat5_array_length().

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

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

References size(), xisinf(), and xisnan().

Referenced by save_mat5_array_length(), and save_mat5_element_length().

int save_mat5_array_length ( const float ,
octave_idx_type  nel,
bool   
)

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

References PAD, and size().

bool save_mat5_binary_element ( std::ostream &  os,
const octave_value tc,
const std::string &  name,
bool  mark_as_global,
bool  mat7_format,
bool  save_as_floats,
bool  compressing 
)

Definition at line 2279 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 >::cidx(), octave_value::class_name(), Sparse< T >::cols(), octave_value::complex_array_value(), Octave_map::contents(), Sparse< T >::data(), Array< T >::data(), octave_value::dims(), error(), error_state, feval(), load_path::find_method(), octave_value::float_array_value(), octave_value::float_complex_array_value(), Array< T >::fortran_vec(), gripe_dim_too_large(), gripe_wrong_type_arg(), imag(), octave_value::int16_array_value(), octave_value::int32_array_value(), octave_value::int64_array_value(), octave_value::int8_array_value(), octave_value::is_bool_type(), octave_value::is_cell(), octave_value::is_complex_matrix(), octave_value::is_complex_scalar(), octave_value::is_complex_type(), octave_value::is_inline_function(), octave_value::is_map(), octave_value::is_object(), octave_value::is_range(), octave_value::is_real_matrix(), octave_value::is_real_scalar(), octave_value::is_single_type(), octave_value::is_sparse_type(), octave_value::is_string(), Octave_map::keys(), octave_value::map_value(), MAT_FILE_CELL_CLASS, MAT_FILE_CHAR_CLASS, MAT_FILE_OBJECT_CLASS, MAT_FILE_SINGLE_CLASS, MAT_FILE_SPARSE_CLASS, MAT_FILE_STRUCT_CLASS, MAT_FILE_UINT8_CLASS, max(), miCOMPRESSED, miINT32, miINT8, miMATRIX, miUINT16, miUINT32, octave_value::ndims(), Octave_map::nfields(), Sparse< T >::nnz(), Octave_map::numel(), Array< T >::numel(), dim_vector::numel(), Sparse< T >::nzmax(), OCTAVE_LOCAL_BUFFER, PAD, real, Sparse< T >::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(), write_mat5_array(), write_mat5_cell_array(), write_mat5_integer_data(), write_mat5_sparse_index_vector(), and write_mat5_tag().

Referenced by do_save(), save_mat5_binary_element(), and write_mat5_cell_array().

int save_mat5_element_length ( const octave_value tc,
const std::string &  name,
bool  save_as_floats,
bool  mat7_format 
)
static void write_mat5_array ( std::ostream &  os,
const NDArray m,
bool  save_as_floats 
) [static]
static void write_mat5_array ( std::ostream &  os,
const FloatNDArray m,
bool   
) [static]
static bool write_mat5_cell_array ( std::ostream &  os,
const Cell cell,
bool  mark_as_global,
bool  save_as_floats 
) [static]

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

References Array< T >::numel(), and save_mat5_binary_element().

Referenced by save_mat5_binary_element().

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

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

References PAD, and write_mat5_tag().

Referenced by save_mat5_binary_element(), and write_mat5_sparse_index_vector().

template void write_mat5_integer_data ( std::ostream &  os,
const int m,
int  size,
octave_idx_type  nel 
)
static void write_mat5_sparse_index_vector ( std::ostream &  os,
const octave_idx_type idx,
octave_idx_type  nel 
) [static]

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

References OCTAVE_LOCAL_BUFFER, and write_mat5_integer_data().

Referenced by save_mat5_binary_element().

static int write_mat5_tag ( std::ostream &  is,
int  type,
octave_idx_type  bytes 
) [static]

Variable Documentation

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

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines