GNU Octave 10.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-2025 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-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 retval.elem (i) = static_cast<char> (std::real (m_matrix.elem (i)));
222 }
223
224 return retval;
225}
226
232
235{
236 SparseMatrix retval;
237
238 if (! force_conversion)
239 warn_implicit_conversion ("Octave:imag-to-real",
240 "complex matrix", "real matrix");
241
243
244 return retval;
245}
246
252
258
264
267{
268 octave_value retval;
269 if (k == 0 && m_matrix.ndims () == 2
270 && (m_matrix.rows () == 1 || m_matrix.columns () == 1))
272 else
274
275 return retval;
276}
277
280{
281 if (m_matrix.ndims () != 2
282 || (m_matrix.rows () != 1 && m_matrix.columns () != 1))
283 error ("diag: expecting vector argument");
284
286
287 return mat.diag (m, n);
288}
289
290bool
292{
293 const dim_vector& dv = dims ();
294
295 if (dv.ndims () > 2)
296 {
298
299 os << "# ndims: " << dv.ndims () << "\n";
300
301 for (int i = 0; i < dv.ndims (); i++)
302 os << ' ' << dv(i);
303
304 os << "\n" << tmp;
305 }
306 else
307 {
308 // Keep this case, rather than use generic code above for backward
309 // compatibility. Makes load_ascii much more complex!!
310 os << "# rows: " << rows () << "\n"
311 << "# columns: " << columns () << "\n";
312
313 os << complex_matrix_value ();
314 }
315
316 return true;
317}
318
319bool
321{
322 string_vector keywords(2);
323
324 keywords[0] = "ndims";
325 keywords[1] = "rows";
326
327 std::string kw;
328 octave_idx_type val = 0;
329
330 if (! extract_keyword (is, keywords, kw, val, true))
331 error ("load: failed to extract number of rows and columns");
332
333 // Set "C" locale for the duration of this function to avoid the performance
334 // panelty of frequently switching the locale when reading floating point
335 // values from the stream.
336 char *prev_locale = std::setlocale (LC_ALL, nullptr);
337 std::string old_locale (prev_locale ? prev_locale : "");
338 std::setlocale (LC_ALL, "C");
339 octave::unwind_action act
340 ([&old_locale] () { std::setlocale (LC_ALL, old_locale.c_str ()); });
341
342 if (kw == "ndims")
343 {
344 int mdims = static_cast<int> (val);
345
346 if (mdims < 0)
347 error ("load: failed to extract number of dimensions");
348
349 dim_vector dv;
350 dv.resize (mdims);
351
352 for (int i = 0; i < mdims; i++)
353 is >> dv(i);
354
355 if (! is)
356 error ("load: failed to read dimensions");
357
358 FloatComplexNDArray tmp(dv);
359
360 is >> tmp;
361
362 if (! is)
363 error ("load: failed to load matrix constant");
364
365 m_matrix = tmp;
366 }
367 else if (kw == "rows")
368 {
369 octave_idx_type nr = val;
370 octave_idx_type nc = 0;
371
372 if (nr < 0 || ! extract_keyword (is, "columns", nc) || nc < 0)
373 error ("load: failed to extract number of rows and columns");
374
375 if (nr > 0 && nc > 0)
376 {
377 FloatComplexMatrix tmp (nr, nc);
378 is >> tmp;
379 if (! is)
380 error ("load: failed to load matrix constant");
381
382 m_matrix = tmp;
383 }
384 else if (nr == 0 || nc == 0)
385 m_matrix = FloatComplexMatrix (nr, nc);
386 else
387 error ("unexpected dimensions in octave_float_complex_matrix::load_ascii - please report this bug");
388 }
389 else
390 error ("unexpected dimensions keyword (= '%s') octave_float_complex_matrix::load_ascii - please report this bug", kw.c_str ());
391
392 return true;
393}
394
395bool
397{
398 const dim_vector& dv = dims ();
399 if (dv.ndims () < 1)
400 return false;
401
402 // Use negative value for ndims to differentiate with old format!!
403 int32_t tmp = - dv.ndims ();
404 os.write (reinterpret_cast<char *> (&tmp), 4);
405 for (int i = 0; i < dv.ndims (); i++)
406 {
407 tmp = dv(i);
408 os.write (reinterpret_cast<char *> (&tmp), 4);
409 }
410
412 save_type st = LS_FLOAT;
413 if (dv.numel () > 4096) // FIXME: make this configurable.
414 {
415 float max_val, min_val;
416 if (m.all_integers (max_val, min_val))
417 st = octave::get_save_type (max_val, min_val);
418 }
419
420 const FloatComplex *mtmp = m.data ();
421 write_floats (os, reinterpret_cast<const float *> (mtmp), st,
422 2 * dv.numel ());
423
424 return true;
425}
426
427bool
428octave_float_complex_matrix::load_binary (std::istream& is, bool swap,
429 octave::mach_info::float_format fmt)
430{
431 char tmp;
432 int32_t mdims;
433 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
434 return false;
435 if (swap)
436 swap_bytes<4> (&mdims);
437 if (mdims < 0)
438 {
439 mdims = - mdims;
440 int32_t di;
441 dim_vector dv;
442 dv.resize (mdims);
443
444 for (int i = 0; i < mdims; i++)
445 {
446 if (! is.read (reinterpret_cast<char *> (&di), 4))
447 return false;
448 if (swap)
449 swap_bytes<4> (&di);
450 dv(i) = di;
451 }
452
453 // Convert an array with a single dimension to be a row vector.
454 // Octave should never write files like this, other software
455 // might.
456
457 if (mdims == 1)
458 {
459 mdims = 2;
460 dv.resize (mdims);
461 dv(1) = dv(0);
462 dv(0) = 1;
463 }
464
465 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
466 return false;
467
469 FloatComplex *im = m.rwdata ();
470 read_floats (is, reinterpret_cast<float *> (im),
471 static_cast<save_type> (tmp), 2 * dv.numel (), swap, fmt);
472
473 if (! is)
474 return false;
475
476 m_matrix = m;
477 }
478 else
479 {
480 int32_t nr, nc;
481 nr = mdims;
482 if (! is.read (reinterpret_cast<char *> (&nc), 4))
483 return false;
484 if (swap)
485 swap_bytes<4> (&nc);
486 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
487 return false;
488 FloatComplexMatrix m (nr, nc);
489 FloatComplex *im = m.rwdata ();
490 octave_idx_type len = static_cast<octave_idx_type> (nr) * nc;
491 read_floats (is, reinterpret_cast<float *> (im),
492 static_cast<save_type> (tmp), 2*len, swap, fmt);
493
494 if (! is)
495 return false;
496
497 m_matrix = m;
498 }
499 return true;
500}
501
502bool
504 bool)
505{
506 bool retval = false;
507
508#if defined (HAVE_HDF5)
509
510 const dim_vector& dv = dims ();
511 int empty = save_hdf5_empty (loc_id, name, dv);
512 if (empty)
513 return (empty > 0);
514
515 int rank = dv.ndims ();
516 hid_t space_hid, data_hid, type_hid;
517 space_hid = data_hid = type_hid = -1;
519
520 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
521
522 // Octave uses column-major, while HDF5 uses row-major ordering
523 for (int i = 0; i < rank; i++)
524 hdims[i] = dv(rank-i-1);
525
526 space_hid = H5Screate_simple (rank, hdims, nullptr);
527 if (space_hid < 0) return false;
528
529 hid_t save_type_hid = H5T_NATIVE_FLOAT;
530
531#if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
532 // hdf5 currently doesn't support float/integer conversions
533 else
534 {
535 float max_val, min_val;
536
537 if (m.all_integers (max_val, min_val))
538 save_type_hid
539 = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
540 }
541#endif
542
543 type_hid = hdf5_make_complex_type (save_type_hid);
544 if (type_hid < 0)
545 {
546 H5Sclose (space_hid);
547 return false;
548 }
549#if defined (HAVE_HDF5_18)
550 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
553#else
554 data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT);
555#endif
556 if (data_hid < 0)
557 {
558 H5Sclose (space_hid);
559 H5Tclose (type_hid);
560 return false;
561 }
562
563 hid_t complex_type_hid = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
564 if (complex_type_hid < 0) retval = false;
565
566 if (retval)
567 {
568 const FloatComplex *mtmp = m.data ();
569 if (H5Dwrite (data_hid, complex_type_hid, octave_H5S_ALL, octave_H5S_ALL,
570 octave_H5P_DEFAULT, mtmp)
571 < 0)
572 {
573 H5Tclose (complex_type_hid);
574 retval = false;
575 }
576 }
577
578 H5Tclose (complex_type_hid);
579 H5Dclose (data_hid);
580 H5Tclose (type_hid);
581 H5Sclose (space_hid);
582
583#else
584 octave_unused_parameter (loc_id);
585 octave_unused_parameter (name);
586
587 warn_save ("hdf5");
588#endif
589
590 return retval;
591}
592
593bool
595{
596 bool retval = false;
597
598#if defined (HAVE_HDF5)
599
600 dim_vector dv;
601 int empty = load_hdf5_empty (loc_id, name, dv);
602 if (empty > 0)
603 m_matrix.resize (dv);
604 if (empty)
605 return (empty > 0);
606
607#if defined (HAVE_HDF5_18)
608 hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
609#else
610 hid_t data_hid = H5Dopen (loc_id, name);
611#endif
612 hid_t type_hid = H5Dget_type (data_hid);
613
614 hid_t complex_type = hdf5_make_complex_type (H5T_NATIVE_FLOAT);
615
616 if (! hdf5_types_compatible (type_hid, complex_type))
617 {
618 H5Tclose (complex_type);
619 H5Dclose (data_hid);
620 return false;
621 }
622
623 hid_t space_id = H5Dget_space (data_hid);
624
625 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
626
627 if (rank < 1)
628 {
629 H5Tclose (complex_type);
630 H5Sclose (space_id);
631 H5Dclose (data_hid);
632 return false;
633 }
634
635 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
636 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
637
638 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
639
640 // Octave uses column-major, while HDF5 uses row-major ordering
641 if (rank == 1)
642 {
643 dv.resize (2);
644 dv(0) = 1;
645 dv(1) = hdims[0];
646 }
647 else
648 {
649 dv.resize (rank);
650 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
651 dv(j) = hdims[i];
652 }
653
654 FloatComplexNDArray m (dv);
655 FloatComplex *reim = m.rwdata ();
656 if (H5Dread (data_hid, complex_type, octave_H5S_ALL, octave_H5S_ALL,
657 octave_H5P_DEFAULT, reim)
658 >= 0)
659 {
660 retval = true;
661 m_matrix = m;
662 }
663
664 H5Tclose (complex_type);
665 H5Sclose (space_id);
666 H5Dclose (data_hid);
667
668#else
669 octave_unused_parameter (loc_id);
670 octave_unused_parameter (name);
671
672 warn_load ("hdf5");
673#endif
674
675 return retval;
676}
677
678void
680 bool pr_as_read_syntax) const
681{
682 octave_print_internal (os, m_matrix, pr_as_read_syntax,
684}
685
686mxArray *
688{
689 mxArray *retval = new mxArray (interleaved, mxSINGLE_CLASS, dims (),
690 mxCOMPLEX);
691
692 mwSize nel = numel ();
693
694 const FloatComplex *pdata = m_matrix.data ();
695
696 if (interleaved)
697 {
698 mxComplexSingle *pd
699 = static_cast<mxComplexSingle *> (retval->get_data ());
700
701 for (mwIndex i = 0; i < nel; i++)
702 {
703 pd[i].real = pdata[i].real ();
704 pd[i].imag = pdata[i].imag ();
705 }
706 }
707 else
708 {
709 mxSingle *pr = static_cast<mxSingle *> (retval->get_data ());
710 mxSingle *pi = static_cast<mxSingle *> (retval->get_imag_data ());
711
712 for (mwIndex i = 0; i < nel; i++)
713 {
714 pr[i] = pdata[i].real ();
715 pi[i] = pdata[i].imag ();
716 }
717 }
718
719 return retval;
720}
721
724{
725 switch (umap)
726 {
727 // Mappers handled specially.
728 case umap_real:
729 return ::real (m_matrix);
730 case umap_imag:
731 return ::imag (m_matrix);
732 case umap_conj:
733 return ::conj (m_matrix);
734
735 // Special cases for Matlab compatibility.
736 case umap_xtolower:
737 case umap_xtoupper:
738 return m_matrix;
739
740#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
741 case umap_ ## UMAP: \
742 return octave_value (m_matrix.FCN ())
743
748
749#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
750 case umap_ ## UMAP: \
751 return octave_value (m_matrix.map<TYPE> (FCN))
752
753 ARRAY_MAPPER (acos, FloatComplex, octave::math::acos);
754 ARRAY_MAPPER (acosh, FloatComplex, octave::math::acosh);
755 ARRAY_MAPPER (angle, float, std::arg);
756 ARRAY_MAPPER (arg, float, std::arg);
757 ARRAY_MAPPER (asin, FloatComplex, octave::math::asin);
758 ARRAY_MAPPER (asinh, FloatComplex, octave::math::asinh);
759 ARRAY_MAPPER (atan, FloatComplex, octave::math::atan);
760 ARRAY_MAPPER (atanh, FloatComplex, octave::math::atanh);
761 ARRAY_MAPPER (erf, FloatComplex, octave::math::erf);
762 ARRAY_MAPPER (erfc, FloatComplex, octave::math::erfc);
763 ARRAY_MAPPER (erfcx, FloatComplex, octave::math::erfcx);
764 ARRAY_MAPPER (erfi, FloatComplex, octave::math::erfi);
765 ARRAY_MAPPER (dawson, FloatComplex, octave::math::dawson);
766 ARRAY_MAPPER (ceil, FloatComplex, octave::math::ceil);
767 ARRAY_MAPPER (cos, FloatComplex, std::cos);
768 ARRAY_MAPPER (cosh, FloatComplex, std::cosh);
769 ARRAY_MAPPER (exp, FloatComplex, std::exp);
770 ARRAY_MAPPER (expm1, FloatComplex, octave::math::expm1);
771 ARRAY_MAPPER (fix, FloatComplex, octave::math::fix);
772 ARRAY_MAPPER (floor, FloatComplex, octave::math::floor);
773 ARRAY_MAPPER (log, FloatComplex, std::log);
774 ARRAY_MAPPER (log2, FloatComplex, octave::math::log2);
775 ARRAY_MAPPER (log10, FloatComplex, std::log10);
776 ARRAY_MAPPER (log1p, FloatComplex, octave::math::log1p);
777 ARRAY_MAPPER (round, FloatComplex, octave::math::round);
778 ARRAY_MAPPER (roundb, FloatComplex, octave::math::roundb);
779 ARRAY_MAPPER (signum, FloatComplex, octave::math::signum);
780 ARRAY_MAPPER (sin, FloatComplex, std::sin);
781 ARRAY_MAPPER (sinh, FloatComplex, std::sinh);
782 ARRAY_MAPPER (sqrt, FloatComplex, std::sqrt);
783 ARRAY_MAPPER (tan, FloatComplex, std::tan);
784 ARRAY_MAPPER (tanh, FloatComplex, std::tanh);
785 ARRAY_MAPPER (isna, bool, octave::math::isna);
786
787 default:
788 return octave_base_value::map (umap);
789 }
790}
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.h:563
int ndims() const
Size of the specified dimension.
Definition Array.h:679
octave_idx_type rows() const
Definition Array.h:463
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
octave_idx_type columns() const
Definition Array.h:475
const T * data() const
Size of the specified dimension.
Definition Array.h:665
T * rwdata()
Size of the specified dimension.
octave_idx_type numel() const
Number of elements in the array.
Definition Array.h:418
FloatComplexMatrix diag(octave_idx_type k=0) const
Definition fCMatrix.cc:2860
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:90
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition dim-vector.h:331
void resize(int n, int fill_value=0)
Definition dim-vector.h:268
octave_idx_type ndims() const
Number of dimensions.
Definition dim-vector.h:253
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)
Definition data-conv.cc:968
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:862
save_type
Definition data-conv.h:85
@ LS_FLOAT
Definition data-conv.h:92
void error(const char *fmt,...)
Definition error.cc:1003
void err_invalid_conversion(const std::string &from, const std::string &to)
Definition errwarn.cc:71
void warn_logical_conversion()
Definition errwarn.cc:365
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition errwarn.cc:344
float lo_ieee_float_nan_value()
Definition lo-ieee.cc:116
Complex log2(const Complex &x)
Complex asin(const Complex &x)
bool isna(double x)
Definition lo-mappers.cc:47
Complex acos(const Complex &x)
Definition lo-mappers.cc:85
std::complex< T > ceil(const std::complex< T > &x)
Definition lo-mappers.h:103
Complex atan(const Complex &x)
Definition lo-mappers.h:71
double roundb(double x)
Definition lo-mappers.h:147
std::complex< T > floor(const std::complex< T > &x)
Definition lo-mappers.h:130
bool isfinite(double x)
Definition lo-mappers.h:192
bool isinf(double x)
Definition lo-mappers.h:203
double signum(double x)
Definition lo-mappers.h:229
double round(double x)
Definition lo-mappers.h:136
bool isnan(bool)
Definition lo-mappers.h:178
double fix(double x)
Definition lo-mappers.h:118
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 lo-specfun.h:58
double atanh(double x)
Definition lo-specfun.h:63
double acosh(double x)
Definition lo-specfun.h:40
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector &d)
Definition ls-hdf5.cc:1254
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Definition ls-hdf5.cc:1311
octave_hdf5_id save_type_to_hdf5(save_type st)
Definition ls-hdf5.cc:1355
octave_hdf5_id hdf5_make_complex_type(octave_hdf5_id num_type)
Definition ls-hdf5.cc:410
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
Definition ls-hdf5.cc:274
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
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: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