GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ov-flt-cx-mat.cc
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2026 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 "mappers.h"
41#include "mach-info.h"
42#include "mx-base.h"
43#include "oct-locbuf.h"
44#include "oct-specfun.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-complex.h"
54#include "ov-flt-complex.h"
55#include "ov-cx-mat.h"
56#include "ov-flt-cx-mat.h"
57#include "ov-re-mat.h"
58#include "ov-flt-re-mat.h"
59#include "ov-scalar.h"
60#include "ov-float.h"
61#include "pr-output.h"
62#include "ops.h"
63
64#include "byte-swap.h"
65#include "ls-oct-text.h"
66#include "ls-hdf5.h"
67#include "ls-utils.h"
68
69
71 "float complex matrix", "single");
72
75{
76 octave_base_value *retval = nullptr;
77
78 if (m_matrix.numel () == 1)
79 {
80 FloatComplex c = m_matrix (0);
81
82 if (c.imag () == 0.0)
83 retval = new octave_float_scalar (c.real ());
84 else
85 retval = new octave_float_complex (c);
86 }
88 retval = new octave_float_matrix (::real (m_matrix));
89
90 return retval;
91}
92
93double
94octave_float_complex_matrix::double_value (bool force_conversion) const
95{
96 if (! force_conversion)
97 warn_implicit_conversion ("Octave:imag-to-real",
98 "complex matrix", "real scalar");
99
100 if (rows () == 0 || columns () == 0)
101 err_invalid_conversion ("complex matrix", "real scalar");
102
103 warn_implicit_conversion ("Octave:array-to-scalar",
104 "complex matrix", "real scalar");
105
106 return std::real (m_matrix(0, 0));
107}
108
109float
110octave_float_complex_matrix::float_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 (m_matrix(0, 0));
123}
124
125Matrix
126octave_float_complex_matrix::matrix_value (bool force_conversion) const
127{
128 Matrix retval;
129
130 if (! force_conversion)
131 warn_implicit_conversion ("Octave:imag-to-real",
132 "complex matrix", "real matrix");
133
135
136 return retval;
137}
138
141{
142 FloatMatrix retval;
143
144 if (! force_conversion)
145 warn_implicit_conversion ("Octave:imag-to-real",
146 "complex matrix", "real matrix");
147
149
150 return retval;
151}
152
155{
156 if (rows () == 0 || columns () == 0)
157 err_invalid_conversion ("complex matrix", "complex scalar");
158
159 warn_implicit_conversion ("Octave:array-to-scalar",
160 "complex matrix", "complex scalar");
161
162 return m_matrix(0, 0);
163}
164
167{
168 float tmp = lo_ieee_float_nan_value ();
169
170 FloatComplex retval (tmp, tmp);
171
172 if (rows () == 0 || columns () == 0)
173 err_invalid_conversion ("complex matrix", "complex scalar");
174
175 warn_implicit_conversion ("Octave:array-to-scalar",
176 "complex matrix", "complex scalar");
177
178 retval = m_matrix(0, 0);
179
180 return retval;
181}
182
188
194
197{
199 octave::err_nan_to_logical_conversion ();
200 if (warn && (! m_matrix.all_elements_are_real ()
201 || real (m_matrix).any_element_not_one_or_zero ()))
203
204 return mx_el_ne (m_matrix, FloatComplex (0.0));
205}
206
209{
210 charNDArray retval;
211
212 if (! frc_str_conv)
213 warn_implicit_conversion ("Octave:num-to-str",
214 "complex matrix", "string");
215 else
216 {
217 retval = charNDArray (dims ());
218 octave_idx_type nel = numel ();
219
220 for (octave_idx_type i = 0; i < nel; i++)
221 if (octave::math::isnan (std::real (m_matrix.elem (i))))
222 retval.elem (i) = 0;
223 else
224 retval.elem (i) = static_cast<char> (std::real (m_matrix.elem (i)));
225 }
226
227 return retval;
228}
229
235
238{
239 SparseMatrix retval;
240
241 if (! force_conversion)
242 warn_implicit_conversion ("Octave:imag-to-real",
243 "complex matrix", "real matrix");
244
246
247 return retval;
248}
249
255
261
267
270{
271 octave_value retval;
272 if (k == 0 && m_matrix.ndims () == 2
273 && (m_matrix.rows () == 1 || m_matrix.columns () == 1))
275 else
277
278 return retval;
279}
280
283{
284 if (m_matrix.ndims () != 2
285 || (m_matrix.rows () != 1 && m_matrix.columns () != 1))
286 error ("diag: expecting vector argument");
287
289
290 return mat.diag (m, n);
291}
292
293bool
295{
296 const dim_vector& dv = dims ();
297
298 if (dv.ndims () > 2)
299 {
301
302 os << "# ndims: " << dv.ndims () << "\n";
303
304 for (int i = 0; i < dv.ndims (); i++)
305 os << ' ' << dv(i);
306
307 os << "\n" << tmp;
308 }
309 else
310 {
311 // Keep this case, rather than use generic code above for backward
312 // compatibility. Makes load_ascii much more complex!!
313 os << "# rows: " << rows () << "\n"
314 << "# columns: " << columns () << "\n";
315
316 os << complex_matrix_value ();
317 }
318
319 return true;
320}
321
322bool
324{
325 string_vector keywords(2);
326
327 keywords[0] = "ndims";
328 keywords[1] = "rows";
329
330 std::string kw;
331 octave_idx_type val = 0;
332
333 if (! extract_keyword (is, keywords, kw, val, true))
334 error ("load: failed to extract number of rows and columns");
335
336 // Set "C" locale for the duration of this function to avoid the performance
337 // panelty of frequently switching the locale when reading floating point
338 // values from the stream.
339 char *prev_locale = std::setlocale (LC_ALL, nullptr);
340 std::string old_locale (prev_locale ? prev_locale : "");
341 std::setlocale (LC_ALL, "C");
342 octave::unwind_action act
343 ([&old_locale] () { std::setlocale (LC_ALL, old_locale.c_str ()); });
344
345 if (kw == "ndims")
346 {
347 int mdims = static_cast<int> (val);
348
349 if (mdims < 0)
350 error ("load: failed to extract number of dimensions");
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 error ("load: failed to read dimensions");
360
361 FloatComplexNDArray tmp(dv);
362
363 is >> tmp;
364
365 if (! is)
366 error ("load: failed to load matrix constant");
367
368 m_matrix = tmp;
369 }
370 else if (kw == "rows")
371 {
372 octave_idx_type nr = val;
373 octave_idx_type nc = 0;
374
375 if (nr < 0 || ! extract_keyword (is, "columns", nc) || nc < 0)
376 error ("load: failed to extract number of rows and columns");
377
378 if (nr > 0 && nc > 0)
379 {
380 FloatComplexMatrix tmp (nr, nc);
381 is >> tmp;
382 if (! is)
383 error ("load: failed to load matrix constant");
384
385 m_matrix = tmp;
386 }
387 else if (nr == 0 || nc == 0)
388 m_matrix = FloatComplexMatrix (nr, nc);
389 else
390 error ("unexpected dimensions in octave_float_complex_matrix::load_ascii - please report this bug");
391 }
392 else
393 error ("unexpected dimensions keyword (= '%s') octave_float_complex_matrix::load_ascii - please report this bug", kw.c_str ());
394
395 return true;
396}
397
398bool
400{
401 const dim_vector& dv = dims ();
402 if (dv.ndims () < 1)
403 return false;
404
405 // Use negative value for ndims to differentiate with old format!!
406 int32_t tmp = - dv.ndims ();
407 os.write (reinterpret_cast<char *> (&tmp), 4);
408 for (int i = 0; i < dv.ndims (); i++)
409 {
410 tmp = dv(i);
411 os.write (reinterpret_cast<char *> (&tmp), 4);
412 }
413
415 save_type st = LS_FLOAT;
416 if (dv.numel () > 4096) // FIXME: make this configurable.
417 {
418 float max_val, min_val;
419 if (m.all_integers (max_val, min_val))
420 st = octave::get_save_type (max_val, min_val);
421 }
422
423 const FloatComplex *mtmp = m.data ();
424 write_floats (os, reinterpret_cast<const float *> (mtmp), st,
425 2 * dv.numel ());
426
427 return true;
428}
429
430bool
431octave_float_complex_matrix::load_binary (std::istream& is, bool swap,
432 octave::mach_info::float_format fmt)
433{
434 char tmp;
435 int32_t mdims;
436 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
437 return false;
438 if (swap)
439 swap_bytes<4> (&mdims);
440 if (mdims < 0)
441 {
442 mdims = - mdims;
443 int32_t di;
444 dim_vector dv;
445 dv.resize (mdims);
446
447 for (int i = 0; i < mdims; i++)
448 {
449 if (! is.read (reinterpret_cast<char *> (&di), 4))
450 return false;
451 if (swap)
452 swap_bytes<4> (&di);
453 dv(i) = di;
454 }
455
456 // Convert an array with a single dimension to be a row vector.
457 // Octave should never write files like this, other software
458 // might.
459
460 if (mdims == 1)
461 {
462 mdims = 2;
463 dv.resize (mdims);
464 dv(1) = dv(0);
465 dv(0) = 1;
466 }
467
468 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
469 return false;
470
472 FloatComplex *im = m.rwdata ();
473 read_floats (is, reinterpret_cast<float *> (im),
474 static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
475
476 if (! is)
477 return false;
478
479 m_matrix = m;
480 }
481 else
482 {
483 int32_t nr, nc;
484 nr = mdims;
485 if (! is.read (reinterpret_cast<char *> (&nc), 4))
486 return false;
487 if (swap)
488 swap_bytes<4> (&nc);
489 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
490 return false;
491 FloatComplexMatrix m (nr, nc);
492 FloatComplex *im = m.rwdata ();
493 octave_idx_type len = static_cast<octave_idx_type> (nr) * nc;
494 read_floats (is, reinterpret_cast<float *> (im),
495 static_cast<save_type> (tmp), 2*len, swap, fmt);
496
497 if (! is)
498 return false;
499
500 m_matrix = m;
501 }
502 return true;
503}
504
505bool
507 bool)
508{
509 bool retval = false;
510
511#if defined (HAVE_HDF5)
512
513 const dim_vector& dv = dims ();
514 int empty = save_hdf5_empty (loc_id, name, dv);
515 if (empty)
516 return (empty > 0);
517
518 int rank = dv.ndims ();
519 hid_t space_hid, data_hid, type_hid;
520 space_hid = data_hid = type_hid = -1;
522
523 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
524
525 // Octave uses column-major, while HDF5 uses row-major ordering
526 for (int i = 0; i < rank; i++)
527 hdims[i] = dv(rank-i-1);
528
529 space_hid = H5Screate_simple (rank, hdims, nullptr);
530 if (space_hid < 0) return false;
531
532 hid_t save_type_hid = H5T_NATIVE_FLOAT;
533
534#if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
535 // hdf5 currently doesn't support float/integer conversions
536 else
537 {
538 float max_val, min_val;
539
540 if (m.all_integers (max_val, min_val))
541 save_type_hid
542 = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
543 }
544#endif
545
546 type_hid = hdf5_make_complex_type (save_type_hid);
547 if (type_hid < 0)
548 {
549 H5Sclose (space_hid);
550 return false;
551 }
552#if defined (HAVE_HDF5_18)
553 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
556#else
557 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT);
558#endif
559 if (data_hid < 0)
560 {
561 H5Sclose (space_hid);
562 H5Tclose (type_hid);
563 return false;
564 }
565
566 hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
567 if (complex_type_hid < 0) retval = false;
568
569 if (retval)
570 {
571 const FloatComplex *mtmp = m.data ();
572 if (H5Dwrite (data_hid, complex_type_hid, octave_H5S_ALL, octave_H5S_ALL,
573 octave_H5P_DEFAULT, mtmp)
574 < 0)
575 {
576 H5Tclose (complex_type_hid);
577 retval = false;
578 }
579 }
580
581 H5Tclose (complex_type_hid);
582 H5Dclose (data_hid);
583 H5Tclose (type_hid);
584 H5Sclose (space_hid);
585
586#else
587 octave_unused_parameter (loc_id);
588 octave_unused_parameter (name);
589
590 warn_save ("hdf5");
591#endif
592
593 return retval;
594}
595
596bool
598{
599 bool retval = false;
600
601#if defined (HAVE_HDF5)
602
603 dim_vector dv;
604 int empty = load_hdf5_empty (loc_id, name, dv);
605 if (empty > 0)
606 m_matrix.resize (dv);
607 if (empty)
608 return (empty > 0);
609
610#if defined (HAVE_HDF5_18)
611 hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
612#else
613 hid_t data_hid = H5Dopen (loc_id, name);
614#endif
615 hid_t type_hid = H5Dget_type (data_hid);
616
617 hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
618
619 if (! hdf5_types_compatible (type_hid, complex_type))
620 {
621 H5Tclose (complex_type);
622 H5Dclose (data_hid);
623 return false;
624 }
625
626 hid_t space_id = H5Dget_space (data_hid);
627
628 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
629
630 if (rank < 1)
631 {
632 H5Tclose (complex_type);
633 H5Sclose (space_id);
634 H5Dclose (data_hid);
635 return false;
636 }
637
638 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
639 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
640
641 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
642
643 // Octave uses column-major, while HDF5 uses row-major ordering
644 if (rank == 1)
645 {
646 dv.resize (2);
647 dv(0) = 1;
648 dv(1) = hdims[0];
649 }
650 else
651 {
652 dv.resize (rank);
653 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
654 dv(j) = hdims[i];
655 }
656
657 FloatComplexNDArray m (dv);
658 FloatComplex *reim = m.rwdata ();
659 if (H5Dread (data_hid, complex_type, octave_H5S_ALL, octave_H5S_ALL,
660 octave_H5P_DEFAULT, reim)
661 >= 0)
662 {
663 retval = true;
664 m_matrix = m;
665 }
666
667 H5Tclose (complex_type);
668 H5Sclose (space_id);
669 H5Dclose (data_hid);
670
671#else
672 octave_unused_parameter (loc_id);
673 octave_unused_parameter (name);
674
675 warn_load ("hdf5");
676#endif
677
678 return retval;
679}
680
681void
683 bool pr_as_read_syntax) const
684{
685 octave_print_internal (os, m_matrix, pr_as_read_syntax,
687}
688
689mxArray *
691{
692 mxArray *retval = new mxArray (interleaved, mxSINGLE_CLASS, dims (),
693 mxCOMPLEX);
694
695 mwSize nel = numel ();
696
697 const FloatComplex *pdata = m_matrix.data ();
698
699 if (interleaved)
700 {
701 mxComplexSingle *pd
702 = static_cast<mxComplexSingle *> (retval->get_data ());
703
704 for (mwIndex i = 0; i < nel; i++)
705 {
706 pd[i].real = pdata[i].real ();
707 pd[i].imag = pdata[i].imag ();
708 }
709 }
710 else
711 {
712 mxSingle *pr = static_cast<mxSingle *> (retval->get_data ());
713 mxSingle *pi = static_cast<mxSingle *> (retval->get_imag_data ());
714
715 for (mwIndex i = 0; i < nel; i++)
716 {
717 pr[i] = pdata[i].real ();
718 pi[i] = pdata[i].imag ();
719 }
720 }
721
722 return retval;
723}
724
727{
728 switch (umap)
729 {
730 // Mappers handled specially.
731 case umap_real:
732 return ::real (m_matrix);
733 case umap_imag:
734 return ::imag (m_matrix);
735 case umap_conj:
736 return ::conj (m_matrix);
737
738 // Special cases for Matlab compatibility.
739 case umap_xtolower:
740 case umap_xtoupper:
741 return m_matrix;
742
743#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
744 case umap_ ## UMAP: \
745 return octave_value (m_matrix.FCN ())
746
751
752#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
753 case umap_ ## UMAP: \
754 return octave_value (m_matrix.map<TYPE> (FCN))
755
756 ARRAY_MAPPER (acos, FloatComplex, octave::math::acos);
757 ARRAY_MAPPER (acosh, FloatComplex, octave::math::acosh);
758 ARRAY_MAPPER (angle, float, std::arg);
759 ARRAY_MAPPER (arg, float, std::arg);
760 ARRAY_MAPPER (asin, FloatComplex, octave::math::asin);
761 ARRAY_MAPPER (asinh, FloatComplex, octave::math::asinh);
762 ARRAY_MAPPER (atan, FloatComplex, octave::math::atan);
763 ARRAY_MAPPER (atanh, FloatComplex, octave::math::atanh);
764 ARRAY_MAPPER (erf, FloatComplex, octave::math::erf);
765 ARRAY_MAPPER (erfc, FloatComplex, octave::math::erfc);
766 ARRAY_MAPPER (erfcx, FloatComplex, octave::math::erfcx);
767 ARRAY_MAPPER (erfi, FloatComplex, octave::math::erfi);
768 ARRAY_MAPPER (dawson, FloatComplex, octave::math::dawson);
769 ARRAY_MAPPER (ceil, FloatComplex, octave::math::ceil);
770 ARRAY_MAPPER (cos, FloatComplex, std::cos);
771 ARRAY_MAPPER (cosh, FloatComplex, std::cosh);
772 ARRAY_MAPPER (exp, FloatComplex, std::exp);
773 ARRAY_MAPPER (expm1, FloatComplex, octave::math::expm1);
774 ARRAY_MAPPER (fix, FloatComplex, octave::math::fix);
775 ARRAY_MAPPER (floor, FloatComplex, octave::math::floor);
776 ARRAY_MAPPER (log, FloatComplex, std::log);
777 ARRAY_MAPPER (log2, FloatComplex, octave::math::log2);
778 ARRAY_MAPPER (log10, FloatComplex, std::log10);
779 ARRAY_MAPPER (log1p, FloatComplex, octave::math::log1p);
780 ARRAY_MAPPER (round, FloatComplex, octave::math::round);
781 ARRAY_MAPPER (roundb, FloatComplex, octave::math::roundb);
782 ARRAY_MAPPER (signum, FloatComplex, octave::math::signum);
783 ARRAY_MAPPER (sin, FloatComplex, std::sin);
784 ARRAY_MAPPER (sinh, FloatComplex, std::sinh);
785 ARRAY_MAPPER (sqrt, FloatComplex, std::sqrt);
786 ARRAY_MAPPER (tan, FloatComplex, std::tan);
787 ARRAY_MAPPER (tanh, FloatComplex, std::tanh);
788 ARRAY_MAPPER (isna, bool, octave::math::isna);
789
790 default:
791 return octave_base_value::map (umap);
792 }
793}
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
T & elem(octave_idx_type n)
Size of the specified dimension.
Definition Array-base.h:585
int ndims() const
Size of the specified dimension.
Definition Array-base.h:701
octave_idx_type rows() const
Definition Array-base.h:485
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
octave_idx_type columns() const
Definition Array-base.h:497
const T * data() const
Size of the specified dimension.
Definition Array-base.h:687
T * rwdata()
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
Definition Array-base.h:440
FloatComplexMatrix diag(octave_idx_type k=0) const
Definition fCMatrix.cc:2884
bool all_integers(float &max_val, float &min_val) const
Definition fCNDArray.cc:289
bool any_element_is_nan() const
Definition fCNDArray.cc:265
bool all_elements_are_real() const
Definition fCNDArray.cc:279
Vector representing the dimensions (size) of an Array.
Definition dim-vector.h:92
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition dim-vector.h:341
void resize(int n, int fill_value=0)
Definition dim-vector.h:278
octave_idx_type ndims() const
Number of dimensions.
Definition dim-vector.h:263
void * get_data() const
Definition mxarray.h:482
void * get_imag_data() const
Definition mxarray.h:520
octave_value diag(octave_idx_type k=0) const
octave_idx_type rows() const
Definition ov-base.h:384
octave_idx_type columns() const
Definition ov-base.h:391
int current_print_indent_level() const
Definition ov-base.h:945
virtual octave_value map(unary_mapper_t) const
Definition ov-base.cc:1170
void warn_load(const char *type) const
Definition ov-base.cc:1152
void warn_save(const char *type) const
Definition ov-base.cc:1161
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
octave_value as_single() 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
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_double() const
float float_value(bool=false) const
octave_base_value * try_narrowing_conversion()
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)
void write_floats(std::ostream &os, const float *data, save_type type, octave_idx_type len)
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:884
save_type
Definition data-conv.h:85
@ LS_FLOAT
Definition data-conv.h:92
void error(const char *fmt,...)
Definition error.cc:1008
void err_invalid_conversion(const std::string &from, const std::string &to)
Definition errwarn.cc:71
void warn_logical_conversion()
Definition errwarn.cc:366
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition errwarn.cc:345
Complex log2(const Complex &x)
Definition mappers.cc:140
Complex asin(const Complex &x)
Definition mappers.cc:106
bool isna(double x)
Definition mappers.cc:46
Complex acos(const Complex &x)
Definition mappers.cc:84
float lo_ieee_float_nan_value()
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:1255
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Definition ls-hdf5.cc:1312
octave_hdf5_id save_type_to_hdf5(save_type st)
Definition ls-hdf5.cc:1356
octave_hdf5_id hdf5_make_complex_type(octave_hdf5_id num_type)
Definition ls-hdf5.cc:411
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
Definition ls-hdf5.cc:275
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
std::complex< T > ceil(const std::complex< T > &x)
Definition mappers.h:115
Complex atan(const Complex &x)
Definition mappers.h:83
double roundb(double x)
Definition mappers.h:159
std::complex< T > floor(const std::complex< T > &x)
Definition mappers.h:142
bool isfinite(double x)
Definition mappers.h:229
bool isinf(double x)
Definition mappers.h:212
double signum(double x)
Definition mappers.h:255
double round(double x)
Definition mappers.h:148
bool isnan(bool)
Definition mappers.h:192
double fix(double x)
Definition mappers.h:130
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
double erfi(double x)
double dawson(double x)
Complex erf(const Complex &x)
double erfcx(double x)
Complex expm1(const Complex &x)
Complex log1p(const Complex &x)
Complex erfc(const Complex &x)
double asinh(double x)
Definition oct-specfun.h:57
double atanh(double x)
Definition oct-specfun.h:62
double acosh(double x)
Definition oct-specfun.h:39
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition ov-base.h:246
#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)
template int8_t abs(int8_t)
F77_RET_T len
Definition xerbla.cc:61