26 #if defined (HAVE_CONFIG_H)
66 "complex scalar",
"double");
76 complex_index_exception (
const std::string& value)
83 OCTAVE_DEFAULT_COPY_MOVE (complex_index_exception)
85 ~complex_index_exception () =
default;
87 void update_message ()
89 set_message (expression ()
90 +
": subscripts must be real (forgot to initialize i or j?)");
94 const char * err_id ()
const
96 return "Octave:invalid-index";
101 complex_index_exception *retval =
new complex_index_exception {*
this};
102 retval->set_identifier (retval->err_id ());
107 OCTAVE_END_NAMESPACE(
octave)
130 double im =
scalar.imag ();
153 return tmp.
index_op (idx, resize_ok);
160 std::ostringstream buf;
161 buf <<
scalar.real () << std::showpos <<
scalar.imag () <<
'i';
162 octave::complex_index_exception cie (buf.str ());
170 if (! force_conversion)
172 "complex scalar",
"real scalar");
180 if (! force_conversion)
182 "complex scalar",
"real scalar");
192 if (! force_conversion)
194 "complex scalar",
"real matrix");
206 if (! force_conversion)
208 "complex scalar",
"real matrix");
220 if (! force_conversion)
222 "complex scalar",
"real matrix");
234 if (! force_conversion)
236 "complex scalar",
"real matrix");
326 octave::write_value<Complex> (os, c);
336 scalar = octave::read_value<Complex> (is);
339 error (
"load: failed to load complex scalar constant");
347 char tmp =
static_cast<char> (
LS_DOUBLE);
348 os.write (
reinterpret_cast<char *
> (&tmp), 1);
350 os.write (
reinterpret_cast<char *
> (&ctmp), 16);
360 if (! is.read (
reinterpret_cast<char *
> (&tmp), 1))
365 static_cast<save_type> (tmp), 2, swap, fmt);
380 #if defined (HAVE_HDF5)
382 hsize_t dimens[3] = {0};
383 hid_t space_hid, type_hid, data_hid;
384 space_hid = type_hid = data_hid = -1;
386 space_hid = H5Screate_simple (0, dimens,
nullptr);
393 H5Sclose (space_hid);
396 #if defined (HAVE_HDF5_18)
397 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
405 H5Sclose (space_hid);
416 H5Sclose (space_hid);
419 octave_unused_parameter (loc_id);
420 octave_unused_parameter (name);
433 #if defined (HAVE_HDF5)
435 #if defined (HAVE_HDF5_18)
438 hid_t data_hid = H5Dopen (loc_id, name);
440 hid_t type_hid = H5Dget_type (data_hid);
446 H5Tclose (complex_type);
451 hid_t space_id = H5Dget_space (data_hid);
452 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
456 H5Tclose (complex_type);
471 H5Tclose (complex_type);
476 octave_unused_parameter (loc_id);
477 octave_unused_parameter (name);
515 #define SCALAR_MAPPER(UMAP, FCN) \
516 case umap_ ## UMAP: \
517 return octave_value (FCN (scalar))
ComplexColumnVector conj(const ComplexColumnVector &a)
N Dimensional Array with copy-on-write semantics.
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 * get_imag_data() const
mxComplexDouble * get_complex_doubles() const
virtual octave_value map(unary_mapper_t) const
void warn_load(const char *type) const
void warn_save(const char *type) const
float float_value(bool=false) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
bool save_binary(std::ostream &os, bool save_as_floats)
FloatComplex float_complex_value(bool=false) const
NDArray array_value(bool=false) const
FloatComplexMatrix float_complex_matrix_value(bool=false) const
octave_value diag(octave_idx_type m, octave_idx_type n) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
mxArray * as_mxArray(bool interleaved) const
ComplexMatrix complex_matrix_value(bool=false) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
bool save_ascii(std::ostream &os)
octave_value map(unary_mapper_t umap) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
octave_value as_single() const
octave_base_value * try_narrowing_conversion()
FloatNDArray float_array_value(bool=false) const
octave::idx_vector index_vector(bool=false) const
octave_value resize(const dim_vector &dv, bool fill=false) const
FloatMatrix float_matrix_value(bool=false) const
type_conv_info numeric_demotion_function() const
bool load_ascii(std::istream &is)
ComplexNDArray complex_array_value(bool=false) const
FloatComplexNDArray float_complex_array_value(bool=false) const
Matrix matrix_value(bool=false) const
octave_value as_double() const
double double_value(bool=false) const
Complex complex_value(bool=false) const
static int static_type_id()
octave_value index_op(const octave_value_list &idx, bool resize_ok=false)
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5S_ALL
ColumnVector real(const ComplexColumnVector &a)
ColumnVector imag(const ComplexColumnVector &a)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
void read_doubles(std::istream &is, double *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
void() error(const char *fmt,...)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
octave::idx_vector idx_vector
Complex log2(const Complex &x)
Complex asin(const Complex &x)
Complex acos(const Complex &x)
Complex atan(const Complex &x)
std::complex< T > floor(const std::complex< T > &x)
std::complex< T > ceil(const std::complex< T > &x)
Complex expm1(const Complex &x)
Complex log1p(const Complex &x)
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::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)
std::complex< double > Complex
std::complex< float > FloatComplex
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
#define SCALAR_MAPPER(UMAP, FCN)
template int8_t abs(int8_t)