112 "real matrix",
"real scalar");
130 "real matrix",
"real scalar");
164 "real matrix",
"complex scalar");
184 "real matrix",
"complex scalar");
282 retval = mat.
diag (m, n);
285 error (
"diag: expecting vector argument");
417 ::warning (
"range error for conversion to character value");
422 chm (i) =
static_cast<char> (ival);
440 os <<
"# ndims: " << d.
length () <<
"\n";
442 for (
int i=0; i < d.
length (); i++)
451 os <<
"# rows: " <<
rows () <<
"\n"
452 <<
"# columns: " <<
columns () <<
"\n";
467 keywords[0] =
"ndims";
468 keywords[1] =
"rows";
477 int mdims =
static_cast<int> (val);
484 for (
int i = 0; i < mdims; i++)
497 error (
"load: failed to load matrix constant");
503 error (
"load: failed to read dimensions");
509 error (
"load: failed to extract number of dimensions");
513 else if (kw ==
"rows")
520 if (nr > 0 && nc > 0)
528 error (
"load: failed to load matrix constant");
532 else if (nr == 0 || nc == 0)
539 error (
"load: failed to extract number of rows and columns");
548 error (
"load: failed to extract number of rows and columns");
564 int32_t tmp = - d.
length ();
565 os.write (reinterpret_cast<char *> (&tmp), 4);
566 for (
int i = 0; i < d.
length (); i++)
569 os.write (reinterpret_cast<char *> (&tmp), 4);
578 warning (
"save: some values too large to save as floats --");
579 warning (
"save: saving as doubles instead");
584 else if (d.
numel () > 8192)
586 double max_val, min_val;
591 const double *mtmp = m.
data ();
603 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
614 for (
int i = 0; i < mdims; i++)
616 if (! is.read (reinterpret_cast<char *> (&di), 4))
635 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
650 if (! is.read (reinterpret_cast<char *> (&nc), 4))
654 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
659 read_doubles (is, re, static_cast<save_type> (tmp), len, swap, fmt);
667 #if defined (HAVE_HDF5)
678 hid_t space_hid = -1, data_hid = -1;
685 for (
int i = 0; i < rank; i++)
686 hdims[i] = dv (rank-i-1);
688 space_hid = H5Screate_simple (rank, hdims, 0);
690 if (space_hid < 0)
return false;
692 hid_t save_type_hid = H5T_NATIVE_DOUBLE;
698 warning (
"save: some values too large to save as floats --");
699 warning (
"save: saving as doubles instead");
702 save_type_hid = H5T_NATIVE_FLOAT;
704 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS
708 double max_val, min_val;
717 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
718 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
720 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
725 H5Sclose (space_hid);
730 retval = H5Dwrite (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
731 H5P_DEFAULT, mtmp) >= 0;
734 H5Sclose (space_hid);
752 hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
754 hid_t data_hid = H5Dopen (loc_id, name);
756 hid_t space_id = H5Dget_space (data_hid);
758 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
770 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
782 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
788 if (H5Dread (data_hid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL,
789 H5P_DEFAULT, re) >= 0)
805 bool pr_as_read_syntax)
const
816 double *pr =
static_cast<double *
> (retval->
get_data ());
822 for (
mwIndex i = 0; i < nel; i++)
842 if (tmp.imag () == 0.0)
880 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
881 case umap_ ## UMAP: \
882 return octave_value (matrix.FCN ())
889 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
890 case umap_ ## UMAP: \
891 return octave_value (matrix.map<TYPE> (FCN))
893 #define RC_ARRAY_MAPPER(UMAP, TYPE, FCN) \
894 case umap_ ## UMAP: \
895 return do_rc_map (matrix, FCN)
950 @deftypefn {Built-in Function} {} double (@var{x})\n\
951 Convert @var{x} to double precision type.\n\
959 if (args.length () == 1)
961 if (args(0).is_perm_matrix ())
965 else if (args(0).is_diag_matrix ())
967 if (args(0).is_complex_type ())
978 else if (args(0).is_sparse_type ())
980 if (args(0).is_complex_type ())
991 else if (args(0).is_complex_type ())