97 "real matrix",
"real scalar");
115 "real matrix",
"real scalar");
149 "real matrix",
"complex scalar");
169 "real matrix",
"complex scalar");
273 retval = mat.
diag (m, n);
276 error (
"diag: expecting vector argument");
315 ::warning (
"range error for conversion to character value");
320 chm (i) =
static_cast<char> (ival);
338 os <<
"# ndims: " << d.
length () <<
"\n";
340 for (
int i=0; i < d.
length (); i++)
349 os <<
"# rows: " <<
rows () <<
"\n"
350 <<
"# columns: " <<
columns () <<
"\n";
365 keywords[0] =
"ndims";
366 keywords[1] =
"rows";
375 int mdims =
static_cast<int> (val);
382 for (
int i = 0; i < mdims; i++)
395 error (
"load: failed to load matrix constant");
401 error (
"load: failed to read dimensions");
407 error (
"load: failed to extract number of dimensions");
411 else if (kw ==
"rows")
418 if (nr > 0 && nc > 0)
426 error (
"load: failed to load matrix constant");
430 else if (nr == 0 || nc == 0)
437 error (
"load: failed to extract number of rows and columns");
446 error (
"load: failed to extract number of rows and columns");
462 int32_t tmp = - d.
length ();
463 os.write (reinterpret_cast<char *> (&tmp), 4);
464 for (
int i = 0; i < d.
length (); i++)
467 os.write (reinterpret_cast<char *> (&tmp), 4);
472 if (d.
numel () > 8192)
474 float max_val, min_val;
479 const float *mtmp = m.
data ();
491 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
502 for (
int i = 0; i < mdims; i++)
504 if (! is.read (reinterpret_cast<char *> (&di), 4))
523 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
538 if (! is.read (reinterpret_cast<char *> (&nc), 4))
542 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
547 read_floats (is, re, static_cast<save_type> (tmp), len, swap, fmt);
560 #if defined (HAVE_HDF5)
568 hid_t space_hid, data_hid;
569 space_hid = data_hid = -1;
575 for (
int i = 0; i < rank; i++)
576 hdims[i] = dv (rank-i-1);
578 space_hid = H5Screate_simple (rank, hdims, 0);
580 if (space_hid < 0)
return false;
582 hid_t save_type_hid = H5T_NATIVE_FLOAT;
584 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS
588 float max_val, min_val;
596 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
597 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
599 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
604 H5Sclose (space_hid);
609 retval = H5Dwrite (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
610 H5P_DEFAULT, mtmp) >= 0;
613 H5Sclose (space_hid);
627 #if defined (HAVE_HDF5)
637 hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
639 hid_t data_hid = H5Dopen (loc_id, name);
641 hid_t space_id = H5Dget_space (data_hid);
643 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
655 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
667 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
673 if (H5Dread (data_hid, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL,
674 H5P_DEFAULT, re) >= 0)
692 bool pr_as_read_syntax)
const
703 float *pr =
static_cast<float *
> (retval->
get_data ());
709 for (
mwIndex i = 0; i < nel; i++)
729 if (tmp.imag () == 0.0)
767 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
768 case umap_ ## UMAP: \
769 return octave_value (matrix.FCN ())
776 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
777 case umap_ ## UMAP: \
778 return octave_value (matrix.map<TYPE> (FCN))
780 #define RC_ARRAY_MAPPER(UMAP, TYPE, FCN) \
781 case umap_ ## UMAP: \
782 return do_rc_map (matrix, FCN)
852 DEFUN (single, args, ,
854 @deftypefn {Built-in Function} {} single (@var{x})\n\
855 Convert @var{x} to single precision type.\n\
863 if (args.length () == 1)
865 if (args(0).is_diag_matrix ())
867 if (args(0).is_complex_type ())
878 else if (args(0).is_sparse_type ())
880 error (
"single: sparse type does not support single precision");
882 else if (args(0).is_complex_type ())
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
Complex rc_asin(double x)
void write_floats(std::ostream &os, const float *data, save_type type, octave_idx_type len)
octave_value convert_to_str_internal(bool pad, bool force, char type) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_idx_type columns(void) const
octave_value diag(octave_idx_type k=0) const
OCTINTERP_API void print_usage(void)
NDArray array_value(bool=false) 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)
Complex rc_acos(double x)
SparseMatrix sparse_matrix_value(bool=false) const
octave_idx_type numel(void) const
void resize(int n, int fill_value=0)
#define DEFUN(name, args_name, nargout_name, doc)
void error(const char *fmt,...)
FloatMatrix diag(octave_idx_type k=0) const
void * get_data(void) const
octave_value map(octave_base_value::unary_mapper_t umap) const
octave_value diag(octave_idx_type k=0) const
FloatMatrix float_matrix_value(bool=false) const
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
void gripe_save(const char *type) const
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
bool any_element_is_nan(void) const
T & elem(octave_idx_type n)
double lo_ieee_nan_value(void)
mxArray * as_mxArray(void) const
float float_value(bool=false) 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)
subroutine xgamma(x, result)
octave_idx_type nelem(void) const
Number of elements in the array.
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Complex rc_log1p(double x)
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
void swap_bytes< 4 >(void *ptr)
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Complex rc_lgamma(double x)
ComplexNDArray complex_array_value(bool=false) const
void gripe_nan_to_logical_conversion(void)
std::complex< T > ceil(const std::complex< T > &x)
#define OCTAVE_TYPE_CONV_BODY3(NAME, MATRIX_RESULT_T, SCALAR_RESULT_T)
bool any_element_not_one_or_zero(void) const
bool save_ascii(std::ostream &os)
const T * data(void) const
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
void resize(const dim_vector &dv, const T &rfv)
Complex rc_sqrt(double x)
#define panic_impossible()
void gripe_nan_to_character_conversion(void)
Complex rc_log2(double x)
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
bool load_ascii(std::istream &is)
Complex rc_atanh(double x)
FloatNDArray float_array_value(bool=false) const
boolNDArray bool_array_value(bool warn=false) const
double double_value(bool=false) const
Matrix matrix_value(bool=false) const
float lo_ieee_float_nan_value(void)
Complex rc_log10(double x)
friend class octave_value
void warning(const char *fmt,...)
dim_vector dims(void) const
charNDArray max(char d, const charNDArray &m)
bool save_binary(std::ostream &os, bool &save_as_floats)
This is a simple wrapper template that will subclass an Array type or any later type derived from ...
void gripe_logical_conversion(void)
Complex rc_acosh(double x)
void gripe_invalid_conversion(const std::string &from, const std::string &to)
octave_value map(unary_mapper_t umap) const
int current_print_indent_level(void) const
void octave_print_internal(std::ostream &, char, bool)
bool all_integers(float &max_val, float &min_val) const
FloatComplex float_complex_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 octave_value do_rc_map(const FloatNDArray &a, FloatComplex(&fcn)(float))
static const pair_type keywords[]
Complex asin(const Complex &x)
#define RC_ARRAY_MAPPER(UMAP, TYPE, FCN)
ComplexMatrix complex_matrix_value(bool=false) const
std::complex< float > FloatComplex
std::complex< T > floor(const std::complex< T > &x)
FloatComplexMatrix float_complex_matrix_value(bool=false) const
std::complex< double > Complex
const T * fortran_vec(void) const
charNDArray char_array_value(bool=false) const
Complex acos(const Complex &x)
octave_base_value * try_narrowing_conversion(void)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
virtual octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
Complex atan(const Complex &x)
Complex complex_value(bool=false) const
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 load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
return octave_value(v1.char_array_value().concat(v2.char_array_value(), ra_idx),((a1.is_sq_string()||a2.is_sq_string())? '\'': '"'))
FloatComplexNDArray float_complex_array_value(bool=false) const
bool octave_is_NA(double x)
std::complex< double > erfc(std::complex< double > z, double relerr=0)