GNU Octave 7.1.0
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-2022 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-cx-mat.h"
57#include "ov-flt-cx-mat.h"
58#include "ov-re-mat.h"
59#include "ov-scalar.h"
60#include "pr-output.h"
61
62#include "byte-swap.h"
63#include "ls-oct-text.h"
64#include "ls-hdf5.h"
65#include "ls-utils.h"
66
67
69
71 "complex matrix", "double");
72
73static octave_base_value *
75{
76 const octave_complex_matrix& v = dynamic_cast<const octave_complex_matrix&> (a);
77
79}
80
83{
87}
88
91{
92 octave_base_value *retval = nullptr;
93
94 if (matrix.numel () == 1)
95 {
96 Complex c = matrix (0);
97
98 if (c.imag () == 0.0)
99 retval = new octave_scalar (c.real ());
100 else
101 retval = new octave_complex (c);
102 }
103 else if (matrix.all_elements_are_real ())
104 retval = new octave_matrix (::real (matrix));
105
106 return retval;
107}
108
109double
110octave_complex_matrix::double_value (bool force_conversion) const
111{
112 if (! force_conversion)
113 warn_implicit_conversion ("Octave:imag-to-real",
114 "complex matrix", "real scalar");
115
116 if (rows () == 0 || columns () == 0)
117 err_invalid_conversion ("complex matrix", "real scalar");
118
119 warn_implicit_conversion ("Octave:array-to-scalar",
120 "complex matrix", "real scalar");
121
122 return std::real (matrix(0, 0));
123}
124
125float
126octave_complex_matrix::float_value (bool force_conversion) const
127{
128 if (! force_conversion)
129 warn_implicit_conversion ("Octave:imag-to-real",
130 "complex matrix", "real scalar");
131
132 if (rows () == 0 || columns () == 0)
133 err_invalid_conversion ("complex matrix", "real scalar");
134
135 warn_implicit_conversion ("Octave:array-to-scalar",
136 "complex matrix", "real scalar");
137
138 return std::real (matrix(0, 0));
139}
140
142octave_complex_matrix::array_value (bool force_conversion) const
143{
144 NDArray retval;
145
146 if (! force_conversion)
147 warn_implicit_conversion ("Octave:imag-to-real",
148 "complex matrix", "real matrix");
149
150 retval = ::real (matrix);
151
152 return retval;
153}
154
155Matrix
156octave_complex_matrix::matrix_value (bool force_conversion) const
157{
158 Matrix retval;
159
160 if (! force_conversion)
161 warn_implicit_conversion ("Octave:imag-to-real",
162 "complex matrix", "real matrix");
163
164 retval = ::real (ComplexMatrix (matrix));
165
166 return retval;
167}
168
170octave_complex_matrix::float_matrix_value (bool force_conversion) const
171{
172 FloatMatrix retval;
173
174 if (! force_conversion)
175 warn_implicit_conversion ("Octave:imag-to-real",
176 "complex matrix", "real matrix");
177
178 retval = ::real (ComplexMatrix (matrix));
179
180 return retval;
181}
182
185{
186 if (rows () == 0 || columns () == 0)
187 err_invalid_conversion ("complex matrix", "complex scalar");
188
189 warn_implicit_conversion ("Octave:array-to-scalar",
190 "complex matrix", "complex scalar");
191
192 return matrix(0, 0);
193}
194
197{
198 float tmp = lo_ieee_float_nan_value ();
199
200 FloatComplex retval (tmp, tmp);
201
202 if (rows () == 0 || columns () == 0)
203 err_invalid_conversion ("complex matrix", "complex scalar");
204
205 warn_implicit_conversion ("Octave:array-to-scalar",
206 "complex matrix", "complex scalar");
207
208 retval = matrix(0, 0);
209
210 return retval;
211}
212
215{
216 return ComplexMatrix (matrix);
217}
218
221{
223}
224
227{
230 if (warn && (! matrix.all_elements_are_real ()
231 || real (matrix).any_element_not_one_or_zero ()))
233
234 return mx_el_ne (matrix, Complex (0.0));
235}
236
239{
240 charNDArray retval;
241
242 if (! frc_str_conv)
243 warn_implicit_conversion ("Octave:num-to-str",
244 "complex matrix", "string");
245 else
246 {
247 retval = charNDArray (dims ());
248 octave_idx_type nel = numel ();
249
250 for (octave_idx_type i = 0; i < nel; i++)
251 retval.elem (i) = static_cast<char> (std::real (matrix.elem (i)));
252 }
253
254 return retval;
255}
256
259{
261}
262
265{
266 SparseMatrix retval;
267
268 if (! force_conversion)
269 warn_implicit_conversion ("Octave:imag-to-real",
270 "complex matrix", "real matrix");
271
273
274 return retval;
275}
276
279{
281}
282
285{
286 return matrix;
287}
288
291{
293}
294
297{
298 octave_value retval;
299 if (k == 0 && matrix.ndims () == 2
300 && (matrix.rows () == 1 || matrix.columns () == 1))
302 else
304
305 return retval;
306}
307
310{
311 if (matrix.ndims () != 2
312 || (matrix.rows () != 1 && matrix.columns () != 1))
313 error ("diag: expecting vector argument");
314
315 ComplexMatrix mat (matrix);
316
317 return mat.diag (m, n);
318}
319
320bool
322{
323 dim_vector dv = dims ();
324 if (dv.ndims () > 2)
325 {
327
328 os << "# ndims: " << dv.ndims () << "\n";
329
330 for (int i = 0; i < dv.ndims (); i++)
331 os << ' ' << dv(i);
332
333 os << "\n" << tmp;
334 }
335 else
336 {
337 // Keep this case, rather than use generic code above for backward
338 // compatibility. Makes load_ascii much more complex!!
339 os << "# rows: " << rows () << "\n"
340 << "# columns: " << columns () << "\n";
341
342 os << complex_matrix_value ();
343 }
344
345 return true;
346}
347
348bool
350{
351 string_vector keywords(2);
352
353 keywords[0] = "ndims";
354 keywords[1] = "rows";
355
356 std::string kw;
357 octave_idx_type val = 0;
358
359 if (! extract_keyword (is, keywords, kw, val, true))
360 error ("load: failed to extract number of rows and columns");
361
362 // Set "C" locale for the duration of this function to avoid the performance
363 // panelty of frequently switching the locale when reading floating point
364 // values from the stream.
365 char *prev_locale = std::setlocale (LC_ALL, nullptr);
366 std::string old_locale (prev_locale ? prev_locale : "");
367 std::setlocale (LC_ALL, "C");
369 ([&old_locale] () { std::setlocale (LC_ALL, old_locale.c_str ()); });
370
371 if (kw == "ndims")
372 {
373 int mdims = static_cast<int> (val);
374
375 if (mdims < 0)
376 error ("load: failed to extract number of dimensions");
377
378 dim_vector dv;
379 dv.resize (mdims);
380
381 for (int i = 0; i < mdims; i++)
382 is >> dv(i);
383
384 if (! is)
385 error ("load: failed to read dimensions");
386
387 ComplexNDArray tmp(dv);
388
389 is >> tmp;
390
391 if (! is)
392 error ("load: failed to load matrix constant");
393
394 matrix = tmp;
395 }
396 else if (kw == "rows")
397 {
398 octave_idx_type nr = val;
399 octave_idx_type nc = 0;
400
401 if (nr < 0 || ! extract_keyword (is, "columns", nc) || nc < 0)
402 error ("load: failed to extract number of rows and columns");
403
404 if (nr > 0 && nc > 0)
405 {
406 ComplexMatrix tmp (nr, nc);
407 is >> tmp;
408 if (! is)
409 error ("load: failed to load matrix constant");
410
411 matrix = tmp;
412 }
413 else if (nr == 0 || nc == 0)
414 matrix = ComplexMatrix (nr, nc);
415 else
417 }
418 else
420
421 return true;
422}
423
424bool
425octave_complex_matrix::save_binary (std::ostream& os, bool save_as_floats)
426{
427 dim_vector dv = dims ();
428 if (dv.ndims () < 1)
429 return false;
430
431 // Use negative value for ndims to differentiate with old format!!
432 int32_t tmp = - dv.ndims ();
433 os.write (reinterpret_cast<char *> (&tmp), 4);
434 for (int i = 0; i < dv.ndims (); i++)
435 {
436 tmp = dv(i);
437 os.write (reinterpret_cast<char *> (&tmp), 4);
438 }
439
441 save_type st = LS_DOUBLE;
442 if (save_as_floats)
443 {
444 if (m.too_large_for_float ())
445 {
446 warning ("save: some values too large to save as floats --");
447 warning ("save: saving as doubles instead");
448 }
449 else
450 st = LS_FLOAT;
451 }
452 else if (dv.numel () > 4096) // FIXME: make this configurable.
453 {
454 double max_val, min_val;
455 if (m.all_integers (max_val, min_val))
456 st = octave::get_save_type (max_val, min_val);
457 }
458
459 const Complex *mtmp = m.data ();
460 write_doubles (os, reinterpret_cast<const double *> (mtmp), st,
461 2 * dv.numel ());
462
463 return true;
464}
465
466bool
467octave_complex_matrix::load_binary (std::istream& is, bool swap,
469{
470 char tmp;
471 int32_t mdims;
472 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
473 return false;
474 if (swap)
475 swap_bytes<4> (&mdims);
476 if (mdims < 0)
477 {
478 mdims = - mdims;
479 int32_t di;
480 dim_vector dv;
481 dv.resize (mdims);
482
483 for (int i = 0; i < mdims; i++)
484 {
485 if (! is.read (reinterpret_cast<char *> (&di), 4))
486 return false;
487 if (swap)
488 swap_bytes<4> (&di);
489 dv(i) = di;
490 }
491
492 // Convert an array with a single dimension to be a row vector.
493 // Octave should never write files like this, other software
494 // might.
495
496 if (mdims == 1)
497 {
498 mdims = 2;
499 dv.resize (mdims);
500 dv(1) = dv(0);
501 dv(0) = 1;
502 }
503
504 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
505 return false;
506
507 ComplexNDArray m(dv);
508 Complex *im = m.fortran_vec ();
509 read_doubles (is, reinterpret_cast<double *> (im),
510 static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
511
512 if (! is)
513 return false;
514
515 matrix = m;
516 }
517 else
518 {
519 int32_t nr, nc;
520 nr = mdims;
521 if (! is.read (reinterpret_cast<char *> (&nc), 4))
522 return false;
523 if (swap)
524 swap_bytes<4> (&nc);
525 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
526 return false;
527 ComplexMatrix m (nr, nc);
528 Complex *im = m.fortran_vec ();
529 octave_idx_type len = static_cast<octave_idx_type> (nr) * nc;
530 read_doubles (is, reinterpret_cast<double *> (im),
531 static_cast<save_type> (tmp), 2*len, swap, fmt);
532
533 if (! is)
534 return false;
535
536 matrix = m;
537 }
538 return true;
539}
540
541bool
543 bool save_as_floats)
544{
545#if defined (HAVE_HDF5)
546
547 dim_vector dv = dims ();
548 int empty = save_hdf5_empty (loc_id, name, dv);
549 if (empty)
550 return (empty > 0);
551
552 int rank = dv.ndims ();
553 hid_t space_hid, data_hid, type_hid;
554 space_hid = data_hid = type_hid = -1;
555 bool retval = true;
557
558 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
559
560 // Octave uses column-major, while HDF5 uses row-major ordering
561 for (int i = 0; i < rank; i++)
562 hdims[i] = dv(rank-i-1);
563
564 space_hid = H5Screate_simple (rank, hdims, nullptr);
565 if (space_hid < 0) return false;
566
567 hid_t save_type_hid = H5T_NATIVE_DOUBLE;
568
569 if (save_as_floats)
570 {
571 if (m.too_large_for_float ())
572 {
573 warning ("save: some values too large to save as floats --");
574 warning ("save: saving as doubles instead");
575 }
576 else
577 save_type_hid = H5T_NATIVE_FLOAT;
578 }
579#if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
580 // hdf5 currently doesn't support float/integer conversions
581 else
582 {
583 double max_val, min_val;
584
585 if (m.all_integers (max_val, min_val))
586 save_type_hid
587 = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
588 }
589#endif
590
591 type_hid = hdf5_make_complex_type (save_type_hid);
592 if (type_hid < 0)
593 {
594 H5Sclose (space_hid);
595 return false;
596 }
597#if defined (HAVE_HDF5_18)
598 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
600#else
601 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT);
602#endif
603 if (data_hid < 0)
604 {
605 H5Sclose (space_hid);
606 H5Tclose (type_hid);
607 return false;
608 }
609
610 hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
611 if (complex_type_hid < 0) retval = false;
612
613 if (retval)
614 {
615 Complex *mtmp = m.fortran_vec ();
616 if (H5Dwrite (data_hid, complex_type_hid, octave_H5S_ALL, octave_H5S_ALL,
617 octave_H5P_DEFAULT, mtmp)
618 < 0)
619 {
620 H5Tclose (complex_type_hid);
621 retval = false;
622 }
623 }
624
625 H5Tclose (complex_type_hid);
626 H5Dclose (data_hid);
627 H5Tclose (type_hid);
628 H5Sclose (space_hid);
629
630 return retval;
631
632#else
633 octave_unused_parameter (loc_id);
634 octave_unused_parameter (name);
635 octave_unused_parameter (save_as_floats);
636
637 warn_save ("hdf5");
638
639 return false;
640#endif
641}
642
643bool
645{
646 bool retval = false;
647
648#if defined (HAVE_HDF5)
649
650 dim_vector dv;
651 int empty = load_hdf5_empty (loc_id, name, dv);
652 if (empty > 0)
653 matrix.resize (dv);
654 if (empty)
655 return (empty > 0);
656
657#if defined (HAVE_HDF5_18)
658 hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
659#else
660 hid_t data_hid = H5Dopen (loc_id, name);
661#endif
662 hid_t type_hid = H5Dget_type (data_hid);
663
664 hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_DOUBLE);
665
666 if (! hdf5_types_compatible (type_hid, complex_type))
667 {
668 H5Tclose (complex_type);
669 H5Dclose (data_hid);
670 return false;
671 }
672
673 hid_t space_id = H5Dget_space (data_hid);
674
675 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
676
677 if (rank < 1)
678 {
679 H5Tclose (complex_type);
680 H5Sclose (space_id);
681 H5Dclose (data_hid);
682 return false;
683 }
684
685 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
686 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
687
688 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
689
690 // Octave uses column-major, while HDF5 uses row-major ordering
691 if (rank == 1)
692 {
693 dv.resize (2);
694 dv(0) = 1;
695 dv(1) = hdims[0];
696 }
697 else
698 {
699 dv.resize (rank);
700 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
701 dv(j) = hdims[i];
702 }
703
704 ComplexNDArray m (dv);
705 Complex *reim = m.fortran_vec ();
706 if (H5Dread (data_hid, complex_type, octave_H5S_ALL, octave_H5S_ALL,
707 octave_H5P_DEFAULT, reim)
708 >= 0)
709 {
710 retval = true;
711 matrix = m;
712 }
713
714 H5Tclose (complex_type);
715 H5Sclose (space_id);
716 H5Dclose (data_hid);
717
718#else
719 octave_unused_parameter (loc_id);
720 octave_unused_parameter (name);
721
722 warn_load ("hdf5");
723#endif
724
725 return retval;
726}
727
728void
730 bool pr_as_read_syntax) const
731{
732 octave_print_internal (os, matrix, pr_as_read_syntax,
734}
735
736mxArray *
737octave_complex_matrix::as_mxArray (bool interleaved) const
738{
739 mxArray *retval = new mxArray (interleaved, mxDOUBLE_CLASS, dims (),
740 mxCOMPLEX);
741
742 mwSize nel = numel ();
743
744 const Complex *pdata = matrix.data ();
745
746 if (interleaved)
747 {
748 mxComplexDouble *pd
749 = static_cast<mxComplexDouble *> (retval->get_data ());
750
751 for (mwIndex i = 0; i < nel; i++)
752 {
753 pd[i].real = pdata[i].real ();
754 pd[i].imag = pdata[i].imag ();
755 }
756 }
757 else
758 {
759 mxDouble *pr = static_cast<mxDouble *> (retval->get_data ());
760 mxDouble *pi = static_cast<mxDouble *> (retval->get_imag_data ());
761
762 for (mwIndex i = 0; i < nel; i++)
763 {
764 pr[i] = pdata[i].real ();
765 pi[i] = pdata[i].imag ();
766 }
767 }
768
769 return retval;
770}
771
774{
775 switch (umap)
776 {
777 // Mappers handled specially.
778 case umap_real:
780 case umap_imag:
782 case umap_conj:
784
785 // Special cases for Matlab compatibility.
786 case umap_xtolower:
787 case umap_xtoupper:
788 return matrix;
789
790#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
791 case umap_ ## UMAP: \
792 return octave_value (matrix.FCN ())
793
798
799#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
800 case umap_ ## UMAP: \
801 return octave_value (matrix.map<TYPE> (FCN))
802
805 ARRAY_MAPPER (angle, double, std::arg);
806 ARRAY_MAPPER (arg, double, std::arg);
817 ARRAY_MAPPER (cos, Complex, std::cos);
818 ARRAY_MAPPER (cosh, Complex, std::cosh);
819 ARRAY_MAPPER (exp, Complex, std::exp);
823 ARRAY_MAPPER (log, Complex, std::log);
825 ARRAY_MAPPER (log10, Complex, std::log10);
830 ARRAY_MAPPER (sin, Complex, std::sin);
831 ARRAY_MAPPER (sinh, Complex, std::sinh);
832 ARRAY_MAPPER (sqrt, Complex, std::sqrt);
833 ARRAY_MAPPER (tan, Complex, std::tan);
834 ARRAY_MAPPER (tanh, Complex, std::tanh);
836
837 default:
838 return octave_base_value::map (umap);
839 }
840}
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
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:411
T & elem(octave_idx_type n)
Size of the specified dimension.
Definition: Array.h:534
octave_idx_type rows(void) const
Definition: Array.h:449
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array.cc:1010
octave_idx_type columns(void) const
Definition: Array.h:458
const T * data(void) const
Size of the specified dimension.
Definition: Array.h:616
OCTARRAY_API T * fortran_vec(void)
Size of the specified dimension.
Definition: Array.cc:1744
int ndims(void) const
Size of the specified dimension.
Definition: Array.h:627
OCTAVE_API ComplexMatrix diag(octave_idx_type k=0) const
Definition: CMatrix.cc:2825
OCTAVE_API bool too_large_for_float(void) const
Definition: CNDArray.cc:340
OCTAVE_API bool all_integers(double &max_val, double &min_val) const
Definition: CNDArray.cc:289
OCTAVE_API bool any_element_is_nan(void) const
Definition: CNDArray.cc:265
OCTAVE_API bool all_elements_are_real(void) const
Definition: CNDArray.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_data(void) const
Definition: mxarray.h:497
void * get_imag_data(void) const
Definition: mxarray.h:562
octave_idx_type numel(void) const
Definition: ov-base-mat.h:118
octave_value diag(octave_idx_type k=0) const
Definition: ov-base-mat.h:138
octave_idx_type columns(void) const
Definition: ov-base.h:355
int current_print_indent_level(void) const
Definition: ov-base.h:893
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1176
OCTINTERP_API void warn_load(const char *type) const
Definition: ov-base.cc:1152
octave_idx_type rows(void) const
Definition: ov-base.h:348
OCTINTERP_API void warn_save(const char *type) const
Definition: ov-base.cc:1161
NDArray array_value(bool=false) const
Definition: ov-cx-mat.cc:142
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:278
float float_value(bool=false) const
Definition: ov-cx-mat.cc:126
octave_value as_double(void) const
Definition: ov-cx-mat.cc:284
charNDArray char_array_value(bool frc_str_conv=false) const
Definition: ov-cx-mat.cc:238
octave_value as_single(void) const
Definition: ov-cx-mat.cc:290
type_conv_info numeric_demotion_function(void) const
Definition: ov-cx-mat.cc:82
octave_value map(unary_mapper_t umap) const
Definition: ov-cx-mat.cc:773
boolNDArray bool_array_value(bool warn=false) const
Definition: ov-cx-mat.cc:226
octave_base_value * try_narrowing_conversion(void)
Definition: ov-cx-mat.cc:90
Complex complex_value(bool=false) const
Definition: ov-cx-mat.cc:184
FloatComplexMatrix float_complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:220
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-cx-mat.cc:467
ComplexNDArray complex_array_value(bool=false) const
Definition: ov-cx-mat.h:129
FloatComplexNDArray float_complex_array_value(bool=false) const
Definition: ov-cx-mat.cc:258
Matrix matrix_value(bool=false) const
Definition: ov-cx-mat.cc:156
SparseMatrix sparse_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:264
ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:214
double double_value(bool=false) const
Definition: ov-cx-mat.cc:110
FloatComplex float_complex_value(bool=false) const
Definition: ov-cx-mat.cc:196
mxArray * as_mxArray(bool interleaved) const
Definition: ov-cx-mat.cc:737
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-cx-mat.cc:644
octave_value diag(octave_idx_type k=0) const
Definition: ov-cx-mat.cc:296
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-cx-mat.cc:729
bool load_ascii(std::istream &is)
Definition: ov-cx-mat.cc:349
bool save_binary(std::ostream &os, bool save_as_floats)
Definition: ov-cx-mat.cc:425
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-cx-mat.cc:542
bool save_ascii(std::ostream &os)
Definition: ov-cx-mat.cc:321
FloatMatrix float_matrix_value(bool=false) const
Definition: ov-cx-mat.cc:170
static int static_type_id(void)
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 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:776
void write_doubles(std::ostream &os, const double *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:892
save_type
Definition: data-conv.h:87
@ LS_DOUBLE
Definition: data-conv.h:95
@ LS_FLOAT
Definition: data-conv.h:94
void warning(const char *fmt,...)
Definition: error.cc:1055
void error(const char *fmt,...)
Definition: error.cc:980
#define panic_impossible()
Definition: error.h:411
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
QString name
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:116
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector &d)
Definition: ls-hdf5.cc:1251
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Definition: ls-hdf5.cc:1307
octave_hdf5_id save_type_to_hdf5(save_type st)
Definition: ls-hdf5.cc:1351
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
OCTAVE_NAMESPACE_BEGIN save_type get_save_type(double, double)
Definition: ls-utils.cc:40
void mxArray
Definition: mex.h:58
class OCTAVE_API ComplexDiagMatrix
Definition: mx-fwd.h:60
class OCTAVE_API ComplexMatrix
Definition: mx-fwd.h:32
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 SparseComplexMatrix
Definition: mx-fwd.h:56
class OCTAVE_API FloatComplexNDArray
Definition: mx-fwd.h:41
std::complex< double > erfi(std::complex< double > z, double relerr=0)
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 > erf(std::complex< double > z, double relerr=0)
double fix(double x)
Definition: lo-mappers.h:118
Complex atan(const Complex &x)
Definition: lo-mappers.h:71
double signum(double x)
Definition: lo-mappers.h:229
double asinh(double x)
Definition: lo-specfun.h:58
bool isna(double x)
Definition: lo-mappers.cc:47
double atanh(double x)
Definition: lo-specfun.h:63
bool isfinite(double x)
Definition: lo-mappers.h:192
double roundb(double x)
Definition: lo-mappers.h:147
static const double pi
Definition: lo-specfun.cc:1995
bool isnan(bool)
Definition: lo-mappers.h:178
Complex log1p(const Complex &x)
Definition: lo-specfun.cc:1958
bool isinf(double x)
Definition: lo-mappers.h:203
Complex acos(const Complex &x)
Definition: lo-mappers.cc:85
double round(double x)
Definition: lo-mappers.h:136
Complex asin(const Complex &x)
Definition: lo-mappers.cc:107
double erfcx(double x)
Definition: lo-specfun.cc:1755
Complex erfc(const Complex &x)
Definition: lo-specfun.cc:1652
double acosh(double x)
Definition: lo-specfun.h:40
double erfi(double x)
Definition: lo-specfun.cc:1774
std::complex< T > ceil(const std::complex< T > &x)
Definition: lo-mappers.h:103
std::complex< T > floor(const std::complex< T > &x)
Definition: lo-mappers.h:130
double dawson(double x)
Definition: lo-specfun.cc:1517
Complex log2(const Complex &x)
Definition: lo-mappers.cc:139
Complex erf(const Complex &x)
Definition: lo-specfun.cc:1637
Complex expm1(const Complex &x)
Definition: lo-specfun.cc:1874
void err_nan_to_logical_conversion(void)
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:222
static octave_base_value * default_numeric_demotion_function(const octave_base_value &a)
Definition: ov-cx-mat.cc:74
#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