68 "float complex matrix",
"single");
95 if (! force_conversion)
97 "complex matrix",
"real scalar");
102 "complex matrix",
"real scalar");
117 if (! force_conversion)
119 "complex matrix",
"real scalar");
124 "complex matrix",
"real scalar");
139 if (! force_conversion)
141 "complex matrix",
"real matrix");
153 if (! force_conversion)
155 "complex matrix",
"real matrix");
172 "complex matrix",
"complex scalar");
192 "complex matrix",
"complex scalar");
220 ||
real (
matrix).any_element_not_one_or_zero ()))
233 "complex matrix",
"string");
257 if (! force_conversion)
259 "complex matrix",
"real matrix");
295 retval = mat.
diag (m, n);
298 error (
"diag: expecting vector argument");
311 os <<
"# ndims: " << d.
length () <<
"\n";
313 for (
int i = 0; i < d.
length (); i++)
322 os <<
"# rows: " <<
rows () <<
"\n"
323 <<
"# columns: " <<
columns () <<
"\n";
338 keywords[0] =
"ndims";
339 keywords[1] =
"rows";
348 int mdims =
static_cast<int> (val);
355 for (
int i = 0; i < mdims; i++)
368 error (
"load: failed to load matrix constant");
374 error (
"load: failed to read dimensions");
380 error (
"load: failed to extract number of dimensions");
384 else if (kw ==
"rows")
391 if (nr > 0 && nc > 0)
399 error (
"load: failed to load matrix constant");
403 else if (nr == 0 || nc == 0)
410 error (
"load: failed to extract number of rows and columns");
419 error (
"load: failed to extract number of rows and columns");
434 int32_t tmp = - d.
length ();
435 os.write (reinterpret_cast<char *> (&tmp), 4);
436 for (
int i = 0; i < d.
length (); i++)
439 os.write (reinterpret_cast<char *> (&tmp), 4);
444 if (d.
numel () > 4096)
446 float max_val, min_val;
463 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
474 for (
int i = 0; i < mdims; i++)
476 if (! is.read (reinterpret_cast<char *> (&di), 4))
495 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
501 static_cast<save_type> (tmp), 2 * dv.
numel (), swap, fmt);
510 if (! is.read (reinterpret_cast<char *> (&nc), 4))
514 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
520 static_cast<save_type> (tmp), 2*len, swap, fmt);
533 #if defined (HAVE_HDF5)
541 hid_t space_hid, data_hid, type_hid;
542 space_hid = data_hid = type_hid = -1;
548 for (
int i = 0; i < rank; i++)
549 hdims[i] = dv (rank-i-1);
551 space_hid = H5Screate_simple (rank, hdims, 0);
552 if (space_hid < 0)
return false;
554 hid_t save_type_hid = H5T_NATIVE_FLOAT;
556 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS
560 float max_val, min_val;
571 H5Sclose (space_hid);
575 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
576 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
578 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
582 H5Sclose (space_hid);
588 if (complex_type_hid < 0) retval =
false;
593 if (H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
596 H5Tclose (complex_type_hid);
601 H5Tclose (complex_type_hid);
604 H5Sclose (space_hid);
618 #if defined (HAVE_HDF5)
628 hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
630 hid_t data_hid = H5Dopen (loc_id, name);
632 hid_t type_hid = H5Dget_type (data_hid);
638 H5Tclose (complex_type);
643 hid_t space_id = H5Dget_space (data_hid);
645 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
649 H5Tclose (complex_type);
658 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
670 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
676 if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
683 H5Tclose (complex_type);
696 bool pr_as_read_syntax)
const
707 float *pr =
static_cast<float *
> (retval->
get_data ());
714 for (
mwIndex i = 0; i < nel; i++)
736 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
737 case umap_ ## UMAP: \
738 return octave_value (matrix.FCN ())
745 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
746 case umap_ ## UMAP: \
747 return octave_value (matrix.map<TYPE> (FCN))
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
bool hdf5_types_compatible(hid_t t1, hid_t t2)
void write_floats(std::ostream &os, const float *data, save_type type, octave_idx_type len)
FloatComplex float_complex_value(bool=false) const
boolNDArray bool_array_value(bool warn=false) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
charNDArray char_array_value(bool frc_str_conv=false) const
octave_idx_type columns(void) const
mxArray * as_mxArray(void) const
std::complex< double > erfi(std::complex< double > z, double relerr=0)
octave_idx_type numel(void) const
Number of elements in the array.
void gripe_load(const char *type) const
save_type get_save_type(double, double)
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
octave_idx_type numel(void) const
void resize(int n, int fill_value=0)
void error(const char *fmt,...)
ComplexMatrix complex_matrix_value(bool=false) const
void * get_data(void) const
octave_value diag(octave_idx_type k=0) const
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
void gripe_save(const char *type) const
T & elem(octave_idx_type n)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
double lo_ieee_nan_value(void)
octave_value map(unary_mapper_t umap) const
bool all_integers(float &max_val, float &min_val) const
std::complex< double > erf(std::complex< double > z, double relerr=0)
octave_idx_type rows(void) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
F77_RET_T const double const double double * d
int load_hdf5_empty(hid_t loc_id, const char *name, dim_vector &d)
ComplexNDArray complex_array_value(bool=false) const
bool any_element_is_nan(void) const
FloatComplexMatrix diag(octave_idx_type k=0) const
hid_t hdf5_make_complex_type(hid_t num_type)
ComplexColumnVector conj(const ComplexColumnVector &a)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
void swap_bytes< 4 >(void *ptr)
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
bool load_ascii(std::istream &is)
void gripe_nan_to_logical_conversion(void)
std::complex< T > ceil(const std::complex< T > &x)
FloatComplexNDArray float_complex_array_value(bool=false) const
const T * data(void) const
FloatComplexMatrix float_complex_matrix_value(bool=false) const
void resize(const dim_vector &dv, const T &rfv)
#define panic_impossible()
bool save_ascii(std::ostream &os)
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
double double_value(bool=false) const
FloatMatrix float_matrix_value(bool=false) const
float lo_ieee_float_nan_value(void)
Complex complex_value(bool=false) const
dim_vector dims(void) const
bool all_elements_are_real(void) const
void gripe_logical_conversion(void)
octave_base_value * try_narrowing_conversion(void)
SparseMatrix sparse_matrix_value(bool=false) const
void * get_imag_data(void) const
void gripe_invalid_conversion(const std::string &from, const std::string &to)
Matrix matrix_value(bool=false) const
int current_print_indent_level(void) const
bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
void octave_print_internal(std::ostream &, char, bool)
FloatComplexNDArray matrix
bool save_binary(std::ostream &os, bool &save_as_floats)
octave_value diag(octave_idx_type k=0) const
float float_value(bool=false) const
int save_hdf5_empty(hid_t loc_id, const char *name, const dim_vector d)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
virtual octave_value map(unary_mapper_t) const
static const pair_type keywords[]
Complex asin(const Complex &x)
ColumnVector imag(const ComplexColumnVector &a)
std::complex< float > FloatComplex
std::complex< T > floor(const std::complex< T > &x)
std::complex< double > Complex
const T * fortran_vec(void) const
Complex acos(const Complex &x)
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
ColumnVector real(const ComplexColumnVector &a)
Complex atan(const Complex &x)
octave_idx_type columns(void) const
void read_floats(std::istream &is, float *data, save_type type, octave_idx_type len, bool swap, oct_mach_info::float_format fmt)
octave_idx_type rows(void) const
bool octave_is_NA(double x)
std::complex< double > erfc(std::complex< double > z, double relerr=0)