24 #if defined (HAVE_CONFIG_H)
56 "sparse complex matrix",
"double");
83 else if (nr == 0 || nc == 0)
109 if (! force_conversion)
111 "complex sparse matrix",
"real scalar");
119 "complex sparse matrix",
"real scalar");
129 if (! force_conversion)
131 "complex sparse matrix",
"real matrix");
147 "complex sparse matrix",
"real scalar");
171 "sparse complex matrix",
"string");
192 if (! force_conversion)
194 "complex sparse matrix",
195 "real sparse matrix");
208 ||
real (
matrix).any_element_not_one_or_zero ()))
238 os.write (reinterpret_cast<char *> (&itmp), 4);
241 os.write (reinterpret_cast<char *> (&itmp), 4);
244 os.write (reinterpret_cast<char *> (&itmp), 4);
247 os.write (reinterpret_cast<char *> (&itmp), 4);
254 warning (
"save: some values too large to save as floats --");
255 warning (
"save: saving as doubles instead");
262 double max_val, min_val;
269 for (
int i = 0;
i < nc+1;
i++)
273 os.write (reinterpret_cast<char *> (&itmp), 4);
276 for (
int i = 0;
i < nz;
i++)
280 os.write (reinterpret_cast<char *> (&itmp), 4);
293 int32_t nz, nc, nr,
tmp;
296 if (! is.read (reinterpret_cast<char *> (&tmp), 4))
303 error (
"load: only 2-D sparse matrices are supported");
305 if (! is.read (reinterpret_cast<char *> (&nr), 4))
307 if (! is.read (reinterpret_cast<char *> (&nc), 4))
309 if (! is.read (reinterpret_cast<char *> (&nz), 4))
320 static_cast<octave_idx_type> (nc),
321 static_cast<octave_idx_type> (nz));
323 for (
int i = 0;
i < nc+1;
i++)
326 if (! is.read (reinterpret_cast<char *> (&tmp), 4))
333 for (
int i = 0;
i < nz;
i++)
336 if (! is.read (reinterpret_cast<char *> (&tmp), 4))
343 if (! is.read (reinterpret_cast<char *> (&ctmp), 1))
347 static_cast<save_type> (ctmp), 2 * nz,
swap, fmt);
366 #if defined (HAVE_HDF5)
376 #if defined (HAVE_HDF5_18)
380 hid_t group_hid = H5Gcreate (loc_id, name, 0);
385 hid_t space_hid, data_hid;
386 space_hid = data_hid = -1;
391 space_hid = H5Screate_simple (0, hdims, 0);
394 H5Gclose (group_hid);
398 #if defined (HAVE_HDF5_18)
407 H5Sclose (space_hid);
408 H5Gclose (group_hid);
418 H5Sclose (space_hid);
419 H5Gclose (group_hid);
423 #if defined (HAVE_HDF5_18)
432 H5Sclose (space_hid);
433 H5Gclose (group_hid);
443 H5Sclose (space_hid);
444 H5Gclose (group_hid);
448 #if defined (HAVE_HDF5_18)
457 H5Sclose (space_hid);
458 H5Gclose (group_hid);
468 H5Sclose (space_hid);
469 H5Gclose (group_hid);
473 H5Sclose (space_hid);
475 hdims[0] = m.
cols () + 1;
478 space_hid = H5Screate_simple (2, hdims, 0);
482 H5Gclose (group_hid);
486 #if defined (HAVE_HDF5_18)
487 data_hid = H5Dcreate (group_hid,
"cidx",
H5T_NATIVE_IDX, space_hid,
490 data_hid = H5Dcreate (group_hid,
"cidx",
H5T_NATIVE_IDX, space_hid,
495 H5Sclose (space_hid);
496 H5Gclose (group_hid);
506 H5Sclose (space_hid);
507 H5Gclose (group_hid);
511 H5Sclose (space_hid);
516 space_hid = H5Screate_simple (2, hdims, 0);
520 H5Gclose (group_hid);
524 #if defined (HAVE_HDF5_18)
525 data_hid = H5Dcreate (group_hid,
"ridx",
H5T_NATIVE_IDX, space_hid,
528 data_hid = H5Dcreate (group_hid,
"ridx",
H5T_NATIVE_IDX, space_hid,
533 H5Sclose (space_hid);
534 H5Gclose (group_hid);
544 H5Sclose (space_hid);
545 H5Gclose (group_hid);
549 hid_t save_type_hid = H5T_NATIVE_DOUBLE;
555 warning (
"save: some values too large to save as floats --");
556 warning (
"save: saving as doubles instead");
559 save_type_hid = H5T_NATIVE_FLOAT;
561 #if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
565 double max_val, min_val;
576 H5Sclose (space_hid);
577 H5Gclose (group_hid);
580 #if defined (HAVE_HDF5_18)
581 data_hid = H5Dcreate (group_hid,
"data", type_hid, space_hid,
584 data_hid = H5Dcreate (group_hid,
"data", type_hid, space_hid,
589 H5Sclose (space_hid);
591 H5Gclose (group_hid);
597 if (complex_type_hid >= 0)
606 H5Sclose (space_hid);
608 H5Gclose (group_hid);
611 octave_unused_parameter (loc_id);
612 octave_unused_parameter (name);
613 octave_unused_parameter (save_as_floats);
627 #if defined (HAVE_HDF5)
630 hid_t group_hid, data_hid, space_hid;
640 #if defined (HAVE_HDF5_18)
643 group_hid = H5Gopen (loc_id, name);
645 if (group_hid < 0)
return false;
647 #if defined (HAVE_HDF5_18)
650 data_hid = H5Dopen (group_hid,
"nr");
652 space_hid = H5Dget_space (data_hid);
653 rank = H5Sget_simple_extent_ndims (space_hid);
658 H5Gclose (group_hid);
666 H5Gclose (group_hid);
672 #if defined (HAVE_HDF5_18)
675 data_hid = H5Dopen (group_hid,
"nc");
677 space_hid = H5Dget_space (data_hid);
678 rank = H5Sget_simple_extent_ndims (space_hid);
683 H5Gclose (group_hid);
691 H5Gclose (group_hid);
697 #if defined (HAVE_HDF5_18)
700 data_hid = H5Dopen (group_hid,
"nz");
702 space_hid = H5Dget_space (data_hid);
703 rank = H5Sget_simple_extent_ndims (space_hid);
708 H5Gclose (group_hid);
716 H5Gclose (group_hid);
723 static_cast<octave_idx_type> (nc),
724 static_cast<octave_idx_type> (nz));
726 #if defined (HAVE_HDF5_18)
729 data_hid = H5Dopen (group_hid,
"cidx");
731 space_hid = H5Dget_space (data_hid);
732 rank = H5Sget_simple_extent_ndims (space_hid);
736 H5Sclose (space_hid);
738 H5Gclose (group_hid);
745 H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
747 if (static_cast<int> (hdims[0]) != nc + 1
748 || static_cast<int> (hdims[1]) != 1)
750 H5Sclose (space_hid);
752 H5Gclose (group_hid);
760 H5Sclose (space_hid);
762 H5Gclose (group_hid);
766 H5Sclose (space_hid);
769 #if defined (HAVE_HDF5_18)
772 data_hid = H5Dopen (group_hid,
"ridx");
774 space_hid = H5Dget_space (data_hid);
775 rank = H5Sget_simple_extent_ndims (space_hid);
779 H5Sclose (space_hid);
781 H5Gclose (group_hid);
785 H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
787 if (static_cast<int> (hdims[0]) != nz
788 || static_cast<int> (hdims[1]) != 1)
790 H5Sclose (space_hid);
792 H5Gclose (group_hid);
800 H5Sclose (space_hid);
802 H5Gclose (group_hid);
806 H5Sclose (space_hid);
809 #if defined (HAVE_HDF5_18)
812 data_hid = H5Dopen (group_hid,
"data");
814 hid_t type_hid = H5Dget_type (data_hid);
820 H5Tclose (complex_type);
822 H5Gclose (group_hid);
826 space_hid = H5Dget_space (data_hid);
827 rank = H5Sget_simple_extent_ndims (space_hid);
831 H5Sclose (space_hid);
833 H5Gclose (group_hid);
837 H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
839 if (static_cast<int> (hdims[0]) != nz
840 || static_cast<int> (hdims[1]) != 1)
842 H5Sclose (space_hid);
844 H5Gclose (group_hid);
858 H5Tclose (complex_type);
859 H5Sclose (space_hid);
861 H5Gclose (group_hid);
864 octave_unused_parameter (loc_id);
865 octave_unused_parameter (name);
879 double *pr =
static_cast<double *
> (retval->
get_data ());
909 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
910 case umap_ ## UMAP: \
911 return octave_value (matrix.FCN ())
915 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
916 case umap_ ## UMAP: \
917 return octave_value (matrix.map<TYPE> (FCN))
octave_idx_type * xridx(void)
SparseMatrix sparse_matrix_value(bool=false) const
octave_idx_type cols(void) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_idx_type rows(void) const
SparseComplexMatrix matrix
ComplexMatrix matrix_value(void) const
octave_base_value * try_narrowing_conversion(void)
octave_idx_type columns(void) const
std::complex< double > erfi(std::complex< double > z, double relerr=0)
Complex complex_value(bool=false) const
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)
save_type get_save_type(double, double)
SparseBoolMatrix sparse_bool_matrix_value(bool warn=false) const
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 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)
SparseComplexMatrix sparse_complex_matrix_value(bool=false) 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 nnz(void) const
Actual number of nonzero terms.
void warn_load(const char *type) const
mwIndex * get_ir(void) const
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
ComplexColumnVector conj(const ComplexColumnVector &a)
ComplexMatrix complex_matrix_value(bool=false) 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)
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
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
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
Sparse< T > maybe_compress(bool remove_zeros=false)
void resize(octave_idx_type r, octave_idx_type c)
double double_value(bool=false) const
octave_value map(octave_base_value::unary_mapper_t umap) const
octave_hdf5_id save_type_to_hdf5(save_type st)
size_t byte_size(void) const
bool too_large_for_float(void) const
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
void warn_save(const char *type) const
charNDArray char_array_value(bool frc_str_conv=false) const
mxArray * as_mxArray(void) const
void warning(const char *fmt,...)
bool all_elements_are_real(void) const
void err_invalid_conversion(const std::string &from, const std::string &to)
octave_idx_type * ridx(void)
bool any_element_is_nan(void) const
void * get_imag_data(void) const
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
=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))<
void warn_implicit_conversion(const char *id, const char *from, const char *to)
issues an error eealso double
octave_idx_type ndims(void) const
Number of dimensions.
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
mwIndex * get_jc(void) const
ColumnVector imag(const ComplexColumnVector &a)
const octave_hdf5_id octave_H5P_DEFAULT
octave_value map(unary_mapper_t umap) const
std::complex< double > Complex
ColumnVector real(const ComplexColumnVector &a)
write the output to stdout if nargout is
Matrix matrix_value(bool=false) const
Vector representing the dimensions (size) of an Array.
octave_hdf5_id hdf5_make_complex_type(octave_hdf5_id num_type)
bool save_binary(std::ostream &os, bool &save_as_floats)
bool all_integers(double &max_val, double &min_val) const
dim_vector dims(void) const
octave_idx_type nnz(void) const
octave_value as_double(void) const
octave_idx_type rows(void) const
ComplexNDArray complex_array_value(bool=false) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
std::complex< double > erfc(std::complex< double > z, double relerr=0)