24 #if defined (HAVE_CONFIG_H)
121 "real matrix",
"real scalar");
133 "real matrix",
"real scalar");
159 "real matrix",
"complex scalar");
175 "real matrix",
"complex scalar");
325 error (
"diag: expecting vector argument");
329 return mat.
diag (m, n);
455 ::warning (
"range error for conversion to character value");
460 chm(
i) =
static_cast<char> (ival);
477 os <<
"# ndims: " << dv.
ndims () <<
"\n";
488 os <<
"# rows: " <<
rows () <<
"\n"
489 <<
"# columns: " <<
columns () <<
"\n";
502 keywords[0] =
"ndims";
503 keywords[1] =
"rows";
509 error (
"load: failed to extract number of rows and columns");
513 int mdims =
static_cast<int> (
val);
516 error (
"load: failed to extract number of dimensions");
521 for (
int i = 0;
i < mdims;
i++)
525 error (
"load: failed to read dimensions");
532 error (
"load: failed to load matrix constant");
536 else if (kw ==
"rows")
542 error (
"load: failed to extract number of rows and columns");
544 if (nr > 0 && nc > 0)
549 error (
"load: failed to load matrix constant");
553 else if (nr == 0 || nc == 0)
574 os.write (reinterpret_cast<char *> (&tmp), 4);
575 for (
int i = 0;
i < dv.
ndims ();
i++)
578 os.write (reinterpret_cast<char *> (&tmp), 4);
587 warning (
"save: some values too large to save as floats --");
588 warning (
"save: saving as doubles instead");
593 else if (dv.
numel () > 8192)
595 double max_val, min_val;
600 const double *mtmp = m.
data ();
612 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
623 for (
int i = 0;
i < mdims;
i++)
625 if (! is.read (reinterpret_cast<char *> (&di), 4))
644 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
661 if (! is.read (reinterpret_cast<char *> (&nc), 4))
665 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
670 read_doubles (is, re, static_cast<save_type> (tmp), len, swap, fmt);
686 #if defined (HAVE_HDF5)
693 int rank = dv.
ndims ();
694 hid_t space_hid, data_hid;
695 space_hid = data_hid = -1;
701 for (
int i = 0;
i < rank;
i++)
702 hdims[
i] =
dv(rank-
i-1);
704 space_hid = H5Screate_simple (rank, hdims, 0);
706 if (space_hid < 0)
return false;
708 hid_t save_type_hid = H5T_NATIVE_DOUBLE;
714 warning (
"save: some values too large to save as floats --");
715 warning (
"save: saving as doubles instead");
718 save_type_hid = H5T_NATIVE_FLOAT;
720 #if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
724 double max_val, min_val;
732 #if defined (HAVE_HDF5_18)
733 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
736 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
741 H5Sclose (space_hid);
750 H5Sclose (space_hid);
753 octave_unused_parameter (loc_id);
754 octave_unused_parameter (name);
755 octave_unused_parameter (save_as_floats);
768 #if defined (HAVE_HDF5)
777 #if defined (HAVE_HDF5_18)
780 hid_t data_hid = H5Dopen (loc_id, name);
782 hid_t space_id = H5Dget_space (data_hid);
784 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
796 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
808 for (hsize_t
i = 0, j = rank - 1;
i < rank;
i++, j--)
825 octave_unused_parameter (loc_id);
826 octave_unused_parameter (name);
836 bool pr_as_read_syntax)
const
847 double *pr =
static_cast<double *
> (retval->
get_data ());
873 if (tmp.imag () == 0.0)
911 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
912 case umap_ ## UMAP: \
913 return octave_value (matrix.FCN ())
920 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
921 case umap_ ## UMAP: \
922 return octave_value (matrix.map<TYPE> (FCN))
924 #define RC_ARRAY_MAPPER(UMAP, TYPE, FCN) \
925 case umap_ ## UMAP: \
926 return do_rc_map (matrix, FCN)
988 return str_conv.
map (umap);
Matrix diag(octave_idx_type k=0) const
octave_value as_uint16(void) const
Complex rc_log10(double x)
intNDArray< octave_int64 > int64NDArray
octave_value squeeze(void) const
NDArray array_value(bool=false) const
charNDArray char_array_value(bool=false) const
sortmode is_sorted(sortmode mode=UNSORTED) const
sortmode is_sorted(sortmode mode=UNSORTED) const
octave_idx_type columns(void) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Complex rc_acosh(double x)
Complex rc_sqrt(double x)
std::complex< double > erfi(std::complex< double > z, double relerr=0)
octave_idx_type numel(void) const
Number of elements in the array.
void warn_logical_conversion(void)
identity matrix If supplied two scalar respectively For allows like xample val
const octave_hdf5_id octave_H5S_ALL
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector d)
FloatNDArray float_array_value(bool=false) const
intNDArray< octave_uint32 > uint32NDArray
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
static octave_value do_rc_map(const NDArray &a, Complex(&fcn)(double))
save_type get_save_type(double, double)
octave_value reshape(const dim_vector &new_dims) const
intNDArray< octave_uint8 > uint8NDArray
intNDArray< octave_uint16 > uint16NDArray
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
octave_idx_type numel(void) const
void resize(int n, int fill_value=0)
Complex rc_lgamma(double x)
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)
octave_value as_int8(void) const
octave_value as_uint8(void) const
octave_value as_int64(void) const
void error(const char *fmt,...)
octave_value diag(octave_idx_type k=0) const
double double_value(bool=false) 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
static octave_base_value * default_numeric_demotion_function(const octave_base_value &a)
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)
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
T & elem(octave_idx_type n)
Complex acos(const Complex &x)
Matrix matrix_value(bool=false) const
intNDArray< octave_int16 > int16NDArray
bool any_element_is_nan(void) const
FloatMatrix float_matrix_value(bool=false) const
FloatComplexMatrix float_complex_matrix_value(bool=false) const
FloatComplex float_complex_value(bool=false) const
Complex asin(const Complex &x)
void err_nan_to_logical_conversion(void)
#define RC_ARRAY_MAPPER(UMAP, TYPE, FCN)
FloatComplexNDArray float_complex_array_value(bool=false) const
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
type_conv_info numeric_demotion_function(void) const
bool is_empty(void) const
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.
octave_value as_uint32(void) const
octave_value as_double(void) const
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
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
octave_value map(unary_mapper_t umap) const
Complex rc_atanh(double x)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
bool any_element_not_one_or_zero(void) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
void warn_load(const char *type) const
octave_base_value * try_narrowing_conversion(void)
bool all_integers(double &max_val, double &min_val) const
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 swap_bytes< 4 >(void *ptr)
Complex atan(const Complex &x)
NDArray squeeze(void) const
intNDArray< octave_int8 > int8NDArray
SparseComplexMatrix sparse_complex_matrix_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)
nd deftypefn *octave_map m
octave_value as_single(void) const
boolNDArray bool_array_value(bool warn=false) const
const T * data(void) const
Complex rc_log2(double x)
void resize(const dim_vector &dv, const T &rfv)
Array< T > squeeze(void) const
Chop off leading singleton dimensions.
octave_hdf5_id save_type_to_hdf5(save_type st)
#define panic_impossible()
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
bool save_ascii(std::ostream &os)
octave_value reshape(const dim_vector &new_dims) const
Complex complex_value(bool=false) const
octave_value as_uint64(void) const
ComplexMatrix complex_matrix_value(bool=false) const
float lo_ieee_float_nan_value(void)
void warn_save(const char *type) const
Array< octave_idx_type > as_array(void) const
friend class octave_value
Complex rc_acos(double x)
void warning(const char *fmt,...)
dim_vector dims(void) const
sortmode is_sorted(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
charNDArray max(char d, const charNDArray &m)
octave_idx_type extent(octave_idx_type n) const
intNDArray< octave_int32 > int32NDArray
This is a simple wrapper template that will subclass an Array type or any later type derived from ...
void err_invalid_conversion(const std::string &from, const std::string &to)
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
=val(i)}if ode{val(i)}occurs in table i
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup abs(local error in x(i))<
int current_print_indent_level(void) const
bool save_binary(std::ostream &os, bool &save_as_floats)
void octave_print_internal(std::ostream &, char, bool)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Complex rc_asin(double x)
octave_value as_int16(void) const
octave_idx_type ndims(void) const
Number of dimensions.
Complex rc_log1p(double x)
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
virtual octave_value map(unary_mapper_t) const
mxArray * as_mxArray(void) const
Array< T > reshape(octave_idx_type nr, octave_idx_type nc) const
float float_value(bool=false) const
static int static_type_id(void)
const octave_hdf5_id octave_H5P_DEFAULT
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
std::complex< float > FloatComplex
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
std::complex< double > Complex
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
const T * fortran_vec(void) const
bool load_ascii(std::istream &is)
MArray< T > reshape(const dim_vector &new_dims) const
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
static const char *const keywords[]
write the output to stdout if nargout is
void err_nan_to_character_conversion(void)
Vector representing the dimensions (size) of an Array.
ComplexNDArray complex_array_value(bool=false) const
virtual octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
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
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
octave_value squeeze(void) const
octave_idx_type columns(void) const
octave_value as_int32(void) const
octave_idx_type rows(void) const
bool too_large_for_float(void) const
SparseMatrix sparse_matrix_value(bool=false) const
intNDArray< octave_uint64 > uint64NDArray
std::complex< double > erfc(std::complex< double > z, double relerr=0)