26 #if defined (HAVE_CONFIG_H)
74 "float complex matrix",
"single");
99 if (! force_conversion)
101 "complex matrix",
"real scalar");
107 "complex matrix",
"real scalar");
115 if (! force_conversion)
117 "complex matrix",
"real scalar");
123 "complex matrix",
"real scalar");
133 if (! force_conversion)
135 "complex matrix",
"real matrix");
147 if (! force_conversion)
149 "complex matrix",
"real matrix");
163 "complex matrix",
"complex scalar");
179 "complex matrix",
"complex scalar");
204 ||
real (
matrix).any_element_not_one_or_zero ()))
217 "complex matrix",
"string");
241 if (! force_conversion)
243 "complex matrix",
"real matrix");
286 error (
"diag: expecting vector argument");
301 os <<
"# ndims: " << dv.
ndims () <<
"\n";
303 for (
int i = 0; i < dv.
ndims (); i++)
312 os <<
"# rows: " <<
rows () <<
"\n"
313 <<
"# columns: " <<
columns () <<
"\n";
326 keywords[0] =
"ndims";
327 keywords[1] =
"rows";
333 error (
"load: failed to extract number of rows and columns");
337 int mdims =
static_cast<int> (val);
340 error (
"load: failed to extract number of dimensions");
345 for (
int i = 0; i < mdims; i++)
349 error (
"load: failed to read dimensions");
356 error (
"load: failed to load matrix constant");
360 else if (kw ==
"rows")
366 error (
"load: failed to extract number of rows and columns");
368 if (nr > 0 && nc > 0)
373 error (
"load: failed to load matrix constant");
377 else if (nr == 0 || nc == 0)
396 int32_t tmp = - dv.
ndims ();
397 os.write (
reinterpret_cast<char *
> (&tmp), 4);
398 for (
int i = 0; i < dv.
ndims (); i++)
401 os.write (
reinterpret_cast<char *
> (&tmp), 4);
406 if (dv.
numel () > 4096)
408 float max_val, min_val;
409 if (
m.all_integers (max_val, min_val))
414 write_floats (os,
reinterpret_cast<const float *
> (mtmp), st,
426 if (! is.read (
reinterpret_cast<char *
> (&mdims), 4))
437 for (
int i = 0; i < mdims; i++)
439 if (! is.read (
reinterpret_cast<char *
> (&di), 4))
458 if (! is.read (
reinterpret_cast<char *
> (&tmp), 1))
475 if (! is.read (
reinterpret_cast<char *
> (&nc), 4))
479 if (! is.read (
reinterpret_cast<char *
> (&tmp), 1))
501 #if defined (HAVE_HDF5)
508 int rank = dv.
ndims ();
509 hid_t space_hid, data_hid, type_hid;
510 space_hid = data_hid = type_hid = -1;
516 for (
int i = 0; i < rank; i++)
517 hdims[i] = dv(rank-i-1);
519 space_hid = H5Screate_simple (rank, hdims,
nullptr);
520 if (space_hid < 0)
return false;
522 hid_t save_type_hid = H5T_NATIVE_FLOAT;
524 #if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
528 float max_val, min_val;
530 if (
m.all_integers (max_val, min_val))
539 H5Sclose (space_hid);
542 #if defined (HAVE_HDF5_18)
543 data_hid = H5Dcreate (loc_id,
name, type_hid, space_hid,
550 H5Sclose (space_hid);
556 if (complex_type_hid < 0)
retval =
false;
565 H5Tclose (complex_type_hid);
570 H5Tclose (complex_type_hid);
573 H5Sclose (space_hid);
576 octave_unused_parameter (loc_id);
577 octave_unused_parameter (
name);
590 #if defined (HAVE_HDF5)
599 #if defined (HAVE_HDF5_18)
602 hid_t data_hid = H5Dopen (loc_id,
name);
604 hid_t type_hid = H5Dget_type (data_hid);
610 H5Tclose (complex_type);
615 hid_t space_id = H5Dget_space (data_hid);
617 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
621 H5Tclose (complex_type);
630 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
642 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
656 H5Tclose (complex_type);
661 octave_unused_parameter (loc_id);
662 octave_unused_parameter (
name);
672 bool pr_as_read_syntax)
const
683 float *pr =
static_cast<float *
> (
retval->get_data ());
684 float *
pi =
static_cast<float *
> (
retval->get_imag_data ());
690 for (
mwIndex i = 0; i < nel; i++)
717 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
718 case umap_ ## UMAP: \
719 return octave_value (matrix.FCN ())
726 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
727 case umap_ ## UMAP: \
728 return octave_value (matrix.map<TYPE> (FCN))
ComplexColumnVector conj(const ComplexColumnVector &a)
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
void swap_bytes< 4 >(void *ptr)
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
octave_idx_type columns(void) const
octave_idx_type numel(void) const
Number of elements in the array.
T & elem(octave_idx_type n)
Size of the specified dimension.
const T * data(void) const
Size of the specified dimension.
octave_idx_type rows(void) const
int ndims(void) const
Size of the specified dimension.
FloatComplexMatrix diag(octave_idx_type k=0) const
bool any_element_is_nan(void) const
bool all_elements_are_real(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)
octave_idx_type ndims(void) const
Number of dimensions.
octave_idx_type numel(void) const
octave_value diag(octave_idx_type k=0) const
FloatComplexNDArray matrix
dim_vector dims(void) const
octave_idx_type columns(void) const
int current_print_indent_level(void) const
virtual octave_value map(unary_mapper_t) const
void warn_load(const char *type) const
octave_idx_type rows(void) const
void warn_save(const char *type) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
ComplexMatrix complex_matrix_value(bool=false) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
SparseMatrix sparse_matrix_value(bool=false) const
FloatComplex float_complex_value(bool=false) const
FloatComplexNDArray float_complex_array_value(bool=false) const
bool save_binary(std::ostream &os, bool save_as_floats)
FloatComplexMatrix float_complex_matrix_value(bool=false) const
bool save_ascii(std::ostream &os)
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_value diag(octave_idx_type k=0) const
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
octave_base_value * try_narrowing_conversion(void)
double double_value(bool=false) const
bool load_ascii(std::istream &is)
mxArray * as_mxArray(void) const
ComplexNDArray complex_array_value(bool=false) const
Matrix matrix_value(bool=false) const
boolNDArray bool_array_value(bool warn=false) const
charNDArray char_array_value(bool frc_str_conv=false) const
FloatMatrix float_matrix_value(bool=false) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_value as_single(void) const
octave_value as_double(void) const
float float_value(bool=false) const
Complex complex_value(bool=false) const
octave_value map(unary_mapper_t umap) const
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5S_ALL
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
void write_floats(std::ostream &os, const float *data, save_type type, octave_idx_type len)
void read_floats(std::istream &is, float *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
void error(const char *fmt,...)
#define panic_impossible()
void err_invalid_conversion(const std::string &from, const std::string &to)
void warn_logical_conversion(void)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
float lo_ieee_float_nan_value(void)
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector &d)
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
octave_hdf5_id save_type_to_hdf5(save_type st)
octave_hdf5_id hdf5_make_complex_type(octave_hdf5_id num_type)
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
save_type get_save_type(double, double)
std::complex< double > erfc(std::complex< double > z, double relerr=0)
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
std::complex< double > erfi(std::complex< double > z, double relerr=0)
std::complex< double > erf(std::complex< double > z, double relerr=0)
Complex atan(const Complex &x)
Complex log1p(const Complex &x)
Complex acos(const Complex &x)
Complex asin(const Complex &x)
Complex erfc(const Complex &x)
std::complex< T > ceil(const std::complex< T > &x)
Complex log2(const Complex &x)
std::complex< T > floor(const std::complex< T > &x)
Complex erf(const Complex &x)
Complex expm1(const Complex &x)
void err_nan_to_logical_conversion(void)
std::complex< double > Complex
std::complex< float > FloatComplex
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
octave_value::octave_value(const Array< char > &chm, char type) return retval
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)