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-flt-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-flt-complex.h"
50 #include "ov-cx-mat.h"
51 #include "ov-flt-cx-mat.h"
52 #include "ov-re-mat.h"
53 #include "ov-flt-re-mat.h"
54 #include "ov-scalar.h"
55 #include "ov-float.h"
56 #include "pr-output.h"
57 #include "ops.h"
58 
59 #include "byte-swap.h"
60 #include "ls-oct-ascii.h"
61 #include "ls-hdf5.h"
62 #include "ls-utils.h"
63 
65 
66 
68  "float complex matrix", "single");
69 
72 {
73  octave_base_value *retval = 0;
74 
75  if (matrix.numel () == 1)
76  {
77  FloatComplex c = matrix (0);
78 
79  if (std::imag (c) == 0.0)
80  retval = new octave_float_scalar (std::real (c));
81  else
82  retval = new octave_float_complex (c);
83  }
84  else if (matrix.all_elements_are_real ())
85  retval = new octave_float_matrix (::real (matrix));
86 
87  return retval;
88 }
89 
90 double
91 octave_float_complex_matrix::double_value (bool force_conversion) const
92 {
93  double retval = lo_ieee_nan_value ();
94 
95  if (! force_conversion)
96  gripe_implicit_conversion ("Octave:imag-to-real",
97  "complex matrix", "real scalar");
98 
99  if (rows () > 0 && columns () > 0)
100  {
101  gripe_implicit_conversion ("Octave:array-to-scalar",
102  "complex matrix", "real scalar");
103 
104  retval = std::real (matrix (0, 0));
105  }
106  else
107  gripe_invalid_conversion ("complex matrix", "real scalar");
108 
109  return retval;
110 }
111 
112 float
113 octave_float_complex_matrix::float_value (bool force_conversion) const
114 {
115  float retval = lo_ieee_float_nan_value ();
116 
117  if (! force_conversion)
118  gripe_implicit_conversion ("Octave:imag-to-real",
119  "complex matrix", "real scalar");
120 
121  if (rows () > 0 && columns () > 0)
122  {
123  gripe_implicit_conversion ("Octave:array-to-scalar",
124  "complex matrix", "real scalar");
125 
126  retval = std::real (matrix (0, 0));
127  }
128  else
129  gripe_invalid_conversion ("complex matrix", "real scalar");
130 
131  return retval;
132 }
133 
134 Matrix
135 octave_float_complex_matrix::matrix_value (bool force_conversion) const
136 {
137  Matrix retval;
138 
139  if (! force_conversion)
140  gripe_implicit_conversion ("Octave:imag-to-real",
141  "complex matrix", "real matrix");
142 
143  retval = ::real (FloatComplexMatrix (matrix));
144 
145  return retval;
146 }
147 
150 {
151  FloatMatrix retval;
152 
153  if (! force_conversion)
154  gripe_implicit_conversion ("Octave:imag-to-real",
155  "complex matrix", "real matrix");
156 
157  retval = ::real (FloatComplexMatrix (matrix));
158 
159  return retval;
160 }
161 
162 Complex
164 {
165  double tmp = lo_ieee_nan_value ();
166 
167  Complex retval (tmp, tmp);
168 
169  if (rows () > 0 && columns () > 0)
170  {
171  gripe_implicit_conversion ("Octave:array-to-scalar",
172  "complex matrix", "complex scalar");
173 
174  retval = matrix (0, 0);
175  }
176  else
177  gripe_invalid_conversion ("complex matrix", "complex scalar");
178 
179  return retval;
180 }
181 
184 {
185  float tmp = lo_ieee_float_nan_value ();
186 
187  FloatComplex retval (tmp, tmp);
188 
189  if (rows () > 0 && columns () > 0)
190  {
191  gripe_implicit_conversion ("Octave:array-to-scalar",
192  "complex matrix", "complex scalar");
193 
194  retval = matrix (0, 0);
195  }
196  else
197  gripe_invalid_conversion ("complex matrix", "complex scalar");
198 
199  return retval;
200 }
201 
204 {
205  return FloatComplexMatrix (matrix);
206 }
207 
210 {
211  return FloatComplexMatrix (matrix);
212 }
213 
216 {
217  if (matrix.any_element_is_nan ())
219  else if (warn && (! matrix.all_elements_are_real ()
220  || real (matrix).any_element_not_one_or_zero ()))
222 
223  return mx_el_ne (matrix, FloatComplex (0.0));
224 }
225 
228 {
229  charNDArray retval;
230 
231  if (! frc_str_conv)
232  gripe_implicit_conversion ("Octave:num-to-str",
233  "complex matrix", "string");
234  else
235  {
236  retval = charNDArray (dims ());
237  octave_idx_type nel = numel ();
238 
239  for (octave_idx_type i = 0; i < nel; i++)
240  retval.elem (i) = static_cast<char>(std::real (matrix.elem (i)));
241  }
242 
243  return retval;
244 }
245 
248 {
249  return FloatComplexNDArray (matrix);
250 }
251 
254 {
255  SparseMatrix retval;
256 
257  if (! force_conversion)
258  gripe_implicit_conversion ("Octave:imag-to-real",
259  "complex matrix", "real matrix");
260 
261  retval = SparseMatrix (::real (complex_matrix_value ()));
262 
263  return retval;
264 }
265 
268 {
270 }
271 
274 {
275  octave_value retval;
276  if (k == 0 && matrix.ndims () == 2
277  && (matrix.rows () == 1 || matrix.columns () == 1))
279  else
281 
282  return retval;
283 }
284 
287 {
288  octave_value retval;
289 
290  if (matrix.ndims () == 2
291  && (matrix.rows () == 1 || matrix.columns () == 1))
292  {
294 
295  retval = mat.diag (m, n);
296  }
297  else
298  error ("diag: expecting vector argument");
299 
300  return retval;
301 }
302 
303 bool
305 {
306  dim_vector d = dims ();
307  if (d.length () > 2)
308  {
310 
311  os << "# ndims: " << d.length () << "\n";
312 
313  for (int i = 0; i < d.length (); i++)
314  os << " " << d (i);
315 
316  os << "\n" << tmp;
317  }
318  else
319  {
320  // Keep this case, rather than use generic code above for backward
321  // compatiability. Makes load_ascii much more complex!!
322  os << "# rows: " << rows () << "\n"
323  << "# columns: " << columns () << "\n";
324 
325  os << complex_matrix_value ();
326  }
327 
328  return true;
329 }
330 
331 bool
333 {
334  bool success = true;
335 
337 
338  keywords[0] = "ndims";
339  keywords[1] = "rows";
340 
341  std::string kw;
342  octave_idx_type val = 0;
343 
344  if (extract_keyword (is, keywords, kw, val, true))
345  {
346  if (kw == "ndims")
347  {
348  int mdims = static_cast<int> (val);
349 
350  if (mdims >= 0)
351  {
352  dim_vector dv;
353  dv.resize (mdims);
354 
355  for (int i = 0; i < mdims; i++)
356  is >> dv(i);
357 
358  if (is)
359  {
360  FloatComplexNDArray tmp(dv);
361 
362  is >> tmp;
363 
364  if (is)
365  matrix = tmp;
366  else
367  {
368  error ("load: failed to load matrix constant");
369  success = false;
370  }
371  }
372  else
373  {
374  error ("load: failed to read dimensions");
375  success = false;
376  }
377  }
378  else
379  {
380  error ("load: failed to extract number of dimensions");
381  success = false;
382  }
383  }
384  else if (kw == "rows")
385  {
386  octave_idx_type nr = val;
387  octave_idx_type nc = 0;
388 
389  if (nr >= 0 && extract_keyword (is, "columns", nc) && nc >= 0)
390  {
391  if (nr > 0 && nc > 0)
392  {
393  FloatComplexMatrix tmp (nr, nc);
394  is >> tmp;
395  if (is)
396  matrix = tmp;
397  else
398  {
399  error ("load: failed to load matrix constant");
400  success = false;
401  }
402  }
403  else if (nr == 0 || nc == 0)
404  matrix = FloatComplexMatrix (nr, nc);
405  else
406  panic_impossible ();
407  }
408  else
409  {
410  error ("load: failed to extract number of rows and columns");
411  success = false;
412  }
413  }
414  else
415  panic_impossible ();
416  }
417  else
418  {
419  error ("load: failed to extract number of rows and columns");
420  success = false;
421  }
422 
423  return success;
424 }
425 
426 bool
428 {
429  dim_vector d = dims ();
430  if (d.length () < 1)
431  return false;
432 
433  // Use negative value for ndims to differentiate with old format!!
434  int32_t tmp = - d.length ();
435  os.write (reinterpret_cast<char *> (&tmp), 4);
436  for (int i = 0; i < d.length (); i++)
437  {
438  tmp = d(i);
439  os.write (reinterpret_cast<char *> (&tmp), 4);
440  }
441 
443  save_type st = LS_FLOAT;
444  if (d.numel () > 4096) // FIXME: make this configurable.
445  {
446  float max_val, min_val;
447  if (m.all_integers (max_val, min_val))
448  st = get_save_type (max_val, min_val);
449  }
450 
451  const FloatComplex *mtmp = m.data ();
452  write_floats (os, reinterpret_cast<const float *> (mtmp), st, 2 * d.numel ());
453 
454  return true;
455 }
456 
457 bool
458 octave_float_complex_matrix::load_binary (std::istream& is, bool swap,
460 {
461  char tmp;
462  int32_t mdims;
463  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
464  return false;
465  if (swap)
466  swap_bytes<4> (&mdims);
467  if (mdims < 0)
468  {
469  mdims = - mdims;
470  int32_t di;
471  dim_vector dv;
472  dv.resize (mdims);
473 
474  for (int i = 0; i < mdims; i++)
475  {
476  if (! is.read (reinterpret_cast<char *> (&di), 4))
477  return false;
478  if (swap)
479  swap_bytes<4> (&di);
480  dv(i) = di;
481  }
482 
483  // Convert an array with a single dimension to be a row vector.
484  // Octave should never write files like this, other software
485  // might.
486 
487  if (mdims == 1)
488  {
489  mdims = 2;
490  dv.resize (mdims);
491  dv(1) = dv(0);
492  dv(0) = 1;
493  }
494 
495  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
496  return false;
497 
498  FloatComplexNDArray m(dv);
499  FloatComplex *im = m.fortran_vec ();
500  read_floats (is, reinterpret_cast<float *> (im),
501  static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
502  if (error_state || ! is)
503  return false;
504  matrix = m;
505  }
506  else
507  {
508  int32_t nr, nc;
509  nr = mdims;
510  if (! is.read (reinterpret_cast<char *> (&nc), 4))
511  return false;
512  if (swap)
513  swap_bytes<4> (&nc);
514  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
515  return false;
516  FloatComplexMatrix m (nr, nc);
517  FloatComplex *im = m.fortran_vec ();
518  octave_idx_type len = nr * nc;
519  read_floats (is, reinterpret_cast<float *> (im),
520  static_cast<save_type> (tmp), 2*len, swap, fmt);
521  if (error_state || ! is)
522  return false;
523  matrix = m;
524  }
525  return true;
526 }
527 
528 bool
530 {
531  bool retval = false;
532 
533 #if defined (HAVE_HDF5)
534 
535  dim_vector dv = dims ();
536  int empty = save_hdf5_empty (loc_id, name, dv);
537  if (empty)
538  return (empty > 0);
539 
540  int rank = dv.length ();
541  hid_t space_hid, data_hid, type_hid;
542  space_hid = data_hid = type_hid = -1;
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, 0);
552  if (space_hid < 0) return false;
553 
554  hid_t save_type_hid = H5T_NATIVE_FLOAT;
555 
556 #if HAVE_HDF5_INT2FLOAT_CONVERSIONS
557  // hdf5 currently doesn't support float/integer conversions
558  else
559  {
560  float max_val, min_val;
561 
562  if (m.all_integers (max_val, min_val))
563  save_type_hid
564  = save_type_to_hdf5 (get_save_type (max_val, min_val));
565  }
566 #endif /* HAVE_HDF5_INT2FLOAT_CONVERSIONS */
567 
568  type_hid = hdf5_make_complex_type (save_type_hid);
569  if (type_hid < 0)
570  {
571  H5Sclose (space_hid);
572  return false;
573  }
574 #if HAVE_HDF5_18
575  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
576  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
577 #else
578  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
579 #endif
580  if (data_hid < 0)
581  {
582  H5Sclose (space_hid);
583  H5Tclose (type_hid);
584  return false;
585  }
586 
587  hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
588  if (complex_type_hid < 0) retval = false;
589 
590  if (retval)
591  {
592  FloatComplex *mtmp = m.fortran_vec ();
593  if (H5Dwrite (data_hid, complex_type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
594  mtmp) < 0)
595  {
596  H5Tclose (complex_type_hid);
597  retval = false;
598  }
599  }
600 
601  H5Tclose (complex_type_hid);
602  H5Dclose (data_hid);
603  H5Tclose (type_hid);
604  H5Sclose (space_hid);
605 
606 #else
607  gripe_save ("hdf5");
608 #endif
609 
610  return retval;
611 }
612 
613 bool
615 {
616  bool retval = false;
617 
618 #if defined (HAVE_HDF5)
619 
620  dim_vector dv;
621  int empty = load_hdf5_empty (loc_id, name, dv);
622  if (empty > 0)
623  matrix.resize (dv);
624  if (empty)
625  return (empty > 0);
626 
627 #if HAVE_HDF5_18
628  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
629 #else
630  hid_t data_hid = H5Dopen (loc_id, name);
631 #endif
632  hid_t type_hid = H5Dget_type (data_hid);
633 
634  hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
635 
636  if (! hdf5_types_compatible (type_hid, complex_type))
637  {
638  H5Tclose (complex_type);
639  H5Dclose (data_hid);
640  return false;
641  }
642 
643  hid_t space_id = H5Dget_space (data_hid);
644 
645  hsize_t rank = H5Sget_simple_extent_ndims (space_id);
646 
647  if (rank < 1)
648  {
649  H5Tclose (complex_type);
650  H5Sclose (space_id);
651  H5Dclose (data_hid);
652  return false;
653  }
654 
655  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
656  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
657 
658  H5Sget_simple_extent_dims (space_id, hdims, maxdims);
659 
660  // Octave uses column-major, while HDF5 uses row-major ordering
661  if (rank == 1)
662  {
663  dv.resize (2);
664  dv(0) = 1;
665  dv(1) = hdims[0];
666  }
667  else
668  {
669  dv.resize (rank);
670  for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
671  dv(j) = hdims[i];
672  }
673 
674  FloatComplexNDArray m (dv);
675  FloatComplex *reim = m.fortran_vec ();
676  if (H5Dread (data_hid, complex_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
677  reim) >= 0)
678  {
679  retval = true;
680  matrix = m;
681  }
682 
683  H5Tclose (complex_type);
684  H5Sclose (space_id);
685  H5Dclose (data_hid);
686 
687 #else
688  gripe_load ("hdf5");
689 #endif
690 
691  return retval;
692 }
693 
694 void
696  bool pr_as_read_syntax) const
697 {
698  octave_print_internal (os, matrix, pr_as_read_syntax,
700 }
701 
702 mxArray *
704 {
705  mxArray *retval = new mxArray (mxSINGLE_CLASS, dims (), mxCOMPLEX);
706 
707  float *pr = static_cast<float *> (retval->get_data ());
708  float *pi = static_cast<float *> (retval->get_imag_data ());
709 
710  mwSize nel = numel ();
711 
712  const FloatComplex *p = matrix.data ();
713 
714  for (mwIndex i = 0; i < nel; i++)
715  {
716  pr[i] = std::real (p[i]);
717  pi[i] = std::imag (p[i]);
718  }
719 
720  return retval;
721 }
722 
725 {
726  switch (umap)
727  {
728  // Mappers handled specially.
729  case umap_real:
731  case umap_imag:
733  case umap_conj:
735 
736 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
737  case umap_ ## UMAP: \
738  return octave_value (matrix.FCN ())
739 
741  ARRAY_METHOD_MAPPER (isnan, isnan);
742  ARRAY_METHOD_MAPPER (isinf, isinf);
743  ARRAY_METHOD_MAPPER (finite, isfinite);
744 
745 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
746  case umap_ ## UMAP: \
747  return octave_value (matrix.map<TYPE> (FCN))
748 
751  ARRAY_MAPPER (angle, float, std::arg);
752  ARRAY_MAPPER (arg, float, std::arg);
763  ARRAY_MAPPER (cos, FloatComplex, std::cos);
764  ARRAY_MAPPER (cosh, FloatComplex, std::cosh);
765  ARRAY_MAPPER (exp, FloatComplex, std::exp);
769  ARRAY_MAPPER (log, FloatComplex, std::log);
771  ARRAY_MAPPER (log10, FloatComplex, std::log10);
773  ARRAY_MAPPER (round, FloatComplex, xround);
774  ARRAY_MAPPER (roundb, FloatComplex, xroundb);
776  ARRAY_MAPPER (sin, FloatComplex, std::sin);
777  ARRAY_MAPPER (sinh, FloatComplex, std::sinh);
778  ARRAY_MAPPER (sqrt, FloatComplex, std::sqrt);
779  ARRAY_MAPPER (tan, FloatComplex, std::tan);
780  ARRAY_MAPPER (tanh, FloatComplex, std::tanh);
781  ARRAY_MAPPER (isna, bool, octave_is_NA);
782 
783  default:
784  return octave_base_value::map (umap);
785  }
786 }
save_type
Definition: data-conv.h:83
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
Definition: gripes.cc:180
bool hdf5_types_compatible(hid_t t1, hid_t t2)
Definition: ls-hdf5.cc:107
void write_floats(std::ostream &os, const float *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:943
FloatComplex float_complex_value(bool=false) const
double xround(double x)
Definition: lo-mappers.cc:63
boolNDArray bool_array_value(bool warn=false) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
charNDArray char_array_value(bool frc_str_conv=false) const
octave_idx_type columns(void) const
Definition: ov-base.h:301
double log1p(double x)
Definition: lo-specfun.cc:620
int ndims(void) const
Definition: Array.h:487
mxArray * as_mxArray(void) const
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
save_type get_save_type(double, double)
Definition: ls-utils.cc:35
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
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
ComplexMatrix complex_matrix_value(bool=false) const
void * get_data(void) const
Definition: mxarray.h:433
octave_value diag(octave_idx_type k=0) const
Definition: ov-base-mat.h:123
#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
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
double lo_ieee_nan_value(void)
Definition: lo-ieee.cc:126
double expm1(double x)
Definition: lo-specfun.cc:510
octave_value map(unary_mapper_t umap) const
double xlog2(double x)
Definition: lo-mappers.cc:93
bool all_integers(float &max_val, float &min_val) const
Definition: fCNDArray.cc:533
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
ComplexNDArray complex_array_value(bool=false) const
bool any_element_is_nan(void) const
Definition: fCNDArray.cc:509
FloatComplexMatrix diag(octave_idx_type k=0) const
Definition: fCMatrix.cc:3184
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
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
function asinh(X)
Definition: asinh.f:2
bool load_ascii(std::istream &is)
void gripe_nan_to_logical_conversion(void)
std::complex< T > ceil(const std::complex< T > &x)
Definition: lo-mappers.h:275
FloatComplexNDArray float_complex_array_value(bool=false) const
const T * data(void) const
Definition: Array.h:479
int error_state
Definition: error.cc:101
FloatComplexMatrix float_complex_matrix_value(bool=false) const
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
#define panic_impossible()
Definition: error.h:33
bool save_ascii(std::ostream &os)
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
double xroundb(double x)
Definition: lo-mappers.cc:69
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
boolMatrix mx_el_ne(const boolMatrix &m1, const boolMatrix &m2)
Definition: boolMatrix.cc:90
double double_value(bool=false) const
Definition: dMatrix.h:35
FloatMatrix float_matrix_value(bool=false) const
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:202
Complex complex_value(bool=false) const
void mxArray
Definition: mex.h:53
function acosh(X)
Definition: acosh.f:2
double arg(double x)
Definition: lo-mappers.h:37
bool all_elements_are_real(void) const
Definition: fCNDArray.cc:523
void gripe_logical_conversion(void)
Definition: gripes.cc:201
octave_base_value * try_narrowing_conversion(void)
SparseMatrix sparse_matrix_value(bool=false) const
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
Matrix matrix_value(bool=false) const
int current_print_indent_level(void) const
Definition: ov-base.h:805
bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
void octave_print_internal(std::ostream &, char, bool)
Definition: pr-output.cc:1715
bool save_binary(std::ostream &os, bool &save_as_floats)
octave_value diag(octave_idx_type k=0) const
float float_value(bool=false) const
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
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
std::complex< T > floor(const std::complex< T > &x)
Definition: lo-mappers.h:282
std::complex< double > Complex
Definition: oct-cmplx.h:29
const T * fortran_vec(void) const
Definition: Array.h:481
Complex acos(const Complex &x)
Definition: lo-mappers.cc:177
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:156
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
void read_floats(std::istream &is, float *data, save_type type, octave_idx_type len, bool swap, oct_mach_info::float_format fmt)
Definition: data-conv.cc:837
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)