GNU Octave  4.2.1
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-2017 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 #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 {
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 octave::math::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 octave::math::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 
160  retval = ::real (ComplexMatrix (matrix));
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 
174  retval = ::real (ComplexMatrix (matrix));
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 
196  FloatComplex retval (tmp, tmp);
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>(octave::math::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 
268  retval = SparseMatrix (::real (ComplexMatrix (matrix)));
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 {
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 
374  ComplexNDArray tmp(dv);
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, 0);
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] = octave::math::real (p[i]);
738  pi[i] = octave::math::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 #define ARRAY_METHOD_MAPPER(UMAP, FCN) \
758  case umap_ ## UMAP: \
759  return octave_value (matrix.FCN ())
760 
764  ARRAY_METHOD_MAPPER (isfinite, isfinite);
765 
766 #define ARRAY_MAPPER(UMAP, TYPE, FCN) \
767  case umap_ ## UMAP: \
768  return octave_value (matrix.map<TYPE> (FCN))
769 
772  ARRAY_MAPPER (angle, double, std::arg);
773  ARRAY_MAPPER (arg, double, std::arg);
784  ARRAY_MAPPER (cos, Complex, std::cos);
785  ARRAY_MAPPER (cosh, Complex, std::cosh);
786  ARRAY_MAPPER (exp, Complex, std::exp);
792  ARRAY_MAPPER (log10, Complex, std::log10);
797  ARRAY_MAPPER (sin, Complex, std::sin);
798  ARRAY_MAPPER (sinh, Complex, std::sinh);
799  ARRAY_MAPPER (sqrt, Complex, std::sqrt);
800  ARRAY_MAPPER (tan, Complex, std::tan);
801  ARRAY_MAPPER (tanh, Complex, std::tanh);
802  ARRAY_MAPPER (isna, bool, octave::math::is_NA);
803 
804  default:
805  return octave_base_value::map (umap);
806  }
807 }
save_type
Definition: data-conv.h:85
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-cx-mat.cc:529
bool all_integers(double &max_val, double &min_val) const
Definition: CNDArray.cc:526
float float_value(bool=false) const
Definition: ov-cx-mat.cc:122
bool any_element_is_nan(void) const
Definition: CNDArray.cc:502
float erfcx(float x)
Definition: lo-specfun.cc:271
type_conv_info numeric_demotion_function(void) const
Definition: ov-cx-mat.cc:78
octave_idx_type columns(void) const
Definition: ov-base.h:319
octave_value as_double(void) const
Definition: ov-cx-mat.cc:280
function erf(X)
Definition: erf.f:2
static octave_base_value * default_numeric_demotion_function(const octave_base_value &a)
Definition: ov-cx-mat.cc:70
int ndims(void) const
Definition: Array.h:590
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:363
void warn_logical_conversion(void)
Definition: errwarn.cc:353
FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-cx-mat.cc:254
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
const octave_hdf5_id octave_H5S_ALL
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector d)
Definition: ls-hdf5.cc:897
save_type get_save_type(double, double)
Definition: ls-utils.cc:35
Matrix matrix_value(bool=false) const
Definition: ov-cx-mat.cc:152
bool isnan(double x)
Definition: lo-mappers.cc:347
Complex complex_value(bool=false) const
Definition: ov-cx-mat.cc:180
octave_value diag(octave_idx_type k=0) const
Definition: ov-cx-mat.cc:292
for large enough k
Definition: lu.cc:606
octave_idx_type numel(void) const
Definition: ov-base-mat.h:112
void resize(int n, int fill_value=0)
Definition: dim-vector.h:316
double atanh(double x)
Definition: lo-specfun.cc:149
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)
double ceil(double x)
Definition: lo-mappers.h:138
function atanh(X)
Definition: atanh.f:2
void error(const char *fmt,...)
Definition: error.cc:570
void * get_data(void) const
Definition: mxarray.h:449
bool save_ascii(std::ostream &os)
Definition: ov-cx-mat.cc:317
bool load_ascii(std::istream &is)
Definition: ov-cx-mat.cc:345
octave_value as_single(void) const
Definition: ov-cx-mat.cc:286
octave_value diag(octave_idx_type k=0) const
Definition: ov-base-mat.h:132
ComplexNDArray complex_array_value(bool=false) const
Definition: ov-cx-mat.h:129
void write_doubles(std::ostream &os, const double *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:886
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:169
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:482
Complex acos(const Complex &x)
Definition: lo-mappers.cc:90
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-cx-mat.cc:631
double expm1(double x)
Definition: lo-specfun.cc:473
double asinh(double x)
Definition: lo-specfun.cc:105
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-cx-mat.cc:412
double fix(double x)
Definition: lo-mappers.h:158
Complex asin(const Complex &x)
Definition: lo-mappers.cc:150
void err_nan_to_logical_conversion(void)
FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:216
double real(double x)
Definition: lo-mappers.h:113
octave_idx_type rows(void) const
Definition: Array.h:401
octave_value arg
Definition: pr-output.cc:3440
double acosh(double x)
Definition: lo-specfun.cc:61
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition: dim-vector.h:389
double round(double x)
Definition: lo-mappers.cc:333
bool is_NA(double x)
Definition: lo-mappers.cc:54
NDArray array_value(bool=false) const
Definition: ov-cx-mat.cc:138
bool too_large_for_float(void) const
Definition: CNDArray.cc:577
octave_value map(unary_mapper_t umap) const
Definition: ov-cx-mat.cc:745
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:398
bool swap
Definition: load-save.cc:725
float erfi(float x)
Definition: lo-specfun.cc:289
void warn_load(const char *type) const
Definition: ov-base.cc:1151
ComplexColumnVector conj(const ComplexColumnVector &a)
Definition: CColVector.cc:216
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:1688
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:60
FloatComplex float_complex_value(bool=false) const
Definition: ov-cx-mat.cc:192
Complex atan(const Complex &x)
Definition: lo-mappers.cc:210
bool all_elements_are_real(void) const
Definition: CNDArray.cc:516
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
Definition: ls-oct-text.cc:80
function asinh(X)
Definition: asinh.f:2
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:771
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
Definition: ls-hdf5.cc:192
double signum(double x)
Definition: lo-mappers.h:259
octave_base_value * try_narrowing_conversion(void)
Definition: ov-cx-mat.cc:86
float dawson(float x)
Definition: lo-specfun.cc:307
const T * data(void) const
Definition: Array.h:582
bool save_as_floats
Definition: load-save.cc:1581
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1028
octave_hdf5_id save_type_to_hdf5(save_type st)
Definition: ls-hdf5.cc:997
double tmp
Definition: data.cc:6300
octave_value retval
Definition: data.cc:6294
#define panic_impossible()
Definition: error.h:40
std::complex< double > erfcx(std::complex< double > z, double relerr=0)
int64_t octave_hdf5_id
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:260
double imag(double)
Definition: lo-mappers.h:103
Definition: dMatrix.h:37
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
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:202
void warn_save(const char *type) const
Definition: ov-base.cc:1160
void mxArray
Definition: mex.h:55
bool isinf(double x)
Definition: lo-mappers.cc:387
function acosh(X)
Definition: acosh.f:2
ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:210
void warning(const char *fmt,...)
Definition: error.cc:788
double erf(double x)
Definition: lo-specfun.cc:193
void err_invalid_conversion(const std::string &from, const std::string &to)
Definition: errwarn.cc:68
void * get_imag_data(void) const
Definition: mxarray.h:451
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
#define ARRAY_MAPPER(UMAP, TYPE, FCN)
double log1p(double x)
Definition: lo-specfun.cc:587
OCTAVE_EXPORT octave_value_list return the value of the option it must match the dimension of the state and the relative tolerance must also be a vector of the same length tem it must match the dimension of the state and the absolute tolerance must also be a vector of the same length The local error test applied at each integration step is xample roup abs(local error in x(i))<
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-cx-mat.cc:716
double double_value(bool=false) const
Definition: ov-cx-mat.cc:106
int current_print_indent_level(void) const
Definition: ov-base.h:830
p
Definition: lu.cc:138
#define ARRAY_METHOD_MAPPER(UMAP, FCN)
void octave_print_internal(std::ostream &, char, bool)
Definition: pr-output.cc:1722
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition: errwarn.cc:332
double roundb(double x)
Definition: lo-mappers.h:189
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:301
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:200
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1175
FloatMatrix float_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:166
mxArray * as_mxArray(void) const
Definition: ov-cx-mat.cc:724
ColumnVector imag(const ComplexColumnVector &a)
Definition: dColVector.cc:142
double floor(double x)
Definition: lo-mappers.cc:330
const octave_hdf5_id octave_H5P_DEFAULT
double erfc(double x)
Definition: lo-specfun.cc:232
std::complex< float > FloatComplex
Definition: oct-cmplx.h:32
static int static_type_id(void)
ComplexMatrix diag(octave_idx_type k=0) const
Definition: CMatrix.cc:2880
std::complex< double > Complex
Definition: oct-cmplx.h:31
const T * fortran_vec(void) const
Definition: Array.h:584
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:274
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov-cx-mat.cc:234
ColumnVector real(const ComplexColumnVector &a)
Definition: dColVector.cc:136
static const char *const keywords[]
Definition: help.cc:147
write the output to stdout if nargout is
Definition: load-save.cc:1576
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:328
boolNDArray bool_array_value(bool warn=false) const
Definition: ov-cx-mat.cc:222
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:854
dim_vector dv
Definition: sub2ind.cc:263
octave_idx_type columns(void) const
Definition: Array.h:410
double log2(double x)
Definition: lo-mappers.cc:233
octave_idx_type rows(void) const
Definition: ov-base.h:312
static const double pi
Definition: lo-specfun.cc:3610
std::complex< double > erfc(std::complex< double > z, double relerr=0)