24 #if defined (HAVE_CONFIG_H)
103 "real sparse matrix",
"real scalar");
117 "real sparse matrix",
"complex scalar");
225 ::warning (
"range error for conversion to character value");
230 chm(
matrix.
ridx (
i) + j * nr) = static_cast<char> (ival);
262 os.write (reinterpret_cast<char *> (&itmp), 4);
265 os.write (reinterpret_cast<char *> (&itmp), 4);
268 os.write (reinterpret_cast<char *> (&itmp), 4);
271 os.write (reinterpret_cast<char *> (&itmp), 4);
278 warning (
"save: some values too large to save as floats --");
279 warning (
"save: saving as doubles instead");
286 double max_val, min_val;
293 for (
int i = 0;
i < nc+1;
i++)
297 os.write (reinterpret_cast<char *> (&itmp), 4);
300 for (
int i = 0;
i < nz;
i++)
304 os.write (reinterpret_cast<char *> (&itmp), 4);
316 int32_t nz, nc, nr,
tmp;
319 if (! is.read (reinterpret_cast<char *> (&tmp), 4))
326 error (
"load: only 2-D sparse matrices are supported");
328 if (! is.read (reinterpret_cast<char *> (&nr), 4))
330 if (! is.read (reinterpret_cast<char *> (&nc), 4))
332 if (! is.read (reinterpret_cast<char *> (&nz), 4))
343 static_cast<octave_idx_type> (nc),
344 static_cast<octave_idx_type> (nz));
346 for (
int i = 0;
i < nc+1;
i++)
349 if (! is.read (reinterpret_cast<char *> (&tmp), 4))
356 for (
int i = 0;
i < nz;
i++)
359 if (! is.read (reinterpret_cast<char *> (&tmp), 4))
366 if (! is.read (reinterpret_cast<char *> (&ctmp), 1))
388 #if defined (HAVE_HDF5)
398 #if defined (HAVE_HDF5_18)
402 hid_t group_hid = H5Gcreate (loc_id, name, 0);
407 hid_t space_hid, data_hid;
408 space_hid = data_hid = -1;
413 space_hid = H5Screate_simple (0, hdims, 0);
416 H5Gclose (group_hid);
419 #if defined (HAVE_HDF5_18)
428 H5Sclose (space_hid);
429 H5Gclose (group_hid);
439 H5Sclose (space_hid);
440 H5Gclose (group_hid);
443 #if defined (HAVE_HDF5_18)
452 H5Sclose (space_hid);
453 H5Gclose (group_hid);
463 H5Sclose (space_hid);
464 H5Gclose (group_hid);
468 #if defined (HAVE_HDF5_18)
477 H5Sclose (space_hid);
478 H5Gclose (group_hid);
488 H5Sclose (space_hid);
489 H5Gclose (group_hid);
493 H5Sclose (space_hid);
495 hdims[0] = m.
cols () + 1;
498 space_hid = H5Screate_simple (2, hdims, 0);
502 H5Gclose (group_hid);
506 #if defined (HAVE_HDF5_18)
507 data_hid = H5Dcreate (group_hid,
"cidx",
H5T_NATIVE_IDX, space_hid,
510 data_hid = H5Dcreate (group_hid,
"cidx",
H5T_NATIVE_IDX, space_hid,
515 H5Sclose (space_hid);
516 H5Gclose (group_hid);
526 H5Sclose (space_hid);
527 H5Gclose (group_hid);
531 H5Sclose (space_hid);
536 space_hid = H5Screate_simple (2, hdims, 0);
540 H5Gclose (group_hid);
543 #if defined (HAVE_HDF5_18)
544 data_hid = H5Dcreate (group_hid,
"ridx",
H5T_NATIVE_IDX, space_hid,
547 data_hid = H5Dcreate (group_hid,
"ridx",
H5T_NATIVE_IDX, space_hid,
552 H5Sclose (space_hid);
553 H5Gclose (group_hid);
563 H5Sclose (space_hid);
564 H5Gclose (group_hid);
568 hid_t save_type_hid = H5T_NATIVE_DOUBLE;
574 warning (
"save: some values too large to save as floats --");
575 warning (
"save: saving as doubles instead");
578 save_type_hid = H5T_NATIVE_FLOAT;
580 #if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
584 double max_val, min_val;
592 #if defined (HAVE_HDF5_18)
593 data_hid = H5Dcreate (group_hid,
"data", save_type_hid, space_hid,
596 data_hid = H5Dcreate (group_hid,
"data", save_type_hid, space_hid,
601 H5Sclose (space_hid);
602 H5Gclose (group_hid);
606 double * dtmp = m.
xdata ();
610 H5Sclose (space_hid);
611 H5Gclose (group_hid);
614 octave_unused_parameter (loc_id);
615 octave_unused_parameter (name);
616 octave_unused_parameter (save_as_floats);
629 #if defined (HAVE_HDF5)
632 hid_t group_hid, data_hid, space_hid;
642 #if defined (HAVE_HDF5_18)
645 group_hid = H5Gopen (loc_id, name);
647 if (group_hid < 0)
return false;
649 #if defined (HAVE_HDF5_18)
652 data_hid = H5Dopen (group_hid,
"nr");
654 space_hid = H5Dget_space (data_hid);
655 rank = H5Sget_simple_extent_ndims (space_hid);
660 H5Gclose (group_hid);
668 H5Gclose (group_hid);
674 #if defined (HAVE_HDF5_18)
677 data_hid = H5Dopen (group_hid,
"nc");
679 space_hid = H5Dget_space (data_hid);
680 rank = H5Sget_simple_extent_ndims (space_hid);
685 H5Gclose (group_hid);
693 H5Gclose (group_hid);
699 #if defined (HAVE_HDF5_18)
702 data_hid = H5Dopen (group_hid,
"nz");
704 space_hid = H5Dget_space (data_hid);
705 rank = H5Sget_simple_extent_ndims (space_hid);
710 H5Gclose (group_hid);
718 H5Gclose (group_hid);
725 static_cast<octave_idx_type> (nc),
726 static_cast<octave_idx_type> (nz));
728 #if defined (HAVE_HDF5_18)
731 data_hid = H5Dopen (group_hid,
"cidx");
733 space_hid = H5Dget_space (data_hid);
734 rank = H5Sget_simple_extent_ndims (space_hid);
738 H5Sclose (space_hid);
740 H5Gclose (group_hid);
747 H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
749 if (static_cast<int> (hdims[0]) != nc + 1
750 || static_cast<int> (hdims[1]) != 1)
752 H5Sclose (space_hid);
754 H5Gclose (group_hid);
762 H5Sclose (space_hid);
764 H5Gclose (group_hid);
768 H5Sclose (space_hid);
771 #if defined (HAVE_HDF5_18)
774 data_hid = H5Dopen (group_hid,
"ridx");
776 space_hid = H5Dget_space (data_hid);
777 rank = H5Sget_simple_extent_ndims (space_hid);
781 H5Sclose (space_hid);
783 H5Gclose (group_hid);
787 H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
789 if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1)
791 H5Sclose (space_hid);
793 H5Gclose (group_hid);
801 H5Sclose (space_hid);
803 H5Gclose (group_hid);
807 H5Sclose (space_hid);
810 #if defined (HAVE_HDF5_18)
813 data_hid = H5Dopen (group_hid,
"data");
815 space_hid = H5Dget_space (data_hid);
816 rank = H5Sget_simple_extent_ndims (space_hid);
820 H5Sclose (space_hid);
822 H5Gclose (group_hid);
826 H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
828 if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1)
830 H5Sclose (space_hid);
832 H5Gclose (group_hid);
836 double *dtmp = m.
xdata ();
846 H5Sclose (space_hid);
848 H5Gclose (group_hid);
851 octave_unused_parameter (loc_id);
852 octave_unused_parameter (name);
867 double *pr =
static_cast<double *
> (retval->
get_data ());
896 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
897 case umap_ ## UMAP: \
898 return octave_value (matrix.FCN ())
902 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
903 case umap_ ## UMAP: \
904 return octave_value (matrix.map<TYPE> (FCN))
octave_idx_type * xridx(void)
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
octave_idx_type cols(void) const
Complex rc_log10(double x)
std::string type_name(void) const
Complex complex_value(bool=false) const
SparseMatrix sparse_matrix_value(bool=false) const
octave_idx_type rows(void) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_idx_type numel(void) const
ComplexNDArray complex_array_value(bool=false) const
octave_idx_type columns(void) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Complex rc_acosh(double x)
Complex rc_sqrt(double x)
std::complex< double > erfi(std::complex< double > z, double relerr=0)
void warn_logical_conversion(void)
const octave_hdf5_id octave_H5S_ALL
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector d)
save_type get_save_type(double, double)
octave_value convert_to_str_internal(bool pad, bool force, char type) const
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_idx_type * xcidx(void)
void err_invalid_index(const std::string &idx, octave_idx_type nd, octave_idx_type dim, const std::string &)
void error(const char *fmt,...)
void * get_data(void) const
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 * cidx(void)
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Complex acos(const Complex &x)
bool any_element_is_nan(void) const
Complex asin(const Complex &x)
bool indices_ok(void) const
void err_nan_to_logical_conversion(void)
octave_idx_type nzmax(void) const
bool is_empty(void) const
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
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
octave_value map(unary_mapper_t umap) const
boolNDArray bool_array_value(bool warn=false) const
octave_idx_type nnz(void) const
Actual number of nonzero terms.
Complex rc_atanh(double x)
bool any_element_not_one_or_zero(void) const
void warn_load(const char *type) const
mwIndex * get_ir(void) 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
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
void swap_bytes< 4 >(void *ptr)
Complex atan(const Complex &x)
bool save_binary(std::ostream &os, bool &save_as_floats)
bool all_integers(double &max_val, double &min_val) const
Matrix matrix_value(void) const
octave_idx_type numel(void) const
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
Sparse< T > maybe_compress(bool remove_zeros=false)
void resize(octave_idx_type r, octave_idx_type c)
octave_value map(octave_base_value::unary_mapper_t umap) const
Complex rc_log2(double x)
octave_hdf5_id save_type_to_hdf5(save_type st)
mxArray * as_mxArray(void) const
size_t byte_size(void) const
bool too_large_for_float(void) const
double double_value(bool=false) const
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
idx_vector index_vector(bool require_integers=false) const
bool any_element_not_one_or_zero(void) const
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
void warn_save(const char *type) const
friend class octave_value
Complex rc_acos(double x)
void warning(const char *fmt,...)
charNDArray max(char d, const charNDArray &m)
void err_invalid_conversion(const std::string &from, const std::string &to)
octave_idx_type * ridx(void)
Matrix matrix_value(bool=false) const
=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))<
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
issues an error eealso double
Complex rc_asin(double x)
octave_idx_type ndims(void) const
Number of dimensions.
Complex rc_log1p(double x)
NDArray array_value(bool=false) const
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
mwIndex * get_jc(void) const
bool any_element_is_nan(void) const
const octave_hdf5_id octave_H5P_DEFAULT
ComplexMatrix complex_matrix_value(bool=false) const
std::complex< double > Complex
write the output to stdout if nargout is
void err_nan_to_character_conversion(void)
Vector representing the dimensions (size) of an Array.
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
dim_vector dims(void) const
octave_idx_type nnz(void) const
octave_idx_type rows(void) const
octave_base_value * try_narrowing_conversion(void)
charNDArray char_array_value(bool=false) const
std::complex< double > erfc(std::complex< double > z, double relerr=0)
octave_value as_double(void) const