GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-cx-mat.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2018 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
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12 
13 Octave is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License 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 <https://www.gnu.org/licenses/>.
21 
22 */
23 
24 #if defined (HAVE_CONFIG_H)
25 # include "config.h"
26 #endif
27 
28 #include <iostream>
29 #include <vector>
30 
31 #include "dNDArray.h"
32 #include "fNDArray.h"
33 
34 #include "data-conv.h"
35 #include "lo-ieee.h"
36 #include "lo-specfun.h"
37 #include "lo-mappers.h"
38 #include "mx-base.h"
39 #include "mach-info.h"
40 #include "oct-locbuf.h"
41 
42 #include "errwarn.h"
43 #include "mxarray.h"
44 #include "ovl.h"
45 #include "oct-hdf5.h"
46 #include "oct-stream.h"
47 #include "ops.h"
48 #include "ov-base.h"
49 #include "ov-base-mat.h"
50 #include "ov-base-mat.cc"
51 #include "ov-complex.h"
52 #include "ov-cx-mat.h"
53 #include "ov-flt-cx-mat.h"
54 #include "ov-re-mat.h"
55 #include "ov-scalar.h"
56 #include "pr-output.h"
57 
58 #include "byte-swap.h"
59 #include "ls-oct-text.h"
60 #include "ls-hdf5.h"
61 #include "ls-utils.h"
62 
63 
65 
67  "complex matrix", "double");
68 
69 static octave_base_value *
71 {
72  const octave_complex_matrix& v = dynamic_cast<const octave_complex_matrix&> (a);
73 
75 }
76 
79 {
83 }
84 
87 {
88  octave_base_value *retval = nullptr;
89 
90  if (matrix.numel () == 1)
91  {
92  Complex c = matrix (0);
93 
94  if (c.imag () == 0.0)
95  retval = new octave_scalar (c.real ());
96  else
97  retval = new octave_complex (c);
98  }
99  else if (matrix.all_elements_are_real ())
100  retval = new octave_matrix (::real (matrix));
101 
102  return retval;
103 }
104 
105 double
106 octave_complex_matrix::double_value (bool force_conversion) const
107 {
108  if (! force_conversion)
109  warn_implicit_conversion ("Octave:imag-to-real",
110  "complex matrix", "real scalar");
111 
112  if (rows () == 0 || columns () == 0)
113  err_invalid_conversion ("complex matrix", "real scalar");
114 
115  warn_implicit_conversion ("Octave:array-to-scalar",
116  "complex matrix", "real scalar");
117 
118  return std::real (matrix(0, 0));
119 }
120 
121 float
122 octave_complex_matrix::float_value (bool force_conversion) const
123 {
124  if (! force_conversion)
125  warn_implicit_conversion ("Octave:imag-to-real",
126  "complex matrix", "real scalar");
127 
128  if (rows () == 0 || columns () == 0)
129  err_invalid_conversion ("complex matrix", "real scalar");
130 
131  warn_implicit_conversion ("Octave:array-to-scalar",
132  "complex matrix", "real scalar");
133 
134  return std::real (matrix(0, 0));
135 }
136 
137 NDArray
138 octave_complex_matrix::array_value (bool force_conversion) const
139 {
140  NDArray retval;
141 
142  if (! force_conversion)
143  warn_implicit_conversion ("Octave:imag-to-real",
144  "complex matrix", "real matrix");
145 
146  retval = ::real (matrix);
147 
148  return retval;
149 }
150 
151 Matrix
152 octave_complex_matrix::matrix_value (bool force_conversion) const
153 {
154  Matrix retval;
155 
156  if (! force_conversion)
157  warn_implicit_conversion ("Octave:imag-to-real",
158  "complex matrix", "real matrix");
159 
161 
162  return retval;
163 }
164 
166 octave_complex_matrix::float_matrix_value (bool force_conversion) const
167 {
169 
170  if (! force_conversion)
171  warn_implicit_conversion ("Octave:imag-to-real",
172  "complex matrix", "real matrix");
173 
175 
176  return retval;
177 }
178 
179 Complex
181 {
182  if (rows () == 0 || columns () == 0)
183  err_invalid_conversion ("complex matrix", "complex scalar");
184 
185  warn_implicit_conversion ("Octave:array-to-scalar",
186  "complex matrix", "complex scalar");
187 
188  return matrix(0, 0);
189 }
190 
193 {
194  float tmp = lo_ieee_float_nan_value ();
195 
197 
198  if (rows () == 0 || columns () == 0)
199  err_invalid_conversion ("complex matrix", "complex scalar");
200 
201  warn_implicit_conversion ("Octave:array-to-scalar",
202  "complex matrix", "complex scalar");
203 
204  retval = matrix(0, 0);
205 
206  return retval;
207 }
208 
211 {
212  return ComplexMatrix (matrix);
213 }
214 
217 {
219 }
220 
223 {
224  if (matrix.any_element_is_nan ())
226  if (warn && (! matrix.all_elements_are_real ()
227  || real (matrix).any_element_not_one_or_zero ()))
229 
230  return mx_el_ne (matrix, Complex (0.0));
231 }
232 
235 {
237 
238  if (! frc_str_conv)
239  warn_implicit_conversion ("Octave:num-to-str",
240  "complex matrix", "string");
241  else
242  {
243  retval = charNDArray (dims ());
244  octave_idx_type nel = numel ();
245 
246  for (octave_idx_type i = 0; i < nel; i++)
247  retval.elem (i) = static_cast<char>(std::real (matrix.elem (i)));
248  }
249 
250  return retval;
251 }
252 
255 {
256  return FloatComplexNDArray (matrix);
257 }
258 
260 octave_complex_matrix::sparse_matrix_value (bool force_conversion) const
261 {
263 
264  if (! force_conversion)
265  warn_implicit_conversion ("Octave:imag-to-real",
266  "complex matrix", "real matrix");
267 
269 
270  return retval;
271 }
272 
275 {
277 }
278 
281 {
282  return matrix;
283 }
284 
287 {
288  return FloatComplexNDArray (matrix);
289 }
290 
293 {
295  if (k == 0 && matrix.ndims () == 2
296  && (matrix.rows () == 1 || matrix.columns () == 1))
298  else
300 
301  return retval;
302 }
303 
306 {
307  if (matrix.ndims () != 2
308  || (matrix.rows () != 1 && matrix.columns () != 1))
309  error ("diag: expecting vector argument");
310 
311  ComplexMatrix mat (matrix);
312 
313  return mat.diag (m, n);
314 }
315 
316 bool
318 {
319  dim_vector dv = dims ();
320  if (dv.ndims () > 2)
321  {
323 
324  os << "# ndims: " << dv.ndims () << "\n";
325 
326  for (int i = 0; i < dv.ndims (); i++)
327  os << ' ' << dv(i);
328 
329  os << "\n" << tmp;
330  }
331  else
332  {
333  // Keep this case, rather than use generic code above for backward
334  // compatibility. Makes load_ascii much more complex!!
335  os << "# rows: " << rows () << "\n"
336  << "# columns: " << columns () << "\n";
337 
338  os << complex_matrix_value ();
339  }
340 
341  return true;
342 }
343 
344 bool
346 {
347  string_vector keywords(2);
348 
349  keywords[0] = "ndims";
350  keywords[1] = "rows";
351 
352  std::string kw;
353  octave_idx_type val = 0;
354 
355  if (! extract_keyword (is, keywords, kw, val, true))
356  error ("load: failed to extract number of rows and columns");
357 
358  if (kw == "ndims")
359  {
360  int mdims = static_cast<int> (val);
361 
362  if (mdims < 0)
363  error ("load: failed to extract number of dimensions");
364 
365  dim_vector dv;
366  dv.resize (mdims);
367 
368  for (int i = 0; i < mdims; i++)
369  is >> dv(i);
370 
371  if (! is)
372  error ("load: failed to read dimensions");
373 
375 
376  is >> tmp;
377 
378  if (! is)
379  error ("load: failed to load matrix constant");
380 
381  matrix = tmp;
382  }
383  else if (kw == "rows")
384  {
385  octave_idx_type nr = val;
386  octave_idx_type nc = 0;
387 
388  if (nr < 0 || ! extract_keyword (is, "columns", nc) || nc < 0)
389  error ("load: failed to extract number of rows and columns");
390 
391  if (nr > 0 && nc > 0)
392  {
393  ComplexMatrix tmp (nr, nc);
394  is >> tmp;
395  if (! is)
396  error ("load: failed to load matrix constant");
397 
398  matrix = tmp;
399  }
400  else if (nr == 0 || nc == 0)
401  matrix = ComplexMatrix (nr, nc);
402  else
403  panic_impossible ();
404  }
405  else
406  panic_impossible ();
407 
408  return true;
409 }
410 
411 bool
413 {
414  dim_vector dv = dims ();
415  if (dv.ndims () < 1)
416  return false;
417 
418  // Use negative value for ndims to differentiate with old format!!
419  int32_t tmp = - dv.ndims ();
420  os.write (reinterpret_cast<char *> (&tmp), 4);
421  for (int i = 0; i < dv.ndims (); i++)
422  {
423  tmp = dv(i);
424  os.write (reinterpret_cast<char *> (&tmp), 4);
425  }
426 
428  save_type st = LS_DOUBLE;
429  if (save_as_floats)
430  {
431  if (m.too_large_for_float ())
432  {
433  warning ("save: some values too large to save as floats --");
434  warning ("save: saving as doubles instead");
435  }
436  else
437  st = LS_FLOAT;
438  }
439  else if (dv.numel () > 4096) // FIXME: make this configurable.
440  {
441  double max_val, min_val;
442  if (m.all_integers (max_val, min_val))
443  st = get_save_type (max_val, min_val);
444  }
445 
446  const Complex *mtmp = m.data ();
447  write_doubles (os, reinterpret_cast<const double *> (mtmp), st,
448  2 * dv.numel ());
449 
450  return true;
451 }
452 
453 bool
456 {
457  char tmp;
458  int32_t mdims;
459  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
460  return false;
461  if (swap)
462  swap_bytes<4> (&mdims);
463  if (mdims < 0)
464  {
465  mdims = - mdims;
466  int32_t di;
467  dim_vector dv;
468  dv.resize (mdims);
469 
470  for (int i = 0; i < mdims; i++)
471  {
472  if (! is.read (reinterpret_cast<char *> (&di), 4))
473  return false;
474  if (swap)
475  swap_bytes<4> (&di);
476  dv(i) = di;
477  }
478 
479  // Convert an array with a single dimension to be a row vector.
480  // Octave should never write files like this, other software
481  // might.
482 
483  if (mdims == 1)
484  {
485  mdims = 2;
486  dv.resize (mdims);
487  dv(1) = dv(0);
488  dv(0) = 1;
489  }
490 
491  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
492  return false;
493 
494  ComplexNDArray m(dv);
495  Complex *im = m.fortran_vec ();
496  read_doubles (is, reinterpret_cast<double *> (im),
497  static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
498 
499  if (! is)
500  return false;
501 
502  matrix = m;
503  }
504  else
505  {
506  int32_t nr, nc;
507  nr = mdims;
508  if (! is.read (reinterpret_cast<char *> (&nc), 4))
509  return false;
510  if (swap)
511  swap_bytes<4> (&nc);
512  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
513  return false;
514  ComplexMatrix m (nr, nc);
515  Complex *im = m.fortran_vec ();
516  octave_idx_type len = nr * nc;
517  read_doubles (is, reinterpret_cast<double *> (im),
518  static_cast<save_type> (tmp), 2*len, swap, fmt);
519 
520  if (! is)
521  return false;
522 
523  matrix = m;
524  }
525  return true;
526 }
527 
528 bool
530  bool save_as_floats)
531 {
532 #if defined (HAVE_HDF5)
533 
534  dim_vector dv = dims ();
535  int empty = save_hdf5_empty (loc_id, name, dv);
536  if (empty)
537  return (empty > 0);
538 
539  int rank = dv.ndims ();
540  hid_t space_hid, data_hid, type_hid;
541  space_hid = data_hid = type_hid = -1;
542  bool retval = true;
544 
545  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
546 
547  // Octave uses column-major, while HDF5 uses row-major ordering
548  for (int i = 0; i < rank; i++)
549  hdims[i] = dv(rank-i-1);
550 
551  space_hid = H5Screate_simple (rank, hdims, nullptr);
552  if (space_hid < 0) return false;
553 
554  hid_t save_type_hid = H5T_NATIVE_DOUBLE;
555 
556  if (save_as_floats)
557  {
558  if (m.too_large_for_float ())
559  {
560  warning ("save: some values too large to save as floats --");
561  warning ("save: saving as doubles instead");
562  }
563  else
564  save_type_hid = H5T_NATIVE_FLOAT;
565  }
566 #if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
567  // hdf5 currently doesn't support float/integer conversions
568  else
569  {
570  double max_val, min_val;
571 
572  if (m.all_integers (max_val, min_val))
573  save_type_hid
574  = save_type_to_hdf5 (get_save_type (max_val, min_val));
575  }
576 #endif
577 
578  type_hid = hdf5_make_complex_type (save_type_hid);
579  if (type_hid < 0)
580  {
581  H5Sclose (space_hid);
582  return false;
583  }
584 #if defined (HAVE_HDF5_18)
585  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
587 #else
588  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT);
589 #endif
590  if (data_hid < 0)
591  {
592  H5Sclose (space_hid);
593  H5Tclose (type_hid);
594  return false;
595  }
596 
597  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
598  if (complex_type_hid < 0) retval = false;
599 
600  if (retval)
601  {
602  Complex *mtmp = m.fortran_vec ();
603  if (H5Dwrite (data_hid, complex_type_hid, octave_H5S_ALL, octave_H5S_ALL,
604  octave_H5P_DEFAULT, mtmp)
605  < 0)
606  {
607  H5Tclose (complex_type_hid);
608  retval = false;
609  }
610  }
611 
612  H5Tclose (complex_type_hid);
613  H5Dclose (data_hid);
614  H5Tclose (type_hid);
615  H5Sclose (space_hid);
616 
617  return retval;
618 
619 #else
620  octave_unused_parameter (loc_id);
621  octave_unused_parameter (name);
622  octave_unused_parameter (save_as_floats);
623 
624  warn_save ("hdf5");
625 
626  return false;
627 #endif
628 }
629 
630 bool
632 {
633  bool retval = false;
634 
635 #if defined (HAVE_HDF5)
636 
637  dim_vector dv;
638  int empty = load_hdf5_empty (loc_id, name, dv);
639  if (empty > 0)
640  matrix.resize (dv);
641  if (empty)
642  return (empty > 0);
643 
644 #if defined (HAVE_HDF5_18)
645  hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
646 #else
647  hid_t data_hid = H5Dopen (loc_id, name);
648 #endif
649  hid_t type_hid = H5Dget_type (data_hid);
650 
651  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
652 
653  if (! hdf5_types_compatible (type_hid, complex_type))
654  {
655  H5Tclose (complex_type);
656  H5Dclose (data_hid);
657  return false;
658  }
659 
660  hid_t space_id = H5Dget_space (data_hid);
661 
662  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
663 
664  if (rank < 1)
665  {
666  H5Tclose (complex_type);
667  H5Sclose (space_id);
668  H5Dclose (data_hid);
669  return false;
670  }
671 
672  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
673  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
674 
675  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
676 
677  // Octave uses column-major, while HDF5 uses row-major ordering
678  if (rank == 1)
679  {
680  dv.resize (2);
681  dv(0) = 1;
682  dv(1) = hdims[0];
683  }
684  else
685  {
686  dv.resize (rank);
687  for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
688  dv(j) = hdims[i];
689  }
690 
691  ComplexNDArray m (dv);
692  Complex *reim = m.fortran_vec ();
693  if (H5Dread (data_hid, complex_type, octave_H5S_ALL, octave_H5S_ALL,
694  octave_H5P_DEFAULT, reim)
695  >= 0)
696  {
697  retval = true;
698  matrix = m;
699  }
700 
701  H5Tclose (complex_type);
702  H5Sclose (space_id);
703  H5Dclose (data_hid);
704 
705 #else
706  octave_unused_parameter (loc_id);
707  octave_unused_parameter (name);
708 
709  warn_load ("hdf5");
710 #endif
711 
712  return retval;
713 }
714 
715 void
717  bool pr_as_read_syntax) const
718 {
719  octave_print_internal (os, matrix, pr_as_read_syntax,
721 }
722 
723 mxArray *
725 {
727 
728  double *pr = static_cast<double *> (retval->get_data ());
729  double *pi = static_cast<double *> (retval->get_imag_data ());
730 
731  mwSize nel = numel ();
732 
733  const Complex *p = matrix.data ();
734 
735  for (mwIndex i = 0; i < nel; i++)
736  {
737  pr[i] = std::real (p[i]);
738  pi[i] = std::imag (p[i]);
739  }
740 
741  return retval;
742 }
743 
746 {
747  switch (umap)
748  {
749  // Mappers handled specially.
750  case umap_real:
752  case umap_imag:
754  case umap_conj:
756 
757  // Special cases for Matlab compatibility.
758  case umap_xtolower:
759  case umap_xtoupper:
760  return matrix;
761 
762 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
763  case umap_ ## UMAP: \
764  return octave_value (matrix.FCN ())
765 
770 
771 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
772  case umap_ ## UMAP: \
773  return octave_value (matrix.map<TYPE> (FCN))
774 
777  ARRAY_MAPPER (angle, double, std::arg);
778  ARRAY_MAPPER (arg, double, std::arg);
789  ARRAY_MAPPER (cos, Complex, std::cos);
790  ARRAY_MAPPER (cosh, Complex, std::cosh);
791  ARRAY_MAPPER (exp, Complex, std::exp);
797  ARRAY_MAPPER (log10, Complex, std::log10);
802  ARRAY_MAPPER (sin, Complex, std::sin);
803  ARRAY_MAPPER (sinh, Complex, std::sinh);
804  ARRAY_MAPPER (sqrt, Complex, std::sqrt);
805  ARRAY_MAPPER (tan, Complex, std::tan);
806  ARRAY_MAPPER (tanh, Complex, std::tanh);
808 
809  default:
810  return octave_base_value::map (umap);
811  }
812 }
save_type
Definition: data-conv.h:85
octave_idx_type write(const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)
Definition: oct-stream.cc:6704
Matrix matrix_value(bool=false) const
Definition: ov-cx-mat.cc:152
double erfcx(double x)
Definition: lo-specfun.cc:1756
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-cx-mat.cc:529
octave_idx_type rows(void) const
Definition: Array.h:404
OCTAVE_IDX_TYPE mwSize
Definition: mxarray.in.h:93
const T * data(void) const
Definition: Array.h:582
octave_value as_single(void) const
Definition: ov-cx-mat.cc:286
ComplexNDArray complex_array_value(bool=false) const
Definition: ov-cx-mat.h:127
static octave_base_value * default_numeric_demotion_function(const octave_base_value &a)
Definition: ov-cx-mat.cc:70
float float_value(bool=false) const
Definition: ov-cx-mat.cc:122
std::complex< double > erfi(std::complex< double > z, double relerr=0)
void warn_logical_conversion(void)
Definition: errwarn.cc:359
int current_print_indent_level(void) const
Definition: ov-base.h:849
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:4986
const octave_hdf5_id octave_H5S_ALL
double erfi(double x)
Definition: lo-specfun.cc:1775
FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:216
save_type get_save_type(double, double)
Definition: ls-utils.cc:35
double asinh(double x)
Definition: lo-specfun.h:67
for large enough k
Definition: lu.cc:617
bool isna(double x)
Definition: lo-mappers.cc:45
void resize(int n, int fill_value=0)
Definition: dim-vector.h:310
const T * fortran_vec(void) const
Definition: Array.h:584
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-cx-mat.cc:716
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)
bool isnan(bool)
Definition: lo-mappers.h:187
std::complex< T > ceil(const std::complex< T > &x)
Definition: lo-mappers.h:112
void error(const char *fmt,...)
Definition: error.cc:578
bool isinf(double x)
Definition: lo-mappers.h:225
std::complex< T > floor(const std::complex< T > &x)
Definition: lo-mappers.h:139
bool save_ascii(std::ostream &os)
Definition: ov-cx-mat.cc:317
bool load_ascii(std::istream &is)
Definition: ov-cx-mat.cc:345
static T abs(T x)
Definition: pr-output.cc:1696
void write_doubles(std::ostream &os, const double *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:887
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:180
octave_idx_type columns(void) const
Definition: Array.h:413
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Definition: ls-hdf5.cc:953
T & elem(octave_idx_type n)
Definition: Array.h:488
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:274
Complex acos(const Complex &x)
Definition: lo-mappers.cc:83
FloatMatrix float_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:166
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-cx-mat.cc:631
Complex atan(const Complex &x)
Definition: lo-mappers.h:80
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-cx-mat.cc:412
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
double fix(double x)
Definition: lo-mappers.h:127
Complex asin(const Complex &x)
Definition: lo-mappers.cc:105
void err_nan_to_logical_conversion(void)
bool too_large_for_float(void) const
Definition: CNDArray.cc:575
Complex log2(const Complex &x)
Definition: lo-mappers.cc:137
Complex erfc(const Complex &x)
Definition: lo-specfun.cc:1653
std::complex< double > erf(std::complex< double > z, double relerr=0)
boolNDArray bool_array_value(bool warn=false) const
Definition: ov-cx-mat.cc:222
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1121
octave_value arg
Definition: pr-output.cc:3244
void warn_load(const char *type) const
Definition: ov-base.cc:1097
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:400
bool swap
Definition: load-save.cc:738
Complex expm1(const Complex &x)
Definition: lo-specfun.cc:1875
octave_value diag(octave_idx_type k=0) const
Definition: ov-cx-mat.cc:292
type_conv_info numeric_demotion_function(void) const
Definition: ov-cx-mat.cc:78
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:215
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
Definition: ov-struct.cc:1736
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
Definition: pr-output.cc:1780
nd deftypefn *std::string name
Definition: sysdep.cc:647
double acosh(double x)
Definition: lo-specfun.h:49
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:60
octave_value map(unary_mapper_t umap) const
Definition: ov-cx-mat.cc:745
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov-cx-mat.cc:234
ComplexMatrix diag(octave_idx_type k=0) const
Definition: CMatrix.cc:2999
octave_value diag(octave_idx_type k=0) const
Definition: ov-base-mat.h:127
FloatComplex float_complex_value(bool=false) const
Definition: ov-cx-mat.cc:192
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
Definition: ls-oct-text.cc:82
void read_doubles(std::istream &is, double *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
Definition: data-conv.cc:772
Complex log1p(const Complex &x)
Definition: lo-specfun.cc:1959
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
Definition: ls-hdf5.cc:190
octave_idx_type rows(void) const
Definition: ov-base.h:316
double signum(double x)
Definition: lo-mappers.h:244
octave_base_value * try_narrowing_conversion(void)
Definition: ov-cx-mat.cc:86
double dawson(double x)
Definition: lo-specfun.cc:1518
bool save_as_floats
Definition: load-save.cc:1617
void resize(const dim_vector &dv, const T &rfv)
Resizing (with fill).
Definition: Array.cc:1010
octave_hdf5_id save_type_to_hdf5(save_type st)
Definition: ls-hdf5.cc:997
double tmp
Definition: data.cc:6252
octave_value retval
Definition: data.cc:6246
#define panic_impossible()
Definition: error.h:40
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
int64_t octave_hdf5_id
double atanh(double x)
Definition: lo-specfun.h:72
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
Definition: boolMatrix.cc:89
void warn_save(const char *type) const
Definition: ov-base.cc:1106
octave_value as_double(void) const
Definition: ov-cx-mat.cc:280
double double_value(bool=false) const
Definition: ov-cx-mat.cc:106
Definition: dMatrix.h:36
Complex erf(const Complex &x)
Definition: lo-specfun.cc:1638
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-cx-mat.cc:454
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:123
void mxArray
Definition: mex.h:55
bool any_element_is_nan(void) const
Definition: CNDArray.cc:500
void warning(const char *fmt,...)
Definition: error.cc:801
ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:210
SparseMatrix sparse_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:260
bool all_integers(double &max_val, double &min_val) const
Definition: CNDArray.cc:524
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector &d)
Definition: ls-hdf5.cc:897
void err_invalid_conversion(const std::string &from, const std::string &to)
Definition: errwarn.cc:68
Complex complex_value(bool=false) const
Definition: ov-cx-mat.cc:180
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition: dim-vector.h:362
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
p
Definition: lu.cc:138
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition: errwarn.cc:338
bool isfinite(double x)
Definition: lo-mappers.h:201
mxArray * as_mxArray(void) const
Definition: ov-cx-mat.cc:724
double roundb(double x)
Definition: lo-mappers.h:156
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:41
octave_idx_type numel(void) const
Definition: ov-base-mat.h:107
double round(double x)
Definition: lo-mappers.h:145
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:141
for i
Definition: data.cc:5264
const octave_hdf5_id octave_H5P_DEFAULT
octave_idx_type columns(void) const
Definition: ov-base.h:323
std::complex< float > FloatComplex
Definition: oct-cmplx.h:32
static int static_type_id(void)
bool all_elements_are_real(void) const
Definition: CNDArray.cc:514
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:295
std::complex< double > Complex
Definition: oct-cmplx.h:31
NDArray array_value(bool=false) const
Definition: ov-cx-mat.cc:138
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:366
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:135
OCTAVE_IDX_TYPE mwIndex
Definition: mxarray.in.h:94
write the output to stdout if nargout is
Definition: load-save.cc:1612
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
octave_hdf5_id hdf5_make_complex_type(octave_hdf5_id num_type)
Definition: ls-hdf5.cc:326
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
Definition: utils.cc:888
dim_vector dv
Definition: sub2ind.cc:263
FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-cx-mat.cc:254
octave::stream os
Definition: file-io.cc:627
static const double pi
Definition: lo-specfun.cc:1996
int ndims(void) const
Definition: Array.h:590
std::complex< double > erfc(std::complex< double > z, double relerr=0)