68 "float complex matrix",
"single");
95 if (! force_conversion)
97 "complex matrix",
"real scalar");
102 "complex matrix",
"real scalar");
117 if (! force_conversion)
119 "complex matrix",
"real scalar");
124 "complex matrix",
"real scalar");
139 if (! force_conversion)
141 "complex matrix",
"real matrix");
153 if (! force_conversion)
155 "complex matrix",
"real matrix");
172 "complex matrix",
"complex scalar");
192 "complex matrix",
"complex scalar");
220 ||
real (
matrix).any_element_not_one_or_zero ()))
233 "complex matrix",
"string");
257 if (! force_conversion)
259 "complex matrix",
"real matrix");
295 retval = mat.
diag (m, n);
298 error (
"diag: expecting vector argument");
311 os <<
"# ndims: " << d.
length () <<
"\n";
313 for (
int i = 0; i < d.
length (); i++)
322 os <<
"# rows: " <<
rows () <<
"\n"
323 <<
"# columns: " <<
columns () <<
"\n";
338 keywords[0] =
"ndims";
339 keywords[1] =
"rows";
348 int mdims =
static_cast<int> (val);
355 for (
int i = 0; i < mdims; i++)
368 error (
"load: failed to load matrix constant");
374 error (
"load: failed to read dimensions");
380 error (
"load: failed to extract number of dimensions");
384 else if (kw ==
"rows")
391 if (nr > 0 && nc > 0)
399 error (
"load: failed to load matrix constant");
403 else if (nr == 0 || nc == 0)
410 error (
"load: failed to extract number of rows and columns");
419 error (
"load: failed to extract number of rows and columns");
434 int32_t tmp = - d.
length ();
435 os.write (reinterpret_cast<char *> (&tmp), 4);
436 for (
int i = 0; i < d.
length (); i++)
439 os.write (reinterpret_cast<char *> (&tmp), 4);
444 if (d.
numel () > 4096)
446 float max_val, min_val;
463 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
474 for (
int i = 0; i < mdims; i++)
476 if (! is.read (reinterpret_cast<char *> (&di), 4))
495 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
501 static_cast<save_type> (tmp), 2 * dv.
numel (), swap, fmt);
510 if (! is.read (reinterpret_cast<char *> (&nc), 4))
514 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
520 static_cast<save_type> (tmp), 2*len, swap, fmt);
528 #if defined (HAVE_HDF5)
539 hid_t space_hid = -1, data_hid = -1, type_hid = -1;
546 for (
int i = 0; i < rank; i++)
547 hdims[i] = dv (rank-i-1);
549 space_hid = H5Screate_simple (rank, hdims, 0);
550 if (space_hid < 0)
return false;
552 hid_t save_type_hid = H5T_NATIVE_FLOAT;
554 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS
558 float max_val, min_val;
569 H5Sclose (space_hid);
573 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
574 H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
576 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
580 H5Sclose (space_hid);
586 if (complex_type_hid < 0) retval =
false;
591 if (H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
594 H5Tclose (complex_type_hid);
599 H5Tclose (complex_type_hid);
602 H5Sclose (space_hid);
620 hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
622 hid_t data_hid = H5Dopen (loc_id, name);
624 hid_t type_hid = H5Dget_type (data_hid);
630 H5Tclose (complex_type);
635 hid_t space_id = H5Dget_space (data_hid);
637 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
641 H5Tclose (complex_type);
650 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
662 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
668 if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
675 H5Tclose (complex_type);
686 bool pr_as_read_syntax)
const
697 float *pr =
static_cast<float *
> (retval->
get_data ());
704 for (
mwIndex i = 0; i < nel; i++)
726 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
727 case umap_ ## UMAP: \
728 return octave_value (matrix.FCN ())
735 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
736 case umap_ ## UMAP: \
737 return octave_value (matrix.map<TYPE> (FCN))