24 #if defined (HAVE_CONFIG_H) 67 "complex matrix",
"double");
108 if (! force_conversion)
110 "complex matrix",
"real scalar");
116 "complex matrix",
"real scalar");
124 if (! force_conversion)
126 "complex matrix",
"real scalar");
132 "complex matrix",
"real scalar");
142 if (! force_conversion)
144 "complex matrix",
"real matrix");
156 if (! force_conversion)
158 "complex matrix",
"real matrix");
170 if (! force_conversion)
172 "complex matrix",
"real matrix");
186 "complex matrix",
"complex scalar");
202 "complex matrix",
"complex scalar");
227 ||
real (
matrix).any_element_not_one_or_zero ()))
240 "complex matrix",
"string");
264 if (! force_conversion)
266 "complex matrix",
"real matrix");
309 error (
"diag: expecting vector argument");
313 return mat.
diag (m, n);
324 os <<
"# ndims: " <<
dv.
ndims () <<
"\n";
335 os <<
"# rows: " <<
rows () <<
"\n" 336 <<
"# columns: " <<
columns () <<
"\n";
349 keywords[0] =
"ndims";
350 keywords[1] =
"rows";
356 error (
"load: failed to extract number of rows and columns");
360 int mdims =
static_cast<int> (
val);
363 error (
"load: failed to extract number of dimensions");
368 for (
int i = 0;
i < mdims;
i++)
372 error (
"load: failed to read dimensions");
379 error (
"load: failed to load matrix constant");
383 else if (kw ==
"rows")
389 error (
"load: failed to extract number of rows and columns");
391 if (nr > 0 && nc > 0)
396 error (
"load: failed to load matrix constant");
400 else if (nr == 0 || nc == 0)
420 os.
write (reinterpret_cast<char *> (&
tmp), 4);
424 os.
write (reinterpret_cast<char *> (&
tmp), 4);
433 warning (
"save: some values too large to save as floats --");
434 warning (
"save: saving as doubles instead");
441 double max_val, min_val;
459 if (!
is.read (reinterpret_cast<char *> (&mdims), 4))
470 for (
int i = 0;
i < mdims;
i++)
472 if (!
is.read (reinterpret_cast<char *> (&di), 4))
491 if (!
is.read (reinterpret_cast<char *> (&
tmp), 1))
508 if (!
is.read (reinterpret_cast<char *> (&nc), 4))
512 if (!
is.read (reinterpret_cast<char *> (&
tmp), 1))
518 static_cast<save_type> (
tmp), 2*len,
swap, fmt);
532 #if defined (HAVE_HDF5) 540 hid_t space_hid, data_hid, type_hid;
541 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,
nullptr);
552 if (space_hid < 0)
return false;
554 hid_t save_type_hid = H5T_NATIVE_DOUBLE;
560 warning (
"save: some values too large to save as floats --");
561 warning (
"save: saving as doubles instead");
564 save_type_hid = H5T_NATIVE_FLOAT;
566 #if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS) 570 double max_val, min_val;
581 H5Sclose (space_hid);
584 #if defined (HAVE_HDF5_18) 585 data_hid = H5Dcreate (loc_id,
name, type_hid, space_hid,
592 H5Sclose (space_hid);
598 if (complex_type_hid < 0)
retval =
false;
607 H5Tclose (complex_type_hid);
612 H5Tclose (complex_type_hid);
615 H5Sclose (space_hid);
620 octave_unused_parameter (loc_id);
621 octave_unused_parameter (
name);
635 #if defined (HAVE_HDF5) 644 #if defined (HAVE_HDF5_18) 647 hid_t data_hid = H5Dopen (loc_id,
name);
649 hid_t type_hid = H5Dget_type (data_hid);
655 H5Tclose (complex_type);
660 hid_t space_id = H5Dget_space (data_hid);
662 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
666 H5Tclose (complex_type);
675 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
687 for (hsize_t
i = 0, j = rank - 1;
i < rank;
i++, j--)
701 H5Tclose (complex_type);
706 octave_unused_parameter (loc_id);
707 octave_unused_parameter (
name);
717 bool pr_as_read_syntax)
const 728 double *pr =
static_cast<double *
> (
retval->get_data ());
729 double *
pi =
static_cast<double *
> (
retval->get_imag_data ());
762 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \ 763 case umap_ ## UMAP: \ 764 return octave_value (matrix.FCN ()) 771 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \ 772 case umap_ ## UMAP: \ 773 return octave_value (matrix.map<TYPE> (FCN))
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)
Matrix matrix_value(bool=false) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_idx_type rows(void) const
const T * data(void) const
octave_value as_single(void) const
ComplexNDArray complex_array_value(bool=false) const
static octave_base_value * default_numeric_demotion_function(const octave_base_value &a)
float float_value(bool=false) const
std::complex< double > erfi(std::complex< double > z, double relerr=0)
void warn_logical_conversion(void)
int current_print_indent_level(void) const
identity matrix If supplied two scalar respectively For allows like xample val
const octave_hdf5_id octave_H5S_ALL
FloatComplexMatrix float_complex_matrix_value(bool=false) const
save_type get_save_type(double, double)
void resize(int n, int fill_value=0)
const T * fortran_vec(void) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
OCTAVE_EXPORT octave_value_list or N dimensional array whose elements are all equal to the base of natural logarithms The constant ex $e satisfies the equation log(e)
std::complex< T > ceil(const std::complex< T > &x)
void error(const char *fmt,...)
std::complex< T > floor(const std::complex< T > &x)
bool save_ascii(std::ostream &os)
bool load_ascii(std::istream &is)
void write_doubles(std::ostream &os, const double *data, save_type type, octave_idx_type len)
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
octave_idx_type columns(void) const
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
T & elem(octave_idx_type n)
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Complex acos(const Complex &x)
FloatMatrix float_matrix_value(bool=false) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Complex atan(const Complex &x)
bool save_binary(std::ostream &os, bool &save_as_floats)
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Complex asin(const Complex &x)
void err_nan_to_logical_conversion(void)
bool too_large_for_float(void) const
Complex log2(const Complex &x)
Complex erfc(const Complex &x)
std::complex< double > erf(std::complex< double > z, double relerr=0)
boolNDArray bool_array_value(bool warn=false) const
virtual octave_value map(unary_mapper_t) const
void warn_load(const char *type) const
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Complex expm1(const Complex &x)
octave_value diag(octave_idx_type k=0) const
type_conv_info numeric_demotion_function(void) const
ComplexColumnVector conj(const ComplexColumnVector &a)
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
nd deftypefn *std::string name
void swap_bytes< 4 >(void *ptr)
octave_value map(unary_mapper_t umap) const
charNDArray char_array_value(bool frc_str_conv=false) const
ComplexMatrix diag(octave_idx_type k=0) const
octave_value diag(octave_idx_type k=0) const
FloatComplex float_complex_value(bool=false) const
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
void read_doubles(std::istream &is, double *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
Complex log1p(const Complex &x)
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
octave_idx_type rows(void) const
octave_base_value * try_narrowing_conversion(void)
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
octave_hdf5_id save_type_to_hdf5(save_type st)
#define panic_impossible()
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
void warn_save(const char *type) const
octave_value as_double(void) const
double double_value(bool=false) const
Complex erf(const Complex &x)
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
float lo_ieee_float_nan_value(void)
bool any_element_is_nan(void) const
void warning(const char *fmt,...)
ComplexMatrix complex_matrix_value(bool=false) const
SparseMatrix sparse_matrix_value(bool=false) const
bool all_integers(double &max_val, double &min_val) const
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector &d)
void err_invalid_conversion(const std::string &from, const std::string &to)
Complex complex_value(bool=false) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
dim_vector dims(void) const
void warn_implicit_conversion(const char *id, const char *from, const char *to)
mxArray * as_mxArray(void) const
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
octave_idx_type numel(void) const
ColumnVector imag(const ComplexColumnVector &a)
const octave_hdf5_id octave_H5P_DEFAULT
octave_idx_type columns(void) const
std::complex< float > FloatComplex
static int static_type_id(void)
bool all_elements_are_real(void) const
octave_idx_type ndims(void) const
Number of dimensions.
std::complex< double > Complex
NDArray array_value(bool=false) const
octave_idx_type numel(void) const
Number of elements in the array.
ColumnVector real(const ComplexColumnVector &a)
write the output to stdout if nargout is
Vector representing the dimensions (size) of an Array.
octave_hdf5_id hdf5_make_complex_type(octave_hdf5_id num_type)
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
FloatComplexNDArray float_complex_array_value(bool=false) const
std::complex< double > erfc(std::complex< double > z, double relerr=0)