26 #if defined (HAVE_CONFIG_H)
66 "complex scalar",
"double");
87 set_message (expression ()
88 +
": subscripts must be real (forgot to initialize i or j?)");
94 return "Octave:invalid-index";
121 double im =
scalar.imag ();
144 return tmp.
index_op (idx, resize_ok);
151 std::ostringstream buf;
152 buf <<
scalar.real () << std::showpos <<
scalar.imag () <<
'i';
153 octave::complex_index_exception cie (buf.str ());
161 if (! force_conversion)
163 "complex scalar",
"real scalar");
171 if (! force_conversion)
173 "complex scalar",
"real scalar");
183 if (! force_conversion)
185 "complex scalar",
"real matrix");
197 if (! force_conversion)
199 "complex scalar",
"real matrix");
211 if (! force_conversion)
213 "complex scalar",
"real matrix");
225 if (! force_conversion)
227 "complex scalar",
"real matrix");
317 octave::write_value<Complex> (os, c);
327 scalar = octave::read_value<Complex> (is);
330 error (
"load: failed to load complex scalar constant");
338 char tmp =
static_cast<char> (
LS_DOUBLE);
339 os.write (
reinterpret_cast<char *
> (&tmp), 1);
341 os.write (
reinterpret_cast<char *
> (&ctmp), 16);
351 if (! is.read (
reinterpret_cast<char *
> (&tmp), 1))
356 static_cast<save_type> (tmp), 2, swap, fmt);
371 #if defined (HAVE_HDF5)
373 hsize_t dimens[3] = {0};
374 hid_t space_hid, type_hid, data_hid;
375 space_hid = type_hid = data_hid = -1;
377 space_hid = H5Screate_simple (0, dimens,
nullptr);
384 H5Sclose (space_hid);
387 #if defined (HAVE_HDF5_18)
388 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
396 H5Sclose (space_hid);
407 H5Sclose (space_hid);
410 octave_unused_parameter (loc_id);
411 octave_unused_parameter (name);
424 #if defined (HAVE_HDF5)
426 #if defined (HAVE_HDF5_18)
429 hid_t data_hid = H5Dopen (loc_id, name);
431 hid_t type_hid = H5Dget_type (data_hid);
437 H5Tclose (complex_type);
442 hid_t space_id = H5Dget_space (data_hid);
443 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
447 H5Tclose (complex_type);
462 H5Tclose (complex_type);
467 octave_unused_parameter (loc_id);
468 octave_unused_parameter (name);
479 mxArray *retval =
new mxArray (interleaved, mxDOUBLE_CLASS, 1, 1, mxCOMPLEX);
486 pd[0].real =
scalar.real ();
487 pd[0].imag =
scalar.imag ();
491 mxDouble *pr =
static_cast<mxDouble *
> (retval->
get_data ());
506 #define SCALAR_MAPPER(UMAP, FCN) \
507 case umap_ ## UMAP: \
508 return octave_value (FCN (scalar))
ComplexColumnVector conj(const ComplexColumnVector &a)
N Dimensional Array with copy-on-write semantics.
~complex_index_exception(void)=default
complex_index_exception(const std::string &value)
const char * err_id(void) const
void update_message(void)
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(void) const
void * get_data(void) const
mxComplexDouble * get_complex_doubles(void) const
virtual octave_value map(unary_mapper_t) const
OCTINTERP_API void warn_load(const char *type) const
OCTINTERP_API void warn_save(const char *type) const
OCTINTERP_API float float_value(bool=false) const
octave_base_value * try_narrowing_conversion(void)
OCTINTERP_API bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
OCTINTERP_API bool save_binary(std::ostream &os, bool save_as_floats)
OCTINTERP_API octave_value as_single(void) const
OCTINTERP_API FloatComplex float_complex_value(bool=false) const
OCTINTERP_API NDArray array_value(bool=false) const
OCTINTERP_API FloatComplexMatrix float_complex_matrix_value(bool=false) const
OCTINTERP_API octave_value diag(octave_idx_type m, octave_idx_type n) const
OCTINTERP_API bool load_hdf5(octave_hdf5_id loc_id, const char *name)
OCTINTERP_API mxArray * as_mxArray(bool interleaved) const
OCTINTERP_API ComplexMatrix complex_matrix_value(bool=false) const
OCTINTERP_API bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
OCTINTERP_API bool save_ascii(std::ostream &os)
OCTINTERP_API octave_value map(unary_mapper_t umap) const
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
OCTINTERP_API FloatNDArray float_array_value(bool=false) const
octave::idx_vector index_vector(bool=false) const
OCTINTERP_API octave_value as_double(void) const
type_conv_info numeric_demotion_function(void) const
OCTINTERP_API octave_value resize(const dim_vector &dv, bool fill=false) const
OCTINTERP_API FloatMatrix float_matrix_value(bool=false) const
OCTINTERP_API bool load_ascii(std::istream &is)
OCTINTERP_API ComplexNDArray complex_array_value(bool=false) const
OCTINTERP_API FloatComplexNDArray float_complex_array_value(bool=false) const
OCTINTERP_API Matrix matrix_value(bool=false) const
OCTINTERP_API double double_value(bool=false) const
OCTINTERP_API Complex complex_value(bool=false) const
static int static_type_id(void)
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)
class OCTAVE_API ComplexDiagMatrix
class OCTAVE_API ComplexMatrix
class OCTAVE_API FloatComplexMatrix
class OCTAVE_API FloatMatrix
class OCTAVE_API ComplexNDArray
class OCTAVE_API FloatComplexNDArray
class OCTAVE_API FloatNDArray
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)
static octave_base_value * default_numeric_demotion_function(const octave_base_value &a)