GNU Octave  4.0.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ov-cx-mat.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2015 John W. Eaton
4 Copyright (C) 2009-2010 VZLU Prague
5 
6 This file is part of Octave.
7 
8 Octave is free software; you can redistribute it and/or modify it
9 under the terms of the GNU General Public License as published by the
10 Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with Octave; see the file COPYING. If not, see
20 <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27 
28 #include <iostream>
29 #include <vector>
30 
31 #include "data-conv.h"
32 #include "lo-ieee.h"
33 #include "lo-specfun.h"
34 #include "lo-mappers.h"
35 #include "mx-base.h"
36 #include "mach-info.h"
37 #include "oct-locbuf.h"
38 
39 #include "gripes.h"
40 #include "mxarray.h"
41 #include "oct-obj.h"
42 #include "oct-hdf5.h"
43 #include "oct-stream.h"
44 #include "ops.h"
45 #include "ov-base.h"
46 #include "ov-base-mat.h"
47 #include "ov-base-mat.cc"
48 #include "ov-complex.h"
49 #include "ov-cx-mat.h"
50 #include "ov-flt-cx-mat.h"
51 #include "ov-re-mat.h"
52 #include "ov-scalar.h"
53 #include "pr-output.h"
54 
55 #include "byte-swap.h"
56 #include "ls-oct-ascii.h"
57 #include "ls-hdf5.h"
58 #include "ls-utils.h"
59 
61 
62 
64  "complex matrix", "double");
65 
66 static octave_base_value *
68 {
70 
71  return new octave_float_complex_matrix (v.float_complex_array_value ());
72 }
73 
76 {
80 }
81 
84 {
85  octave_base_value *retval = 0;
86 
87  if (matrix.numel () == 1)
88  {
89  Complex c = matrix (0);
90 
91  if (std::imag (c) == 0.0)
92  retval = new octave_scalar (std::real (c));
93  else
94  retval = new octave_complex (c);
95  }
96  else if (matrix.all_elements_are_real ())
97  retval = new octave_matrix (::real (matrix));
98 
99  return retval;
100 }
101 
102 double
103 octave_complex_matrix::double_value (bool force_conversion) const
104 {
105  double retval = lo_ieee_nan_value ();
106 
107  if (! force_conversion)
108  gripe_implicit_conversion ("Octave:imag-to-real",
109  "complex matrix", "real scalar");
110 
111  if (rows () > 0 && columns () > 0)
112  {
113  gripe_implicit_conversion ("Octave:array-to-scalar",
114  "complex matrix", "real scalar");
115 
116  retval = std::real (matrix (0, 0));
117  }
118  else
119  gripe_invalid_conversion ("complex matrix", "real scalar");
120 
121  return retval;
122 }
123 
124 float
125 octave_complex_matrix::float_value (bool force_conversion) const
126 {
127  float retval = lo_ieee_float_nan_value ();
128 
129  if (! force_conversion)
130  gripe_implicit_conversion ("Octave:imag-to-real",
131  "complex matrix", "real scalar");
132 
133  if (rows () > 0 && columns () > 0)
134  {
135  gripe_implicit_conversion ("Octave:array-to-scalar",
136  "complex matrix", "real scalar");
137 
138  retval = std::real (matrix (0, 0));
139  }
140  else
141  gripe_invalid_conversion ("complex matrix", "real scalar");
142 
143  return retval;
144 }
145 
146 NDArray
147 octave_complex_matrix::array_value (bool force_conversion) const
148 {
149  NDArray retval;
150 
151  if (! force_conversion)
152  gripe_implicit_conversion ("Octave:imag-to-real",
153  "complex matrix", "real matrix");
154 
155  retval = ::real (matrix);
156 
157  return retval;
158 }
159 
160 Matrix
161 octave_complex_matrix::matrix_value (bool force_conversion) const
162 {
163  Matrix retval;
164 
165  if (! force_conversion)
166  gripe_implicit_conversion ("Octave:imag-to-real",
167  "complex matrix", "real matrix");
168 
169  retval = ::real (ComplexMatrix (matrix));
170 
171  return retval;
172 }
173 
175 octave_complex_matrix::float_matrix_value (bool force_conversion) const
176 {
177  FloatMatrix retval;
178 
179  if (! force_conversion)
180  gripe_implicit_conversion ("Octave:imag-to-real",
181  "complex matrix", "real matrix");
182 
183  retval = ::real (ComplexMatrix (matrix));
184 
185  return retval;
186 }
187 
188 Complex
190 {
191  double tmp = lo_ieee_nan_value ();
192 
193  Complex retval (tmp, tmp);
194 
195  if (rows () > 0 && columns () > 0)
196  {
197  gripe_implicit_conversion ("Octave:array-to-scalar",
198  "complex matrix", "complex scalar");
199 
200  retval = matrix (0, 0);
201  }
202  else
203  gripe_invalid_conversion ("complex matrix", "complex scalar");
204 
205  return retval;
206 }
207 
210 {
211  float tmp = lo_ieee_float_nan_value ();
212 
213  FloatComplex retval (tmp, tmp);
214 
215  if (rows () > 0 && columns () > 0)
216  {
217  gripe_implicit_conversion ("Octave:array-to-scalar",
218  "complex matrix", "complex scalar");
219 
220  retval = matrix (0, 0);
221  }
222  else
223  gripe_invalid_conversion ("complex matrix", "complex scalar");
224 
225  return retval;
226 }
227 
230 {
231  return ComplexMatrix (matrix);
232 }
233 
236 {
238 }
239 
242 {
243  if (matrix.any_element_is_nan ())
245  else if (warn && (! matrix.all_elements_are_real ()
246  || real (matrix).any_element_not_one_or_zero ()))
248 
249  return mx_el_ne (matrix, Complex (0.0));
250 }
251 
254 {
255  charNDArray retval;
256 
257  if (! frc_str_conv)
258  gripe_implicit_conversion ("Octave:num-to-str",
259  "complex matrix", "string");
260  else
261  {
262  retval = charNDArray (dims ());
263  octave_idx_type nel = numel ();
264 
265  for (octave_idx_type i = 0; i < nel; i++)
266  retval.elem (i) = static_cast<char>(std::real (matrix.elem (i)));
267  }
268 
269  return retval;
270 }
271 
274 {
275  return FloatComplexNDArray (matrix);
276 }
277 
279 octave_complex_matrix::sparse_matrix_value (bool force_conversion) const
280 {
281  SparseMatrix retval;
282 
283  if (! force_conversion)
284  gripe_implicit_conversion ("Octave:imag-to-real",
285  "complex matrix", "real matrix");
286 
287  retval = SparseMatrix (::real (ComplexMatrix (matrix)));
288 
289  return retval;
290 }
291 
294 {
296 }
297 
300 {
301  octave_value retval;
302  if (k == 0 && matrix.ndims () == 2
303  && (matrix.rows () == 1 || matrix.columns () == 1))
305  else
307 
308  return retval;
309 }
310 
313 {
314  octave_value retval;
315 
316  if (matrix.ndims () == 2
317  && (matrix.rows () == 1 || matrix.columns () == 1))
318  {
319  ComplexMatrix mat (matrix);
320 
321  retval = mat.diag (m, n);
322  }
323  else
324  error ("diag: expecting vector argument");
325 
326  return retval;
327 }
328 
329 bool
331 {
332  dim_vector d = dims ();
333  if (d.length () > 2)
334  {
336 
337  os << "# ndims: " << d.length () << "\n";
338 
339  for (int i = 0; i < d.length (); i++)
340  os << " " << d (i);
341 
342  os << "\n" << tmp;
343  }
344  else
345  {
346  // Keep this case, rather than use generic code above for backward
347  // compatiability. Makes load_ascii much more complex!!
348  os << "# rows: " << rows () << "\n"
349  << "# columns: " << columns () << "\n";
350 
351  os << complex_matrix_value ();
352  }
353 
354  return true;
355 }
356 
357 bool
359 {
360  bool success = true;
361 
363 
364  keywords[0] = "ndims";
365  keywords[1] = "rows";
366 
367  std::string kw;
368  octave_idx_type val = 0;
369 
370  if (extract_keyword (is, keywords, kw, val, true))
371  {
372  if (kw == "ndims")
373  {
374  int mdims = static_cast<int> (val);
375 
376  if (mdims >= 0)
377  {
378  dim_vector dv;
379  dv.resize (mdims);
380 
381  for (int i = 0; i < mdims; i++)
382  is >> dv(i);
383 
384  if (is)
385  {
386  ComplexNDArray tmp(dv);
387 
388  is >> tmp;
389 
390  if (is)
391  matrix = tmp;
392  else
393  {
394  error ("load: failed to load matrix constant");
395  success = false;
396  }
397  }
398  else
399  {
400  error ("load: failed to read dimensions");
401  success = false;
402  }
403  }
404  else
405  {
406  error ("load: failed to extract number of dimensions");
407  success = false;
408  }
409  }
410  else if (kw == "rows")
411  {
412  octave_idx_type nr = val;
413  octave_idx_type nc = 0;
414 
415  if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
416  {
417  if (nr > 0 && nc > 0)
418  {
419  ComplexMatrix tmp (nr, nc);
420  is >> tmp;
421  if (is)
422  matrix = tmp;
423  else
424  {
425  error ("load: failed to load matrix constant");
426  success = false;
427  }
428  }
429  else if (nr == 0 || nc == 0)
430  matrix = ComplexMatrix (nr, nc);
431  else
432  panic_impossible ();
433  }
434  else
435  {
436  error ("load: failed to extract number of rows and columns");
437  success = false;
438  }
439  }
440  else
441  panic_impossible ();
442  }
443  else
444  {
445  error ("load: failed to extract number of rows and columns");
446  success = false;
447  }
448 
449  return success;
450 }
451 
452 bool
453 octave_complex_matrix::save_binary (std::ostream& os, bool& save_as_floats)
454 {
455  dim_vector d = dims ();
456  if (d.length () < 1)
457  return false;
458 
459  // Use negative value for ndims to differentiate with old format!!
460  int32_t tmp = - d.length ();
461  os.write (reinterpret_cast<char *> (&tmp), 4);
462  for (int i = 0; i < d.length (); i++)
463  {
464  tmp = d(i);
465  os.write (reinterpret_cast<char *> (&tmp), 4);
466  }
467 
469  save_type st = LS_DOUBLE;
470  if (save_as_floats)
471  {
472  if (m.too_large_for_float ())
473  {
474  warning ("save: some values too large to save as floats --");
475  warning ("save: saving as doubles instead");
476  }
477  else
478  st = LS_FLOAT;
479  }
480  else if (d.numel () > 4096) // FIXME: make this configurable.
481  {
482  double max_val, min_val;
483  if (m.all_integers (max_val, min_val))
484  st = get_save_type (max_val, min_val);
485  }
486 
487 
488  const Complex *mtmp = m.data ();
489  write_doubles (os, reinterpret_cast<const double *> (mtmp), st,
490  2 * d.numel ());
491 
492  return true;
493 }
494 
495 bool
496 octave_complex_matrix::load_binary (std::istream& is, bool swap,
498 {
499  char tmp;
500  int32_t mdims;
501  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
502  return false;
503  if (swap)
504  swap_bytes<4> (&mdims);
505  if (mdims < 0)
506  {
507  mdims = - mdims;
508  int32_t di;
509  dim_vector dv;
510  dv.resize (mdims);
511 
512  for (int i = 0; i < mdims; i++)
513  {
514  if (! is.read (reinterpret_cast<char *> (&di), 4))
515  return false;
516  if (swap)
517  swap_bytes<4> (&di);
518  dv(i) = di;
519  }
520 
521  // Convert an array with a single dimension to be a row vector.
522  // Octave should never write files like this, other software
523  // might.
524 
525  if (mdims == 1)
526  {
527  mdims = 2;
528  dv.resize (mdims);
529  dv(1) = dv(0);
530  dv(0) = 1;
531  }
532 
533  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
534  return false;
535 
536  ComplexNDArray m(dv);
537  Complex *im = m.fortran_vec ();
538  read_doubles (is, reinterpret_cast<double *> (im),
539  static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
540  if (error_state || ! is)
541  return false;
542  matrix = m;
543  }
544  else
545  {
546  int32_t nr, nc;
547  nr = mdims;
548  if (! is.read (reinterpret_cast<char *> (&nc), 4))
549  return false;
550  if (swap)
551  swap_bytes<4> (&nc);
552  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
553  return false;
554  ComplexMatrix m (nr, nc);
555  Complex *im = m.fortran_vec ();
556  octave_idx_type len = nr * nc;
557  read_doubles (is, reinterpret_cast<double *> (im),
558  static_cast<save_type> (tmp), 2*len, swap, fmt);
559  if (error_state || ! is)
560  return false;
561  matrix = m;
562  }
563  return true;
564 }
565 
566 bool
568  bool save_as_floats)
569 {
570 #if defined (HAVE_HDF5)
571 
572  dim_vector dv = dims ();
573  int empty = save_hdf5_empty (loc_id, name, dv);
574  if (empty)
575  return (empty > 0);
576 
577  int rank = dv.length ();
578  hid_t space_hid, data_hid, type_hid;
579  space_hid = data_hid = type_hid = -1;
580  bool retval = true;
582 
583  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
584 
585  // Octave uses column-major, while HDF5 uses row-major ordering
586  for (int i = 0; i < rank; i++)
587  hdims[i] = dv (rank-i-1);
588 
589  space_hid = H5Screate_simple (rank, hdims, 0);
590  if (space_hid < 0) return false;
591 
592  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
593 
594  if (save_as_floats)
595  {
596  if (m.too_large_for_float ())
597  {
598  warning ("save: some values too large to save as floats --");
599  warning ("save: saving as doubles instead");
600  }
601  else
602  save_type_hid = H5T_NATIVE_FLOAT;
603  }
604 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS
605  // hdf5 currently doesn't support float/integer conversions
606  else
607  {
608  double max_val, min_val;
609 
610  if (m.all_integers (max_val, min_val))
611  save_type_hid
612  = save_type_to_hdf5 (get_save_type (max_val, min_val));
613  }
614 #endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
615 
616  type_hid = hdf5_make_complex_type (save_type_hid);
617  if (type_hid < 0)
618  {
619  H5Sclose (space_hid);
620  return false;
621  }
622 #if HAVE_HDF5_18
623  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
624  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
625 #else
626  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
627 #endif
628  if (data_hid < 0)
629  {
630  H5Sclose (space_hid);
631  H5Tclose (type_hid);
632  return false;
633  }
634 
635  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
636  if (complex_type_hid < 0) retval = false;
637 
638  if (retval)
639  {
640  Complex *mtmp = m.fortran_vec ();
641  if (H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
642  mtmp) < 0)
643  {
644  H5Tclose (complex_type_hid);
645  retval = false;
646  }
647  }
648 
649  H5Tclose (complex_type_hid);
650  H5Dclose (data_hid);
651  H5Tclose (type_hid);
652  H5Sclose (space_hid);
653 
654  return retval;
655 
656 #else
657  gripe_save ("hdf5");
658  return false;
659 #endif
660 }
661 
662 bool
664 {
665  bool retval = false;
666 
667 #if defined (HAVE_HDF5)
668 
669  dim_vector dv;
670  int empty = load_hdf5_empty (loc_id, name, dv);
671  if (empty > 0)
672  matrix.resize (dv);
673  if (empty)
674  return (empty > 0);
675 
676 #if HAVE_HDF5_18
677  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
678 #else
679  hid_t data_hid = H5Dopen (loc_id, name);
680 #endif
681  hid_t type_hid = H5Dget_type (data_hid);
682 
683  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
684 
685  if (! hdf5_types_compatible (type_hid, complex_type))
686  {
687  H5Tclose (complex_type);
688  H5Dclose (data_hid);
689  return false;
690  }
691 
692  hid_t space_id = H5Dget_space (data_hid);
693 
694  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
695 
696  if (rank < 1)
697  {
698  H5Tclose (complex_type);
699  H5Sclose (space_id);
700  H5Dclose (data_hid);
701  return false;
702  }
703 
704  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
705  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
706 
707  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
708 
709  // Octave uses column-major, while HDF5 uses row-major ordering
710  if (rank == 1)
711  {
712  dv.resize (2);
713  dv(0) = 1;
714  dv(1) = hdims[0];
715  }
716  else
717  {
718  dv.resize (rank);
719  for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
720  dv(j) = hdims[i];
721  }
722 
723  ComplexNDArray m (dv);
724  Complex *reim = m.fortran_vec ();
725  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
726  reim) >= 0)
727  {
728  retval = true;
729  matrix = m;
730  }
731 
732  H5Tclose (complex_type);
733  H5Sclose (space_id);
734  H5Dclose (data_hid);
735 
736 #else
737  gripe_load ("hdf5");
738 #endif
739 
740  return retval;
741 }
742 
743 void
745  bool pr_as_read_syntax) const
746 {
747  octave_print_internal (os, matrix, pr_as_read_syntax,
749 }
750 
751 mxArray *
753 {
754  mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxCOMPLEX);
755 
756  double *pr = static_cast<double *> (retval->get_data ());
757  double *pi = static_cast<double *> (retval->get_imag_data ());
758 
759  mwSize nel = numel ();
760 
761  const Complex *p = matrix.data ();
762 
763  for (mwIndex i = 0; i < nel; i++)
764  {
765  pr[i] = std::real (p[i]);
766  pi[i] = std::imag (p[i]);
767  }
768 
769  return retval;
770 }
771 
774 {
775  switch (umap)
776  {
777  // Mappers handled specially.
778  case umap_real:
780  case umap_imag:
782  case umap_conj:
784 
785 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
786  case umap_ ## UMAP: \
787  return octave_value (matrix.FCN ())
788 
790  ARRAY_METHOD_MAPPER (isnan, isnan);
791  ARRAY_METHOD_MAPPER (isinf, isinf);
792  ARRAY_METHOD_MAPPER (finite, isfinite);
793 
794 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
795  case umap_ ## UMAP: \
796  return octave_value (matrix.map<TYPE> (FCN))
797 
800  ARRAY_MAPPER (angle, double, std::arg);
801  ARRAY_MAPPER (arg, double, std::arg);
806  ARRAY_MAPPER (erf, Complex, ::erf);
812  ARRAY_MAPPER (cos, Complex, std::cos);
813  ARRAY_MAPPER (cosh, Complex, std::cosh);
814  ARRAY_MAPPER (exp, Complex, std::exp);
816  ARRAY_MAPPER (fix, Complex, ::fix);
818  ARRAY_MAPPER (log, Complex, std::log);
819  ARRAY_MAPPER (log2, Complex, xlog2);
820  ARRAY_MAPPER (log10, Complex, std::log10);
822  ARRAY_MAPPER (round, Complex, xround);
823  ARRAY_MAPPER (roundb, Complex, xroundb);
825  ARRAY_MAPPER (sin, Complex, std::sin);
826  ARRAY_MAPPER (sinh, Complex, std::sinh);
827  ARRAY_MAPPER (sqrt, Complex, std::sqrt);
828  ARRAY_MAPPER (tan, Complex, std::tan);
829  ARRAY_MAPPER (tanh, Complex, std::tanh);
830  ARRAY_MAPPER (isna, bool, octave_is_NA);
831 
832  default:
833  return octave_base_value::map (umap);
834  }
835 }
save_type
Definition: data-conv.h:83
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-cx-mat.cc:567
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
Definition: gripes.cc:180
bool all_integers(double &max_val, double &min_val) const
Definition: CNDArray.cc:536
float float_value(bool=false) const
Definition: ov-cx-mat.cc:125
bool hdf5_types_compatible(hid_t t1, hid_t t2)
Definition: ls-hdf5.cc:107
bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
Definition: ov-cx-mat.cc:496
double xround(double x)
Definition: lo-mappers.cc:63
bool any_element_is_nan(void) const
Definition: CNDArray.cc:512
type_conv_info numeric_demotion_function(void) const
Definition: ov-cx-mat.cc:75
octave_idx_type columns(void) const
Definition: ov-base.h:301
double log1p(double x)
Definition: lo-specfun.cc:620
static octave_base_value * default_numeric_demotion_function(const octave_base_value &a)
Definition: ov-cx-mat.cc:67
int ndims(void) const
Definition: Array.h:487
std::complex< double > erfi(std::complex< double > z, double relerr=0)
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:275
void gripe_load(const char *type) const
Definition: ov-base.cc:1258
FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-cx-mat.cc:273
save_type get_save_type(double, double)
Definition: ls-utils.cc:35
Matrix matrix_value(bool=false) const
Definition: ov-cx-mat.cc:161
Complex complex_value(bool=false) const
Definition: ov-cx-mat.cc:189
octave_value diag(octave_idx_type k=0) const
Definition: ov-cx-mat.cc:299
octave_idx_type numel(void) const
Definition: ov-base-mat.h:103
void resize(int n, int fill_value=0)
Definition: dim-vector.h:287
function atanh(X)
Definition: atanh.f:2
void error(const char *fmt,...)
Definition: error.cc:476
void * get_data(void) const
Definition: mxarray.h:433
bool save_ascii(std::ostream &os)
Definition: ov-cx-mat.cc:330
bool load_ascii(std::istream &is)
Definition: ov-cx-mat.cc:358
octave_value diag(octave_idx_type k=0) const
Definition: ov-base-mat.h:123
ComplexNDArray complex_array_value(bool=false) const
Definition: ov-cx-mat.h:127
void write_doubles(std::ostream &os, const double *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:893
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:164
void gripe_save(const char *type) const
Definition: ov-base.cc:1267
T & elem(octave_idx_type n)
Definition: Array.h:380
double lo_ieee_nan_value(void)
Definition: lo-ieee.cc:126
double expm1(double x)
Definition: lo-specfun.cc:510
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-cx-mat.cc:663
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-cx-mat.cc:453
double xlog2(double x)
Definition: lo-mappers.cc:93
FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:235
std::complex< double > erf(std::complex< double > z, double relerr=0)
octave_idx_type rows(void) const
Definition: Array.h:313
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition: dim-vector.h:361
F77_RET_T const double const double double * d
int load_hdf5_empty(hid_t loc_id, const char *name, dim_vector &d)
Definition: ls-hdf5.cc:790
NDArray array_value(bool=false) const
Definition: ov-cx-mat.cc:147
bool too_large_for_float(void) const
Definition: CNDArray.cc:586
octave_value map(unary_mapper_t umap) const
Definition: ov-cx-mat.cc:773
hid_t hdf5_make_complex_type(hid_t num_type)
Definition: ls-hdf5.cc:228
double signum(double x)
Definition: lo-mappers.cc:80
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:244
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
Definition: ls-oct-ascii.cc:80
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:59
FloatComplex float_complex_value(bool=false) const
Definition: ov-cx-mat.cc:209
bool all_elements_are_real(void) const
Definition: CNDArray.cc:526
#define CAST_CONV_ARG(t)
Definition: ops.h:83
function asinh(X)
Definition: asinh.f:2
void gripe_nan_to_logical_conversion(void)
std::complex< T > ceil(const std::complex< T > &x)
Definition: lo-mappers.h:275
octave_base_value * try_narrowing_conversion(void)
Definition: ov-cx-mat.cc:83
const T * data(void) const
Definition: Array.h:479
int error_state
Definition: error.cc:101
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
#define panic_impossible()
Definition: error.h:33
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
double xroundb(double x)
Definition: lo-mappers.cc:69
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
Definition: boolMatrix.cc:90
SparseMatrix sparse_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:279
Definition: dMatrix.h:35
void read_doubles(std::istream &is, double *data, save_type type, octave_idx_type len, bool swap, oct_mach_info::float_format fmt)
Definition: data-conv.cc:778
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:202
void mxArray
Definition: mex.h:53
function acosh(X)
Definition: acosh.f:2
ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:229
double arg(double x)
Definition: lo-mappers.h:37
void warning(const char *fmt,...)
Definition: error.cc:681
void gripe_logical_conversion(void)
Definition: gripes.cc:201
void * get_imag_data(void) const
Definition: mxarray.h:435
void gripe_invalid_conversion(const std::string &from, const std::string &to)
Definition: gripes.cc:99
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-cx-mat.cc:744
double double_value(bool=false) const
Definition: ov-cx-mat.cc:103
int current_print_indent_level(void) const
Definition: ov-base.h:805
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
void octave_print_internal(std::ostream &, char, bool)
Definition: pr-output.cc:1715
int save_hdf5_empty(hid_t loc_id, const char *name, const dim_vector d)
Definition: ls-hdf5.cc:740
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:197
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1276
double fix(double x)
Definition: lo-mappers.h:39
FloatMatrix float_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:175
mxArray * as_mxArray(void) const
Definition: ov-cx-mat.cc:752
float dawson(float x)
Definition: lo-specfun.cc:349
static const pair_type keywords[]
Definition: help.cc:445
Complex asin(const Complex &x)
Definition: lo-mappers.cc:204
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:162
std::complex< float > FloatComplex
Definition: oct-cmplx.h:30
static int static_type_id(void)
std::complex< T > floor(const std::complex< T > &x)
Definition: lo-mappers.h:282
ComplexMatrix diag(octave_idx_type k=0) const
Definition: CMatrix.cc:3167
std::complex< double > Complex
Definition: oct-cmplx.h:29
const T * fortran_vec(void) const
Definition: Array.h:481
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:293
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov-cx-mat.cc:253
Complex acos(const Complex &x)
Definition: lo-mappers.cc:177
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:156
boolNDArray bool_array_value(bool warn=false) const
Definition: ov-cx-mat.cc:241
T abs(T x)
Definition: pr-output.cc:3062
int length(void) const
Definition: dim-vector.h:281
Complex atan(const Complex &x)
Definition: lo-mappers.cc:231
octave_idx_type columns(void) const
Definition: Array.h:322
octave_idx_type rows(void) const
Definition: ov-base.h:294
bool octave_is_NA(double x)
Definition: lo-mappers.cc:167
std::complex< double > erfc(std::complex< double > z, double relerr=0)