GNU Octave  8.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-flt-cx-mat.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 1996-2023 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <clocale>
31 #include <istream>
32 #include <ostream>
33 #include <vector>
34 
35 #include "dNDArray.h"
36 #include "fNDArray.h"
37 
38 #include "data-conv.h"
39 #include "lo-ieee.h"
40 #include "lo-specfun.h"
41 #include "lo-mappers.h"
42 #include "mx-base.h"
43 #include "mach-info.h"
44 #include "oct-locbuf.h"
45 
46 #include "errwarn.h"
47 #include "mxarray.h"
48 #include "ovl.h"
49 #include "oct-hdf5.h"
50 #include "oct-stream.h"
51 #include "ops.h"
52 #include "ov-base.h"
53 #include "ov-base-mat.h"
54 #include "ov-base-mat.cc"
55 #include "ov-complex.h"
56 #include "ov-flt-complex.h"
57 #include "ov-cx-mat.h"
58 #include "ov-flt-cx-mat.h"
59 #include "ov-re-mat.h"
60 #include "ov-flt-re-mat.h"
61 #include "ov-scalar.h"
62 #include "ov-float.h"
63 #include "pr-output.h"
64 #include "ops.h"
65 
66 #include "byte-swap.h"
67 #include "ls-oct-text.h"
68 #include "ls-hdf5.h"
69 #include "ls-utils.h"
70 
71 
73 
75  "float complex matrix", "single");
76 
79 {
80  octave_base_value *retval = nullptr;
81 
82  if (m_matrix.numel () == 1)
83  {
84  FloatComplex c = m_matrix (0);
85 
86  if (c.imag () == 0.0)
87  retval = new octave_float_scalar (c.real ());
88  else
89  retval = new octave_float_complex (c);
90  }
91  else if (m_matrix.all_elements_are_real ())
92  retval = new octave_float_matrix (::real (m_matrix));
93 
94  return retval;
95 }
96 
97 double
98 octave_float_complex_matrix::double_value (bool force_conversion) const
99 {
100  if (! force_conversion)
101  warn_implicit_conversion ("Octave:imag-to-real",
102  "complex matrix", "real scalar");
103 
104  if (rows () == 0 || columns () == 0)
105  err_invalid_conversion ("complex matrix", "real scalar");
106 
107  warn_implicit_conversion ("Octave:array-to-scalar",
108  "complex matrix", "real scalar");
109 
110  return std::real (m_matrix(0, 0));
111 }
112 
113 float
114 octave_float_complex_matrix::float_value (bool force_conversion) const
115 {
116  if (! force_conversion)
117  warn_implicit_conversion ("Octave:imag-to-real",
118  "complex matrix", "real scalar");
119 
120  if (rows () == 0 || columns () == 0)
121  err_invalid_conversion ("complex matrix", "real scalar");
122 
123  warn_implicit_conversion ("Octave:array-to-scalar",
124  "complex matrix", "real scalar");
125 
126  return std::real (m_matrix(0, 0));
127 }
128 
129 Matrix
130 octave_float_complex_matrix::matrix_value (bool force_conversion) const
131 {
132  Matrix retval;
133 
134  if (! force_conversion)
135  warn_implicit_conversion ("Octave:imag-to-real",
136  "complex matrix", "real matrix");
137 
138  retval = ::real (FloatComplexMatrix (m_matrix));
139 
140  return retval;
141 }
142 
145 {
146  FloatMatrix retval;
147 
148  if (! force_conversion)
149  warn_implicit_conversion ("Octave:imag-to-real",
150  "complex matrix", "real matrix");
151 
152  retval = ::real (FloatComplexMatrix (m_matrix));
153 
154  return retval;
155 }
156 
157 Complex
159 {
160  if (rows () == 0 || columns () == 0)
161  err_invalid_conversion ("complex matrix", "complex scalar");
162 
163  warn_implicit_conversion ("Octave:array-to-scalar",
164  "complex matrix", "complex scalar");
165 
166  return m_matrix(0, 0);
167 }
168 
171 {
172  float tmp = lo_ieee_float_nan_value ();
173 
174  FloatComplex retval (tmp, tmp);
175 
176  if (rows () == 0 || columns () == 0)
177  err_invalid_conversion ("complex matrix", "complex scalar");
178 
179  warn_implicit_conversion ("Octave:array-to-scalar",
180  "complex matrix", "complex scalar");
181 
182  retval = m_matrix(0, 0);
183 
184  return retval;
185 }
186 
189 {
190  return FloatComplexMatrix (m_matrix);
191 }
192 
195 {
196  return FloatComplexMatrix (m_matrix);
197 }
198 
201 {
204  if (warn && (! m_matrix.all_elements_are_real ()
205  || real (m_matrix).any_element_not_one_or_zero ()))
207 
208  return mx_el_ne (m_matrix, FloatComplex (0.0));
209 }
210 
213 {
214  charNDArray retval;
215 
216  if (! frc_str_conv)
217  warn_implicit_conversion ("Octave:num-to-str",
218  "complex matrix", "string");
219  else
220  {
221  retval = charNDArray (dims ());
222  octave_idx_type nel = numel ();
223 
224  for (octave_idx_type i = 0; i < nel; i++)
225  retval.elem (i) = static_cast<char> (std::real (m_matrix.elem (i)));
226  }
227 
228  return retval;
229 }
230 
233 {
234  return FloatComplexNDArray (m_matrix);
235 }
236 
239 {
240  SparseMatrix retval;
241 
242  if (! force_conversion)
243  warn_implicit_conversion ("Octave:imag-to-real",
244  "complex matrix", "real matrix");
245 
246  retval = SparseMatrix (::real (complex_matrix_value ()));
247 
248  return retval;
249 }
250 
253 {
255 }
256 
259 {
260  return ComplexNDArray (m_matrix);
261 }
262 
265 {
266  return m_matrix;
267 }
268 
271 {
272  octave_value retval;
273  if (k == 0 && m_matrix.ndims () == 2
274  && (m_matrix.rows () == 1 || m_matrix.columns () == 1))
276  else
278 
279  return retval;
280 }
281 
284 {
285  if (m_matrix.ndims () != 2
286  || (m_matrix.rows () != 1 && m_matrix.columns () != 1))
287  error ("diag: expecting vector argument");
288 
290 
291  return mat.diag (m, n);
292 }
293 
294 bool
296 {
297  dim_vector dv = dims ();
298 
299  if (dv.ndims () > 2)
300  {
302 
303  os << "# ndims: " << dv.ndims () << "\n";
304 
305  for (int i = 0; i < dv.ndims (); i++)
306  os << ' ' << dv(i);
307 
308  os << "\n" << tmp;
309  }
310  else
311  {
312  // Keep this case, rather than use generic code above for backward
313  // compatibility. Makes load_ascii much more complex!!
314  os << "# rows: " << rows () << "\n"
315  << "# columns: " << columns () << "\n";
316 
317  os << complex_matrix_value ();
318  }
319 
320  return true;
321 }
322 
323 bool
325 {
326  string_vector keywords(2);
327 
328  keywords[0] = "ndims";
329  keywords[1] = "rows";
330 
331  std::string kw;
332  octave_idx_type val = 0;
333 
334  if (! extract_keyword (is, keywords, kw, val, true))
335  error ("load: failed to extract number of rows and columns");
336 
337  // Set "C" locale for the duration of this function to avoid the performance
338  // panelty of frequently switching the locale when reading floating point
339  // values from the stream.
340  char *prev_locale = std::setlocale (LC_ALL, nullptr);
341  std::string old_locale (prev_locale ? prev_locale : "");
342  std::setlocale (LC_ALL, "C");
343  octave::unwind_action act
344  ([&old_locale] () { std::setlocale (LC_ALL, old_locale.c_str ()); });
345 
346  if (kw == "ndims")
347  {
348  int mdims = static_cast<int> (val);
349 
350  if (mdims < 0)
351  error ("load: failed to extract number of dimensions");
352 
353  dim_vector dv;
354  dv.resize (mdims);
355 
356  for (int i = 0; i < mdims; i++)
357  is >> dv(i);
358 
359  if (! is)
360  error ("load: failed to read dimensions");
361 
362  FloatComplexNDArray tmp(dv);
363 
364  is >> tmp;
365 
366  if (! is)
367  error ("load: failed to load matrix constant");
368 
369  m_matrix = tmp;
370  }
371  else if (kw == "rows")
372  {
373  octave_idx_type nr = val;
374  octave_idx_type nc = 0;
375 
376  if (nr < 0 || ! extract_keyword (is, "columns", nc) || nc < 0)
377  error ("load: failed to extract number of rows and columns");
378 
379  if (nr > 0 && nc > 0)
380  {
381  FloatComplexMatrix tmp (nr, nc);
382  is >> tmp;
383  if (! is)
384  error ("load: failed to load matrix constant");
385 
386  m_matrix = tmp;
387  }
388  else if (nr == 0 || nc == 0)
389  m_matrix = FloatComplexMatrix (nr, nc);
390  else
391  panic_impossible ();
392  }
393  else
394  panic_impossible ();
395 
396  return true;
397 }
398 
399 bool
401 {
402  dim_vector dv = dims ();
403  if (dv.ndims () < 1)
404  return false;
405 
406  // Use negative value for ndims to differentiate with old format!!
407  int32_t tmp = - dv.ndims ();
408  os.write (reinterpret_cast<char *> (&tmp), 4);
409  for (int i = 0; i < dv.ndims (); i++)
410  {
411  tmp = dv(i);
412  os.write (reinterpret_cast<char *> (&tmp), 4);
413  }
414 
416  save_type st = LS_FLOAT;
417  if (dv.numel () > 4096) // FIXME: make this configurable.
418  {
419  float max_val, min_val;
420  if (m.all_integers (max_val, min_val))
421  st = octave::get_save_type (max_val, min_val);
422  }
423 
424  const FloatComplex *mtmp = m.data ();
425  write_floats (os, reinterpret_cast<const float *> (mtmp), st,
426  2 * dv.numel ());
427 
428  return true;
429 }
430 
431 bool
432 octave_float_complex_matrix::load_binary (std::istream& is, bool swap,
434 {
435  char tmp;
436  int32_t mdims;
437  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
438  return false;
439  if (swap)
440  swap_bytes<4> (&mdims);
441  if (mdims < 0)
442  {
443  mdims = - mdims;
444  int32_t di;
445  dim_vector dv;
446  dv.resize (mdims);
447 
448  for (int i = 0; i < mdims; i++)
449  {
450  if (! is.read (reinterpret_cast<char *> (&di), 4))
451  return false;
452  if (swap)
453  swap_bytes<4> (&di);
454  dv(i) = di;
455  }
456 
457  // Convert an array with a single dimension to be a row vector.
458  // Octave should never write files like this, other software
459  // might.
460 
461  if (mdims == 1)
462  {
463  mdims = 2;
464  dv.resize (mdims);
465  dv(1) = dv(0);
466  dv(0) = 1;
467  }
468 
469  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
470  return false;
471 
473  FloatComplex *im = m.fortran_vec ();
474  read_floats (is, reinterpret_cast<float *> (im),
475  static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
476 
477  if (! is)
478  return false;
479 
480  m_matrix = m;
481  }
482  else
483  {
484  int32_t nr, nc;
485  nr = mdims;
486  if (! is.read (reinterpret_cast<char *> (&nc), 4))
487  return false;
488  if (swap)
489  swap_bytes<4> (&nc);
490  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
491  return false;
492  FloatComplexMatrix m (nr, nc);
493  FloatComplex *im = m.fortran_vec ();
494  octave_idx_type len = static_cast<octave_idx_type> (nr) * nc;
495  read_floats (is, reinterpret_cast<float *> (im),
496  static_cast<save_type> (tmp), 2*len, swap, fmt);
497 
498  if (! is)
499  return false;
500 
501  m_matrix = m;
502  }
503  return true;
504 }
505 
506 bool
508  bool)
509 {
510  bool retval = false;
511 
512 #if defined (HAVE_HDF5)
513 
514  dim_vector dv = dims ();
515  int empty = save_hdf5_empty (loc_id, name, dv);
516  if (empty)
517  return (empty > 0);
518 
519  int rank = dv.ndims ();
520  hid_t space_hid, data_hid, type_hid;
521  space_hid = data_hid = type_hid = -1;
523 
524  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
525 
526  // Octave uses column-major, while HDF5 uses row-major ordering
527  for (int i = 0; i < rank; i++)
528  hdims[i] = dv(rank-i-1);
529 
530  space_hid = H5Screate_simple (rank, hdims, nullptr);
531  if (space_hid < 0) return false;
532 
533  hid_t save_type_hid = H5T_NATIVE_FLOAT;
534 
535 #if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
536  // hdf5 currently doesn't support float/integer conversions
537  else
538  {
539  float max_val, min_val;
540 
541  if (m.all_integers (max_val, min_val))
542  save_type_hid
543  = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
544  }
545 #endif
546 
547  type_hid = hdf5_make_complex_type (save_type_hid);
548  if (type_hid < 0)
549  {
550  H5Sclose (space_hid);
551  return false;
552  }
553 #if defined (HAVE_HDF5_18)
554  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
557 #else
558  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT);
559 #endif
560  if (data_hid < 0)
561  {
562  H5Sclose (space_hid);
563  H5Tclose (type_hid);
564  return false;
565  }
566 
567  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
568  if (complex_type_hid < 0) retval = false;
569 
570  if (retval)
571  {
572  FloatComplex *mtmp = m.fortran_vec ();
573  if (H5Dwrite (data_hid, complex_type_hid, octave_H5S_ALL, octave_H5S_ALL,
574  octave_H5P_DEFAULT, mtmp)
575  < 0)
576  {
577  H5Tclose (complex_type_hid);
578  retval = false;
579  }
580  }
581 
582  H5Tclose (complex_type_hid);
583  H5Dclose (data_hid);
584  H5Tclose (type_hid);
585  H5Sclose (space_hid);
586 
587 #else
588  octave_unused_parameter (loc_id);
589  octave_unused_parameter (name);
590 
591  warn_save ("hdf5");
592 #endif
593 
594  return retval;
595 }
596 
597 bool
599 {
600  bool retval = false;
601 
602 #if defined (HAVE_HDF5)
603 
604  dim_vector dv;
605  int empty = load_hdf5_empty (loc_id, name, dv);
606  if (empty > 0)
607  m_matrix.resize (dv);
608  if (empty)
609  return (empty > 0);
610 
611 #if defined (HAVE_HDF5_18)
612  hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
613 #else
614  hid_t data_hid = H5Dopen (loc_id, name);
615 #endif
616  hid_t type_hid = H5Dget_type (data_hid);
617 
618  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
619 
620  if (! hdf5_types_compatible (type_hid, complex_type))
621  {
622  H5Tclose (complex_type);
623  H5Dclose (data_hid);
624  return false;
625  }
626 
627  hid_t space_id = H5Dget_space (data_hid);
628 
629  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
630 
631  if (rank < 1)
632  {
633  H5Tclose (complex_type);
634  H5Sclose (space_id);
635  H5Dclose (data_hid);
636  return false;
637  }
638 
639  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
640  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
641 
642  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
643 
644  // Octave uses column-major, while HDF5 uses row-major ordering
645  if (rank == 1)
646  {
647  dv.resize (2);
648  dv(0) = 1;
649  dv(1) = hdims[0];
650  }
651  else
652  {
653  dv.resize (rank);
654  for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
655  dv(j) = hdims[i];
656  }
657 
658  FloatComplexNDArray m (dv);
659  FloatComplex *reim = m.fortran_vec ();
660  if (H5Dread (data_hid, complex_type, octave_H5S_ALL, octave_H5S_ALL,
661  octave_H5P_DEFAULT, reim)
662  >= 0)
663  {
664  retval = true;
665  m_matrix = m;
666  }
667 
668  H5Tclose (complex_type);
669  H5Sclose (space_id);
670  H5Dclose (data_hid);
671 
672 #else
673  octave_unused_parameter (loc_id);
674  octave_unused_parameter (name);
675 
676  warn_load ("hdf5");
677 #endif
678 
679  return retval;
680 }
681 
682 void
684  bool pr_as_read_syntax) const
685 {
686  octave_print_internal (os, m_matrix, pr_as_read_syntax,
688 }
689 
690 mxArray *
692 {
693  mxArray *retval = new mxArray (interleaved, mxSINGLE_CLASS, dims (),
694  mxCOMPLEX);
695 
696  mwSize nel = numel ();
697 
698  const FloatComplex *pdata = m_matrix.data ();
699 
700  if (interleaved)
701  {
702  mxComplexSingle *pd
703  = static_cast<mxComplexSingle *> (retval->get_data ());
704 
705  for (mwIndex i = 0; i < nel; i++)
706  {
707  pd[i].real = pdata[i].real ();
708  pd[i].imag = pdata[i].imag ();
709  }
710  }
711  else
712  {
713  mxSingle *pr = static_cast<mxSingle *> (retval->get_data ());
714  mxSingle *pi = static_cast<mxSingle *> (retval->get_imag_data ());
715 
716  for (mwIndex i = 0; i < nel; i++)
717  {
718  pr[i] = pdata[i].real ();
719  pi[i] = pdata[i].imag ();
720  }
721  }
722 
723  return retval;
724 }
725 
728 {
729  switch (umap)
730  {
731  // Mappers handled specially.
732  case umap_real:
734  case umap_imag:
736  case umap_conj:
738 
739  // Special cases for Matlab compatibility.
740  case umap_xtolower:
741  case umap_xtoupper:
742  return m_matrix;
743 
744 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
745  case umap_ ## UMAP: \
746  return octave_value (m_matrix.FCN ())
747 
752 
753 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
754  case umap_ ## UMAP: \
755  return octave_value (m_matrix.map<TYPE> (FCN))
756 
759  ARRAY_MAPPER (angle, float, std::arg);
760  ARRAY_MAPPER (arg, float, std::arg);
771  ARRAY_MAPPER (cos, FloatComplex, std::cos);
772  ARRAY_MAPPER (cosh, FloatComplex, std::cosh);
773  ARRAY_MAPPER (exp, FloatComplex, std::exp);
777  ARRAY_MAPPER (log, FloatComplex, std::log);
779  ARRAY_MAPPER (log10, FloatComplex, std::log10);
784  ARRAY_MAPPER (sin, FloatComplex, std::sin);
785  ARRAY_MAPPER (sinh, FloatComplex, std::sinh);
786  ARRAY_MAPPER (sqrt, FloatComplex, std::sqrt);
787  ARRAY_MAPPER (tan, FloatComplex, std::tan);
788  ARRAY_MAPPER (tanh, FloatComplex, std::tanh);
790 
791  default:
792  return octave_base_value::map (umap);
793  }
794 }
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:217
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
Definition: boolMatrix.cc:91
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:63
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type columns(void) const
Definition: Array.h:471
OCTARRAY_OVERRIDABLE_FUNC_API const T * data(void) const
Size of the specified dimension.
Definition: Array.h:663
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:414
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array-base.cc:1032
OCTARRAY_OVERRIDABLE_FUNC_API octave_idx_type rows(void) const
Definition: Array.h:459
OCTARRAY_OVERRIDABLE_FUNC_API int ndims(void) const
Size of the specified dimension.
Definition: Array.h:677
OCTARRAY_OVERRIDABLE_FUNC_API T & elem(octave_idx_type n)
Size of the specified dimension.
Definition: Array.h:562
OCTAVE_API FloatComplexMatrix diag(octave_idx_type k=0) const
Definition: fCMatrix.cc:2858
OCTAVE_API bool any_element_is_nan(void) const
Definition: fCNDArray.cc:265
OCTAVE_API bool all_elements_are_real(void) const
Definition: fCNDArray.cc:279
Definition: dMatrix.h:42
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition: dim-vector.h:335
void resize(int n, int fill_value=0)
Definition: dim-vector.h:272
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:257
void * get_imag_data(void) const
Definition: mxarray.h:562
void * get_data(void) const
Definition: mxarray.h:497
octave_idx_type numel(void) const
Definition: ov-base-mat.h:119
octave_value diag(octave_idx_type k=0) const
Definition: ov-base-mat.h:139
octave_idx_type columns(void) const
Definition: ov-base.h:363
int current_print_indent_level(void) const
Definition: ov-base.h:903
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1181
OCTINTERP_API void warn_load(const char *type) const
Definition: ov-base.cc:1157
octave_idx_type rows(void) const
Definition: ov-base.h:356
OCTINTERP_API void warn_save(const char *type) const
Definition: ov-base.cc:1166
mxArray * as_mxArray(bool interleaved) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
ComplexMatrix complex_matrix_value(bool=false) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
SparseMatrix sparse_matrix_value(bool=false) const
FloatComplex float_complex_value(bool=false) const
FloatComplexNDArray float_complex_array_value(bool=false) const
bool save_binary(std::ostream &os, bool save_as_floats)
FloatComplexMatrix float_complex_matrix_value(bool=false) const
bool save_ascii(std::ostream &os)
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
octave_value diag(octave_idx_type k=0) const
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
octave_base_value * try_narrowing_conversion(void)
double double_value(bool=false) const
bool load_ascii(std::istream &is)
ComplexNDArray complex_array_value(bool=false) const
Matrix matrix_value(bool=false) const
boolNDArray bool_array_value(bool warn=false) const
charNDArray char_array_value(bool frc_str_conv=false) const
FloatMatrix float_matrix_value(bool=false) const
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_value as_single(void) const
octave_value as_double(void) const
float float_value(bool=false) const
Complex complex_value(bool=false) const
octave_value map(unary_mapper_t umap) const
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5S_ALL
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:137
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:143
void write_floats(std::ostream &os, const float *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:942
void read_floats(std::istream &is, float *data, save_type type, octave_idx_type len, bool swap, octave::mach_info::float_format fmt)
Definition: data-conv.cc:836
save_type
Definition: data-conv.h:87
@ LS_FLOAT
Definition: data-conv.h:94
void error(const char *fmt,...)
Definition: error.cc:979
#define panic_impossible()
Definition: error.h:508
void err_invalid_conversion(const std::string &from, const std::string &to)
Definition: errwarn.cc:71
void warn_logical_conversion(void)
Definition: errwarn.cc:365
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition: errwarn.cc:344
void err_nan_to_logical_conversion(void)
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:116
Complex log2(const Complex &x)
Definition: lo-mappers.cc:139
Complex asin(const Complex &x)
Definition: lo-mappers.cc:107
bool isna(double x)
Definition: lo-mappers.cc:47
Complex acos(const Complex &x)
Definition: lo-mappers.cc:85
Complex atan(const Complex &x)
Definition: lo-mappers.h:71
double roundb(double x)
Definition: lo-mappers.h:147
bool isfinite(double x)
Definition: lo-mappers.h:192
bool isinf(double x)
Definition: lo-mappers.h:203
double signum(double x)
Definition: lo-mappers.h:229
double round(double x)
Definition: lo-mappers.h:136
bool isnan(bool)
Definition: lo-mappers.h:178
std::complex< T > floor(const std::complex< T > &x)
Definition: lo-mappers.h:130
std::complex< T > ceil(const std::complex< T > &x)
Definition: lo-mappers.h:103
double fix(double x)
Definition: lo-mappers.h:118
double dawson(double x)
Definition: lo-specfun.cc:1466
static const double pi
Definition: lo-specfun.cc:1944
Complex expm1(const Complex &x)
Definition: lo-specfun.cc:1823
Complex log1p(const Complex &x)
Definition: lo-specfun.cc:1907
double asinh(double x)
Definition: lo-specfun.h:58
double atanh(double x)
Definition: lo-specfun.h:63
double acosh(double x)
Definition: lo-specfun.h:40
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector &d)
Definition: ls-hdf5.cc:1249
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Definition: ls-hdf5.cc:1306
octave_hdf5_id save_type_to_hdf5(save_type st)
Definition: ls-hdf5.cc:1350
octave_hdf5_id hdf5_make_complex_type(octave_hdf5_id num_type)
Definition: ls-hdf5.cc:405
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
Definition: ls-hdf5.cc:269
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
Definition: ls-oct-text.cc:84
save_type get_save_type(double, double)
Definition: ls-utils.cc:40
float_format
Definition: mach-info.h:38
void mxArray
Definition: mex.h:58
class OCTAVE_API charNDArray
Definition: mx-fwd.h:43
class OCTAVE_API SparseMatrix
Definition: mx-fwd.h:55
class OCTAVE_API FloatComplexMatrix
Definition: mx-fwd.h:34
class OCTAVE_API ComplexNDArray
Definition: mx-fwd.h:39
class OCTAVE_API SparseComplexMatrix
Definition: mx-fwd.h:56
class OCTAVE_API FloatComplexNDArray
Definition: mx-fwd.h:41
class OCTAVE_API FloatComplexDiagMatrix
Definition: mx-fwd.h:62
T octave_idx_type m
Definition: mx-inlines.cc:773
octave_idx_type n
Definition: mx-inlines.cc:753
std::complex< double > erfc(std::complex< double > z, double relerr=0)
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
std::complex< double > erfi(std::complex< double > z, double relerr=0)
std::complex< double > erf(std::complex< double > z, double relerr=0)
std::complex< double > Complex
Definition: oct-cmplx.h:33
std::complex< float > FloatComplex
Definition: oct-cmplx.h:34
int64_t octave_hdf5_id
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:44
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:229
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
Definition: pr-output.cc:1762
static T abs(T x)
Definition: pr-output.cc:1678
F77_RET_T len
Definition: xerbla.cc:61