23 #if defined (HAVE_CONFIG_H)
113 int32_t& nr, int32_t& nc,
114 int32_t&
imag, int32_t& len,
123 is.read (reinterpret_cast<char *> (&mopt), 4);
127 if (! is.read (reinterpret_cast<char *> (&nr), 4))
130 if (! is.read (reinterpret_cast<char *> (&nc), 4))
133 if (! is.read (reinterpret_cast<char *> (&imag), 4))
136 if (! is.read (reinterpret_cast<char *> (&len), 4))
153 if (mopt > 9999 || mopt < 0)
165 if (mopt > 9999 || mopt < 0 || imag > 1 || imag < 0)
168 error (
"load: can't read binary file");
244 int32_t mopt, nr, nc,
imag, len;
250 error (
"load: trouble reading binary file '%s'", filename.c_str ());
272 error (
"load: unrecognized binary format!");
274 if (imag && type == 1)
275 error (
"load: encountered complex matrix with string flag set!");
286 if (! is.read (
name, len))
287 error (
"load: trouble reading binary file '%s'", filename.c_str ());
292 error (
"load: trouble reading binary file '%s'", filename.c_str ());
315 nr_new = dtmp[nr - 1];
319 nc_new = dtmp[nr - 1];
344 nr_new = dtmp[nr - 1];
348 nc_new = dtmp[nr - 1];
365 error (
"load: reading matrix data for '%s'",
name);
375 error (
"load: reading imaginary matrix data for '%s'",
name);
412 os.write (reinterpret_cast<char *> (&mopt), 4);
415 int32_t nr = tc.
rows ();
422 uint32_t nnz = len + 1;
423 os.write (reinterpret_cast<char *> (&nnz), 4);
426 os.write (reinterpret_cast<char *> (&iscmplx), 4);
429 os.write (reinterpret_cast<char *> (&tmp), 4);
433 os.write (reinterpret_cast<char *> (&nr), 4);
434 os.write (reinterpret_cast<char *> (&nc), 4);
437 os.write (reinterpret_cast<char *> (&imag), 4);
445 int32_t name_len = name.length () + 1;
447 os.write (reinterpret_cast<char *> (&name_len), 4);
464 const char *
s = tstr.data ();
467 buf[j*nrow+
i] = static_cast<double> (*s++ & 0x00FF);
469 std::streamsize n_bytes =
static_cast<std::streamsize
> (nrow) *
470 static_cast<std::streamsize> (ncol) *
472 os.write (reinterpret_cast<char *> (buf), n_bytes);
477 double base = r.
base ();
478 double inc = r.
inc ();
482 double x = base +
i * inc;
483 os.write (reinterpret_cast<char *> (&x), 8);
489 os.write (reinterpret_cast<char *> (&tmp), 8);
501 std::streamsize n_bytes = 8 *
static_cast<std::streamsize
> (len);
502 os.write (reinterpret_cast<const char *> (dtmp), n_bytes);
504 os.write (reinterpret_cast<const char *> (&ds), 8);
510 os.write (reinterpret_cast<const char *> (dtmp), n_bytes);
512 os.write (reinterpret_cast<const char *> (&ds), 8);
516 os.write (reinterpret_cast<const char *> (dtmp), n_bytes);
518 os.write (reinterpret_cast<const char *> (&ds), 8);
522 os.write (reinterpret_cast<const char *> (dtmp), n_bytes);
523 os.write (reinterpret_cast<const char *> (&ds), 8);
531 std::streamsize n_bytes = 8 *
static_cast<std::streamsize
> (len);
532 os.write (reinterpret_cast<const char *> (dtmp), n_bytes);
534 os.write (reinterpret_cast<const char *> (&ds), 8);
540 os.write (reinterpret_cast<const char *> (dtmp), n_bytes);
542 os.write (reinterpret_cast<const char *> (&ds), 8);
544 os.write (reinterpret_cast<const char *> (m.
data ()), n_bytes);
546 os.write (reinterpret_cast<const char *> (&ds), 8);
552 std::streamsize n_bytes = 8 *
static_cast<std::streamsize
> (len);
553 os.write (reinterpret_cast<const char *> (m.
data ()), n_bytes);
558 os.write (reinterpret_cast<char *> (&tmp), 16);
564 std::streamsize n_bytes = 8 *
static_cast<std::streamsize
> (len);
565 os.write (reinterpret_cast<const char *> (m.
data ()), n_bytes);
567 os.write (reinterpret_cast<const char *> (m.
data ()), n_bytes);
octave_idx_type nnz(void) const
bool is_range(void) const
octave_idx_type rows(void) const
SparseMatrix transpose(void) const
bool is_complex_scalar(void) const
void error(const char *fmt,...)
octave::mach_info::float_format flt_fmt
octave_idx_type * cidx(void)
std::string row_as_string(octave_idx_type, bool strip_ws=false) const
octave_idx_type rows(void) const
SparseComplexMatrix transpose(void) const
int read_mat_file_header(std::istream &is, bool &swap, int32_t &mopt, int32_t &nr, int32_t &nc, int32_t &imag, int32_t &len, int quiet)
octave_idx_type columns(void) const
void swap_bytes< 4 >(void *ptr)
static bool words_big_endian(void)
octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
bool is_complex_matrix(void) const
bool is_sparse_type(void) const
int float_format_to_mopt_digit(octave::mach_info::float_format flt_fmt)
bool is_real_scalar(void) const
void read_doubles(std::istream &is, double *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
nd deftypefn *octave_map m
Range range_value(void) const
bool is_string(void) const
octave_idx_type numel(void) const
const T * data(void) const
bool is_complex_type(void) const
Matrix transpose(void) const
ComplexMatrix transpose(void) const
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
SparseComplexMatrix sparse_complex_matrix_value(bool frc_str_conv=false) const
Matrix matrix_value(bool frc_str_conv=false) const
charMatrix char_matrix_value(bool frc_str_conv=false) const
T & xelem(octave_idx_type n)
octave::mach_info::float_format mopt_digit_to_float_format(int mach)
static float_format native_float_format(void)
octave::unwind_protect frame
octave_idx_type * ridx(void)
=val(i)}if ode{val(i)}occurs in table i
ComplexMatrix complex_matrix_value(bool frc_str_conv=false) const
bool save_mat_binary_data(std::ostream &os, const octave_value &tc, const std::string &name)
Complex complex_value(bool frc_str_conv=false) const
issues an error eealso double
void warn_wrong_type_arg(const char *name, const octave_value &tc)
static void read_mat_binary_data(std::istream &is, double *data, int precision, int len, bool swap, octave::mach_info::float_format flt_fmt)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
ColumnVector imag(const ComplexColumnVector &a)
OCTAVE_EXPORT octave_value_list error nd deftypefn *const octave_scalar_map err
SparseMatrix sparse_matrix_value(bool frc_str_conv=false) const
std::complex< double > Complex
const T * fortran_vec(void) const
ColumnVector real(const ComplexColumnVector &a)
double double_value(bool frc_str_conv=false) const
octave_idx_type cols(void) const
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
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
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
bool is_real_matrix(void) const