GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-flt-re-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 <limits>
33#include <ostream>
34#include <vector>
35
36#include "dNDArray.h"
37#include "fNDArray.h"
38#include "int8NDArray.h"
39#include "int16NDArray.h"
40#include "int32NDArray.h"
41#include "int64NDArray.h"
42#include "uint8NDArray.h"
43#include "uint16NDArray.h"
44#include "uint32NDArray.h"
45#include "uint64NDArray.h"
46
47#include "data-conv.h"
48#include "lo-ieee.h"
49#include "lo-utils.h"
50#include "lo-specfun.h"
51#include "lo-mappers.h"
52#include "mach-info.h"
53#include "mx-base.h"
54#include "quit.h"
55#include "oct-locbuf.h"
56
57#include "defun.h"
58#include "errwarn.h"
59#include "mxarray.h"
60#include "ovl.h"
61#include "oct-lvalue.h"
62#include "oct-hdf5.h"
63#include "oct-stream.h"
64#include "ops.h"
65#include "ov-base.h"
66#include "ov-base-mat.h"
67#include "ov-base-mat.cc"
68#include "ov-scalar.h"
69#include "ov-float.h"
70#include "ov-flt-complex.h"
71#include "ov-re-mat.h"
72#include "ov-flt-re-mat.h"
73#include "ov-flt-cx-mat.h"
74#include "ov-re-sparse.h"
75#include "ov-flt-re-diag.h"
76#include "ov-flt-cx-diag.h"
77#include "pr-output.h"
78#include "variables.h"
79#include "ops.h"
80
81#include "byte-swap.h"
82#include "ls-oct-text.h"
83#include "ls-utils.h"
84#include "ls-hdf5.h"
85
86
88
90 "single");
91
94{
95 octave_base_value *retval = nullptr;
96
97 if (matrix.numel () == 1)
98 retval = new octave_float_scalar (matrix (0));
99
100 return retval;
101}
102
103double
105{
106 if (isempty ())
107 err_invalid_conversion ("real matrix", "real scalar");
108
109 warn_implicit_conversion ("Octave:array-to-scalar",
110 "real matrix", "real scalar");
111
112 return matrix(0, 0);
113}
114
115float
117{
118 if (isempty ())
119 err_invalid_conversion ("real matrix", "real scalar");
120
121 warn_implicit_conversion ("Octave:array-to-scalar",
122 "real matrix", "real scalar");
123
124 return matrix(0, 0);
125}
126
127// FIXME
128
129Matrix
131{
132 return Matrix (FloatMatrix (matrix));
133}
134
137{
138 return FloatMatrix (matrix);
139}
140
143{
144 if (rows () == 0 || columns () == 0)
145 err_invalid_conversion ("real matrix", "complex scalar");
146
147 warn_implicit_conversion ("Octave:array-to-scalar",
148 "real matrix", "complex scalar");
149
150 return Complex (matrix(0, 0), 0);
151}
152
155{
156 double tmp = lo_ieee_float_nan_value ();
157
158 FloatComplex retval (tmp, tmp);
159
160 if (rows () == 0 || columns () == 0)
161 err_invalid_conversion ("real matrix", "complex scalar");
162
163 warn_implicit_conversion ("Octave:array-to-scalar",
164 "real matrix", "complex scalar");
165
166 retval = matrix(0, 0);
167
168 return retval;
169}
170
171// FIXME
172
175{
177}
178
181{
183}
184
187{
188 return ComplexNDArray (matrix);
189}
190
193{
195}
196
199{
200 return NDArray (matrix);
201}
202
205{
208 if (warn && matrix.any_element_not_one_or_zero ())
210
211 return boolNDArray (matrix);
212}
213
216{
217 charNDArray retval (dims ());
218
219 octave_idx_type nel = numel ();
220
221 for (octave_idx_type i = 0; i < nel; i++)
222 retval.elem (i) = static_cast<char> (matrix.elem (i));
223
224 return retval;
225}
226
229{
230 return SparseMatrix (matrix_value ());
231}
232
235{
236 // FIXME: Need a SparseComplexMatrix (Matrix) constructor to make
237 // this function more efficient. Then this should become
238 // return SparseComplexMatrix (matrix.matrix_value ());
240}
241
244{
245 return NDArray (matrix);
246}
247
250{
251 return FloatNDArray (matrix);
252}
253
256{
257 return int8NDArray (matrix);
258}
259
262{
263 return int16NDArray (matrix);
264}
265
268{
269 return int32NDArray (matrix);
270}
271
274{
275 return int64NDArray (matrix);
276}
277
280{
281 return uint8NDArray (matrix);
282}
283
286{
287 return uint16NDArray (matrix);
288}
289
292{
293 return uint32NDArray (matrix);
294}
295
298{
299 return uint64NDArray (matrix);
300}
301
304{
305 octave_value retval;
306 if (k == 0 && matrix.ndims () == 2
307 && (matrix.rows () == 1 || matrix.columns () == 1))
309 else
311
312 return retval;
313}
314
317{
318 if (matrix.ndims () != 2
319 || (matrix.rows () != 1 && matrix.columns () != 1))
320 error ("diag: expecting vector argument");
321
322 FloatMatrix mat (matrix);
323
324 return mat.diag (m, n);
325}
326
329{
330 octave_value retval;
331 dim_vector dv = dims ();
332 octave_idx_type nel = dv.numel ();
333
334 charNDArray chm (dv);
335
336 bool warned = false;
337
338 for (octave_idx_type i = 0; i < nel; i++)
339 {
340 octave_quit ();
341
342 float d = matrix(i);
343
346
347 int ival = octave::math::nint (d);
348
349 if (ival < 0 || ival > std::numeric_limits<unsigned char>::max ())
350 {
351 // FIXME: is there something better we could do?
352
353 ival = 0;
354
355 if (! warned)
356 {
357 ::warning ("range error for conversion to character value");
358 warned = true;
359 }
360 }
361
362 chm(i) = static_cast<char> (ival);
363 }
364
365 retval = octave_value (chm, type);
366
367 return retval;
368}
369
370bool
372{
373 dim_vector dv = dims ();
374
375 if (dv.ndims () > 2)
376 {
378
379 os << "# ndims: " << dv.ndims () << "\n";
380
381 for (int i=0; i < dv.ndims (); i++)
382 os << ' ' << dv(i);
383
384 os << "\n" << tmp;
385 }
386 else
387 {
388 // Keep this case, rather than use generic code above for backward
389 // compatibility. Makes load_ascii much more complex!!
390 os << "# rows: " << rows () << "\n"
391 << "# columns: " << columns () << "\n";
392
393 os << float_matrix_value ();
394 }
395
396 return true;
397}
398
399bool
401{
402 string_vector keywords(2);
403
404 keywords[0] = "ndims";
405 keywords[1] = "rows";
406
407 std::string kw;
408 octave_idx_type val = 0;
409
410 if (! extract_keyword (is, keywords, kw, val, true))
411 error ("load: failed to extract number of rows and columns");
412
413 // Set "C" locale for the duration of this function to avoid the performance
414 // panelty of frequently switching the locale when reading floating point
415 // values from the stream.
416 char *prev_locale = std::setlocale (LC_ALL, nullptr);
417 std::string old_locale (prev_locale ? prev_locale : "");
418 std::setlocale (LC_ALL, "C");
420 ([&old_locale] () { std::setlocale (LC_ALL, old_locale.c_str ()); });
421
422 if (kw == "ndims")
423 {
424 int mdims = static_cast<int> (val);
425
426 if (mdims < 0)
427 error ("load: failed to extract number of dimensions");
428
429 dim_vector dv;
430 dv.resize (mdims);
431
432 for (int i = 0; i < mdims; i++)
433 is >> dv(i);
434
435 if (! is)
436 error ("load: failed to read dimensions");
437
438 FloatNDArray tmp(dv);
439
440 is >> tmp;
441
442 if (! is)
443 error ("load: failed to load matrix constant");
444
445 matrix = tmp;
446 }
447 else if (kw == "rows")
448 {
449 octave_idx_type nr = val;
450 octave_idx_type nc = 0;
451
452 if (nr < 0 || ! extract_keyword (is, "columns", nc) || nc < 0)
453 error ("load: failed to extract number of rows and columns");
454
455 if (nr > 0 && nc > 0)
456 {
457 FloatMatrix tmp (nr, nc);
458 is >> tmp;
459 if (! is)
460 error ("load: failed to load matrix constant");
461
462 matrix = tmp;
463 }
464 else if (nr == 0 || nc == 0)
465 matrix = FloatMatrix (nr, nc);
466 else
468 }
469 else
471
472 return true;
473}
474
475bool
476octave_float_matrix::save_binary (std::ostream& os, bool)
477{
478 dim_vector dv = dims ();
479 if (dv.ndims () < 1)
480 return false;
481
482 // Use negative value for ndims to differentiate with old format!!
483 int32_t tmp = - dv.ndims ();
484 os.write (reinterpret_cast<char *> (&tmp), 4);
485 for (int i = 0; i < dv.ndims (); i++)
486 {
487 tmp = dv(i);
488 os.write (reinterpret_cast<char *> (&tmp), 4);
489 }
490
492 save_type st = LS_FLOAT;
493 if (dv.numel () > 8192) // FIXME: make this configurable.
494 {
495 float max_val, min_val;
496 if (m.all_integers (max_val, min_val))
497 st = octave::get_save_type (max_val, min_val);
498 }
499
500 const float *mtmp = m.data ();
501 write_floats (os, mtmp, st, dv.numel ());
502
503 return true;
504}
505
506bool
507octave_float_matrix::load_binary (std::istream& is, bool swap,
509{
510 char tmp;
511 int32_t mdims;
512 if (! is.read (reinterpret_cast<char *> (&mdims), 4))
513 return false;
514 if (swap)
515 swap_bytes<4> (&mdims);
516 if (mdims < 0)
517 {
518 mdims = - mdims;
519 int32_t di;
520 dim_vector dv;
521 dv.resize (mdims);
522
523 for (int i = 0; i < mdims; i++)
524 {
525 if (! is.read (reinterpret_cast<char *> (&di), 4))
526 return false;
527 if (swap)
528 swap_bytes<4> (&di);
529 dv(i) = di;
530 }
531
532 // Convert an array with a single dimension to be a row vector.
533 // Octave should never write files like this, other software
534 // might.
535
536 if (mdims == 1)
537 {
538 mdims = 2;
539 dv.resize (mdims);
540 dv(1) = dv(0);
541 dv(0) = 1;
542 }
543
544 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
545 return false;
546
547 FloatNDArray m(dv);
548 float *re = m.fortran_vec ();
549 read_floats (is, re, static_cast<save_type> (tmp), dv.numel (),
550 swap, fmt);
551
552 if (! is)
553 return false;
554
555 matrix = m;
556 }
557 else
558 {
559 int32_t nr, nc;
560 nr = mdims;
561 if (! is.read (reinterpret_cast<char *> (&nc), 4))
562 return false;
563 if (swap)
564 swap_bytes<4> (&nc);
565 if (! is.read (reinterpret_cast<char *> (&tmp), 1))
566 return false;
567 FloatMatrix m (nr, nc);
568 float *re = m.fortran_vec ();
569 octave_idx_type len = static_cast<octave_idx_type> (nr) * nc;
570 read_floats (is, re, static_cast<save_type> (tmp), len, swap, fmt);
571
572 if (! is)
573 return false;
574
575 matrix = m;
576 }
577 return true;
578}
579
580bool
582{
583 bool retval = false;
584
585#if defined (HAVE_HDF5)
586
587 dim_vector dv = dims ();
588 int empty = save_hdf5_empty (loc_id, name, dv);
589 if (empty)
590 return (empty > 0);
591
592 int rank = dv.ndims ();
593 hid_t space_hid, data_hid;
594 space_hid = data_hid = -1;
596
597 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
598
599 // Octave uses column-major, while HDF5 uses row-major ordering
600 for (int i = 0; i < rank; i++)
601 hdims[i] = dv(rank-i-1);
602
603 space_hid = H5Screate_simple (rank, hdims, nullptr);
604
605 if (space_hid < 0) return false;
606
607 hid_t save_type_hid = H5T_NATIVE_FLOAT;
608
609#if defined (HAVE_HDF5_INT2FLOAT_CONVERSIONS)
610 // hdf5 currently doesn't support float/integer conversions
611 else
612 {
613 float max_val, min_val;
614
615 if (m.all_integers (max_val, min_val))
616 save_type_hid
617 = save_type_to_hdf5 (octave::get_save_type (max_val, min_val));
618 }
619#endif
620#if defined (HAVE_HDF5_18)
621 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
623#else
624 data_hid = H5Dcreate (loc_id, name, save_type_hid, space_hid,
626#endif
627 if (data_hid < 0)
628 {
629 H5Sclose (space_hid);
630 return false;
631 }
632
633 float *mtmp = m.fortran_vec ();
634 retval = H5Dwrite (data_hid, H5T_NATIVE_FLOAT, octave_H5S_ALL, octave_H5S_ALL,
635 octave_H5P_DEFAULT, mtmp) >= 0;
636
637 H5Dclose (data_hid);
638 H5Sclose (space_hid);
639
640#else
641 octave_unused_parameter (loc_id);
642 octave_unused_parameter (name);
643
644 warn_save ("hdf5");
645#endif
646
647 return retval;
648}
649
650bool
652{
653 bool retval = false;
654
655#if defined (HAVE_HDF5)
656
657 dim_vector dv;
658 int empty = load_hdf5_empty (loc_id, name, dv);
659 if (empty > 0)
660 matrix.resize (dv);
661 if (empty)
662 return (empty > 0);
663
664#if defined (HAVE_HDF5_18)
665 hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
666#else
667 hid_t data_hid = H5Dopen (loc_id, name);
668#endif
669 hid_t space_id = H5Dget_space (data_hid);
670
671 hsize_t rank = H5Sget_simple_extent_ndims (space_id);
672
673 if (rank < 1)
674 {
675 H5Sclose (space_id);
676 H5Dclose (data_hid);
677 return false;
678 }
679
680 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
681 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
682
683 H5Sget_simple_extent_dims (space_id, hdims, maxdims);
684
685 // Octave uses column-major, while HDF5 uses row-major ordering
686 if (rank == 1)
687 {
688 dv.resize (2);
689 dv(0) = 1;
690 dv(1) = hdims[0];
691 }
692 else
693 {
694 dv.resize (rank);
695 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
696 dv(j) = hdims[i];
697 }
698
699 FloatNDArray m (dv);
700 float *re = m.fortran_vec ();
701 if (H5Dread (data_hid, H5T_NATIVE_FLOAT, octave_H5S_ALL, octave_H5S_ALL,
702 octave_H5P_DEFAULT, re) >= 0)
703 {
704 retval = true;
705 matrix = m;
706 }
707
708 H5Sclose (space_id);
709 H5Dclose (data_hid);
710
711#else
712 octave_unused_parameter (loc_id);
713 octave_unused_parameter (name);
714
715 warn_load ("hdf5");
716#endif
717
718 return retval;
719}
720
721void
723 bool pr_as_read_syntax) const
724{
725 octave_print_internal (os, matrix, pr_as_read_syntax,
727}
728
729mxArray *
730octave_float_matrix::as_mxArray (bool interleaved) const
731{
732 mxArray *retval = new mxArray (interleaved, mxSINGLE_CLASS, dims (), mxREAL);
733
734 mxSingle *pd = static_cast<mxSingle *> (retval->get_data ());
735
736 mwSize nel = numel ();
737
738 const float *pdata = matrix.data ();
739
740 for (mwIndex i = 0; i < nel; i++)
741 pd[i] = pdata[i];
742
743 return retval;
744}
745
746// This uses a smarter strategy for doing the complex->real mappers. We
747// allocate an array for a real result and keep filling it until a complex
748// result is produced.
749static octave_value
750do_rc_map (const FloatNDArray& a, FloatComplex (&fcn) (float))
751{
752 octave_idx_type n = a.numel ();
753 FloatNDArray rr (a.dims ());
754
755 for (octave_idx_type i = 0; i < n; i++)
756 {
757 octave_quit ();
758
759 FloatComplex tmp = fcn (a(i));
760 if (tmp.imag () == 0.0)
761 rr.xelem (i) = tmp.real ();
762 else
763 {
764 FloatComplexNDArray rc (a.dims ());
765
766 for (octave_idx_type j = 0; j < i; j++)
767 rc.xelem (j) = rr.xelem (j);
768
769 rc.xelem (i) = tmp;
770
771 for (octave_idx_type j = i+1; j < n; j++)
772 {
773 octave_quit ();
774
775 rc.xelem (j) = fcn (a(j));
776 }
777
778 return new octave_float_complex_matrix (rc);
779 }
780 }
781
782 return rr;
783}
784
787{
788 switch (umap)
789 {
790 case umap_imag:
791 return FloatNDArray (matrix.dims (), 0.0);
792
793 case umap_real:
794 case umap_conj:
795 return matrix;
796
797 // Mappers handled specially.
798#define ARRAY_METHOD_MAPPER(UMAP, FCN) \
799 case umap_ ## UMAP: \
800 return octave_value (matrix.FCN ())
801
806
807#define ARRAY_MAPPER(UMAP, TYPE, FCN) \
808 case umap_ ## UMAP: \
809 return octave_value (matrix.map<TYPE> (FCN))
810
811#define RC_ARRAY_MAPPER(UMAP, TYPE, FCN) \
812 case umap_ ## UMAP: \
813 return do_rc_map (matrix, FCN)
814
817 ARRAY_MAPPER (angle, float, std::arg);
818 ARRAY_MAPPER (arg, float, std::arg);
821 ARRAY_MAPPER (atan, float, ::atanf);
833 ARRAY_MAPPER (ceil, float, ::ceilf);
834 ARRAY_MAPPER (cos, float, ::cosf);
835 ARRAY_MAPPER (cosh, float, ::coshf);
836 ARRAY_MAPPER (exp, float, ::expf);
839 ARRAY_MAPPER (floor, float, ::floorf);
847 ARRAY_MAPPER (sin, float, ::sinf);
848 ARRAY_MAPPER (sinh, float, ::sinhf);
850 ARRAY_MAPPER (tan, float, ::tanf);
851 ARRAY_MAPPER (tanh, float, ::tanhf);
853 ARRAY_MAPPER (xsignbit, float, octave::math::signbit);
854
855 // Special cases for Matlab compatibility.
856 case umap_xtolower:
857 case umap_xtoupper:
858 return matrix;
859
860 case umap_xisalnum:
861 case umap_xisalpha:
862 case umap_xisascii:
863 case umap_xiscntrl:
864 case umap_xisdigit:
865 case umap_xisgraph:
866 case umap_xislower:
867 case umap_xisprint:
868 case umap_xispunct:
869 case umap_xisspace:
870 case umap_xisupper:
871 case umap_xisxdigit:
872 {
873 octave_value str_conv = convert_to_str (true, true);
874 return str_conv.map (umap);
875 }
876
877 default:
878 return octave_base_value::map (umap);
879 }
880}
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:63
charNDArray max(char d, const charNDArray &m)
Definition: chNDArray.cc:230
T & xelem(octave_idx_type n)
Size of the specified dimension.
Definition: Array.h:504
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:411
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Definition: Array.h:487
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 FloatMatrix diag(octave_idx_type k=0) const
Definition: fMatrix.cc:2412
OCTAVE_API bool all_integers(float &max_val, float &min_val) const
Definition: fNDArray.cc:308
OCTAVE_API bool any_element_is_nan(void) const
Definition: fNDArray.cc:275
OCTAVE_API bool any_element_not_one_or_zero(void) const
Definition: fNDArray.cc:287
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
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
dim_vector dims(void) const
Definition: ov-base-mat.h:116
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
virtual octave_value convert_to_str(bool pad=false, bool force=false, char type='\'') const
Definition: ov-base.cc:377
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
friend class octave_value
Definition: ov-base.h:256
OCTINTERP_API void warn_save(const char *type) const
Definition: ov-base.cc:1161
bool isempty(void) const
Definition: ov-base.h:391
FloatNDArray float_array_value(bool=false) const
ComplexNDArray complex_array_value(bool=false) const
charNDArray char_array_value(bool=false) const
octave_value as_int64(void) const
bool save_binary(std::ostream &os, bool save_as_floats)
octave_value as_uint8(void) const
octave_value map(unary_mapper_t umap) const
ComplexMatrix complex_matrix_value(bool=false) const
FloatComplex float_complex_value(bool=false) const
octave_value as_int16(void) const
FloatMatrix float_matrix_value(bool=false) const
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
octave_value as_uint64(void) const
octave_value as_uint16(void) const
bool save_ascii(std::ostream &os)
octave_value as_int8(void) const
double double_value(bool=false) const
FloatComplexNDArray float_complex_array_value(bool=false) const
Complex complex_value(bool=false) const
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
SparseComplexMatrix sparse_complex_matrix_value(bool=false) const
Matrix matrix_value(bool=false) const
octave_value as_uint32(void) const
octave_value convert_to_str_internal(bool pad, bool force, char type) const
octave_value diag(octave_idx_type k=0) const
octave_value as_int32(void) const
octave_value as_double(void) const
octave_base_value * try_narrowing_conversion(void)
octave_value as_single(void) const
boolNDArray bool_array_value(bool warn=false) const
float float_value(bool=false) const
SparseMatrix sparse_matrix_value(bool=false) const
bool load_ascii(std::istream &is)
NDArray array_value(bool=false) const
FloatComplexMatrix float_complex_matrix_value(bool=false) const
mxArray * as_mxArray(bool interleaved) const
octave_value map(octave_base_value::unary_mapper_t umap) const
Definition: ov.h:1634
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5S_ALL
void write_floats(std::ostream &os, const float *data, save_type type, octave_idx_type len)
Definition: data-conv.cc:942
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:836
save_type
Definition: data-conv.h:87
@ 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
function gamma(X)
Definition: gamma.f:3
QString name
intNDArray< octave_int16 > int16NDArray
Definition: int16NDArray.h:36
intNDArray< octave_int32 > int32NDArray
Definition: int32NDArray.h:36
intNDArray< octave_int64 > int64NDArray
Definition: int64NDArray.h:36
intNDArray< octave_int8 > int8NDArray
Definition: int8NDArray.h:36
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:116
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
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
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 NDArray
Definition: mx-fwd.h:38
class OCTAVE_API FloatDiagMatrix
Definition: mx-fwd.h:61
class OCTAVE_API boolNDArray
Definition: mx-fwd.h:42
class OCTAVE_API Matrix
Definition: mx-fwd.h:31
class OCTAVE_API ComplexMatrix
Definition: mx-fwd.h:32
class OCTAVE_API SparseMatrix
Definition: mx-fwd.h:55
class OCTAVE_API FloatComplexMatrix
Definition: mx-fwd.h:34
class OCTAVE_API FloatMatrix
Definition: mx-fwd.h:33
class OCTAVE_API ComplexNDArray
Definition: mx-fwd.h:39
class OCTAVE_API SparseComplexMatrix
Definition: mx-fwd.h:56
class OCTAVE_API FloatComplexNDArray
Definition: mx-fwd.h:41
class OCTAVE_API FloatNDArray
Definition: mx-fwd.h:40
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
double gamma(double x)
Definition: lo-specfun.cc:1912
bool isna(double x)
Definition: lo-mappers.cc:47
Complex rc_acos(double x)
Definition: lo-mappers.cc:236
double signbit(double x)
Definition: lo-mappers.h:54
double atanh(double x)
Definition: lo-specfun.h:63
bool isfinite(double x)
Definition: lo-mappers.h:192
int nint(double x)
Definition: lo-mappers.cc:212
double roundb(double x)
Definition: lo-mappers.h:147
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 rc_log2(double x)
Definition: lo-mappers.cc:300
Complex rc_log(double x)
Definition: lo-mappers.cc:287
Complex erfc(const Complex &x)
Definition: lo-specfun.cc:1652
double acosh(double x)
Definition: lo-specfun.h:40
Complex rc_sqrt(double x)
Definition: lo-mappers.cc:330
double erfcinv(double x)
Definition: lo-specfun.cc:1744
Complex rc_atanh(double x)
Definition: lo-mappers.cc:274
Complex rc_acosh(double x)
Definition: lo-mappers.cc:249
double erfi(double x)
Definition: lo-specfun.cc:1774
Complex rc_log1p(double x)
Definition: lo-specfun.cc:2247
double lgamma(double x)
Definition: lo-specfun.h:336
double erfinv(double x)
Definition: lo-specfun.cc:1863
Complex rc_log10(double x)
Definition: lo-mappers.cc:315
Complex rc_lgamma(double x)
Definition: lo-specfun.cc:2210
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
double cbrt(double x)
Definition: lo-specfun.h:289
Complex rc_asin(double x)
Definition: lo-mappers.cc:261
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)
void err_nan_to_character_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_value do_rc_map(const FloatNDArray &a, FloatComplex(&fcn)(float))
#define RC_ARRAY_MAPPER(UMAP, TYPE, FCN)
#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
intNDArray< octave_uint16 > uint16NDArray
Definition: uint16NDArray.h:36
intNDArray< octave_uint32 > uint32NDArray
Definition: uint32NDArray.h:36
intNDArray< octave_uint64 > uint64NDArray
Definition: uint64NDArray.h:36
intNDArray< octave_uint8 > uint8NDArray
Definition: uint8NDArray.h:36
F77_RET_T len
Definition: xerbla.cc:61