GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-str-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 <cctype>
31
32#include <istream>
33#include <ostream>
34#include <vector>
35
36#include "data-conv.h"
37#include "lo-ieee.h"
38#include "mach-info.h"
39#include "mx-base.h"
40#include "oct-locbuf.h"
41
42#include "byte-swap.h"
43#include "defun.h"
44#include "errwarn.h"
45#include "ls-ascii-helper.h"
46#include "ls-hdf5.h"
47#include "ls-oct-text.h"
48#include "ls-utils.h"
49#include "ovl.h"
50#include "oct-hdf5.h"
51#include "oct-stream.h"
52#include "ops.h"
53#include "ov-scalar.h"
54#include "ov-re-mat.h"
55#include "ov-str-mat.h"
56#include "pr-output.h"
57#include "utils.h"
58
59
62 "char");
63
64static octave_base_value *
66{
67 octave_base_value *retval = nullptr;
68
70 = dynamic_cast<const octave_char_matrix_str&> (a);
71
72 NDArray nda = v.array_value (true);
73
74 if (nda.numel () == 1)
75 retval = new octave_scalar (nda(0));
76 else
77 retval = new octave_matrix (nda);
78
79 return retval;
80}
81
84{
87}
88
91 bool resize_ok, char type)
92{
93 octave_value retval;
94
95 octave_idx_type len = idx.length ();
96
97 // If we catch an indexing error in index_vector, we flag an error in
98 // index k. Ensure it is the right value before each idx_vector call.
99 // Same variable as used in the for loop in the default case.
100
101 octave_idx_type k = 0;
102
103 try
104 {
105 switch (len)
106 {
107 case 0:
108 retval = octave_value (matrix, type);
109 break;
110
111 case 1:
112 {
113 octave::idx_vector i = idx (0).index_vector ();
114
115 retval = octave_value (charNDArray (matrix.index (i, resize_ok)),
116 type);
117 }
118 break;
119
120 case 2:
121 {
122 octave::idx_vector i = idx (0).index_vector ();
123 k = 1;
124 octave::idx_vector j = idx (1).index_vector ();
125
126 retval = octave_value (charNDArray (matrix.index (i, j, resize_ok)),
127 type);
128 }
129 break;
130
131 default:
132 {
134
135 for (k = 0; k < len; k++)
136 idx_vec(k) = idx(k).index_vector ();
137
138 retval = octave_value (charNDArray (matrix.index (idx_vec, resize_ok)), type);
139 }
140 break;
141 }
142 }
143 catch (octave::index_exception& ie)
144 {
145 // Rethrow to allow more info to be reported later.
146 ie.set_pos_if_unset (len, k+1);
147 throw;
148 }
149
150 return retval;
151}
152
154octave_char_matrix_str::resize (const dim_vector& dv, bool fill) const
155{
156 charNDArray retval (matrix);
157 if (fill)
158 retval.resize (dv, 0);
159 else
160 retval.resize (dv);
161 return octave_value (retval, is_sq_string () ? '\'' : '"');
162}
163
164#define CHAR_MATRIX_CONV(TNAME, FCN) \
165 \
166 if (! force_string_conv) \
167 err_invalid_conversion ("string", TNAME); \
168 \
169 warn_implicit_conversion ("Octave:str-to-num", "string", TNAME); \
170 \
171 return octave_char_matrix::FCN ()
172
173double
174octave_char_matrix_str::double_value (bool force_string_conv) const
175{
176 CHAR_MATRIX_CONV ("real scalar", double_value);
177}
178
180octave_char_matrix_str::complex_value (bool force_string_conv) const
181{
182 CHAR_MATRIX_CONV ("complex scalar", complex_value);
183}
184
185Matrix
186octave_char_matrix_str::matrix_value (bool force_string_conv) const
187{
188 CHAR_MATRIX_CONV ("real matrix", matrix_value);
189}
190
193{
194 CHAR_MATRIX_CONV ("complex matrix", complex_matrix_value);
195}
196
198octave_char_matrix_str::array_value (bool force_string_conv) const
199{
200 CHAR_MATRIX_CONV ("real N-D array", array_value);
201}
202
205{
206 CHAR_MATRIX_CONV ("complex N-D array", complex_array_value);
207}
208
211{
212 string_vector retval;
213
214 if (matrix.ndims () != 2)
215 error ("invalid conversion of charNDArray to string_vector");
216
217 charMatrix chm (matrix);
218
219 octave_idx_type n = chm.rows ();
220
221 retval.resize (n);
222
223 for (octave_idx_type i = 0; i < n; i++)
224 retval[i] = chm.row_as_string (i);
225
226 return retval;
227}
228
229std::string
231{
232 if (matrix.ndims () != 2)
233 error ("invalid conversion of charNDArray to string");
234
235 charMatrix chm (matrix);
236
237 if (chm.rows () > 1)
238 warning_with_id ("Octave:charmat-truncated",
239 "multi-row character matrix converted to a string, only the first row is used");
240
241 // FIXME: Is this correct?
242 return chm.row_as_string (0);
243}
244
245/*
246%!test <*49536>
247%! warning ("on", "Octave:charmat-truncated", "local");
248%! s = char ("this", "is", "a", "char", "matrix");
249%! fail ("sprintf (s)", ...
250%! "warning", ...
251%! "multi-row character matrix converted to a string");
252*/
253
256{
257 Array<std::string> retval;
258
259 if (matrix.ndims () != 2)
260 error ("cellstr: cannot convert multidimensional arrays");
261
262 const charMatrix chm (matrix);
263 octave_idx_type nr = chm.rows ();
264 retval.clear (nr, 1);
265 for (octave_idx_type i = 0; i < nr; i++)
266 retval.xelem (i) = chm.row_as_string (i);
267
268 return retval;
269}
270
271void
273 bool pr_as_read_syntax) const
274{
275 octave_print_internal (os, matrix, pr_as_read_syntax,
277}
278
279void
281{
282 if (matrix.ndims () == 2 && numel () > 0)
283 {
284 charMatrix chm (matrix);
285 std::string tmp = chm.row_as_string (0);
286
287 // FIXME: should this be configurable?
288 std::size_t max_len = 100;
289
290 os << (tmp.length () > max_len ? tmp.substr (0, 100) : tmp);
291 }
292}
293
294std::string
297 octave_idx_type) const
298{
299 if (i == 0)
300 {
301 if (rows () == 1)
302 {
303 std::string retval = string_value ();
304
305 if (! is_sq_string ())
306 retval = octave::undo_string_escapes (retval);
307
308 return retval;
309 }
310 else if (is_zero_by_zero ())
311 return "";
312 }
313
314 std::string tname = type_name ();
315 dim_vector dv = matrix.dims ();
316 std::string dimstr = dv.str ();
317 return "[" + dimstr + " " + tname + "]";
318}
319
320bool
322{
323 dim_vector dv = dims ();
324 if (dv.ndims () > 2)
325 {
327 os << "# ndims: " << dv.ndims () << "\n";
328 for (int i=0; i < dv.ndims (); i++)
329 os << ' ' << dv(i);
330 os << "\n";
331 os.write (tmp.fortran_vec (), dv.numel ());
332 os << "\n";
333 }
334 else
335 {
336 // Keep this case, rather than use generic code above for
337 // backward compatibility. Makes load_ascii much more complex!!
339 octave_idx_type elements = chm.rows ();
340 os << "# elements: " << elements << "\n";
341 for (octave_idx_type i = 0; i < elements; i++)
342 {
343 unsigned len = chm.cols ();
344 os << "# length: " << len << "\n";
345 std::string tstr = chm.row_as_string (i);
346 const char *tmp = tstr.data ();
347 if (tstr.length () > len)
349 os.write (tmp, len);
350 os << "\n";
351 }
352 }
353
354 return true;
355}
356
357bool
359{
360 string_vector keywords(3);
361
362 keywords[0] = "ndims";
363 keywords[1] = "elements";
364 keywords[2] = "length";
365
366 std::string kw;
367 int val = 0;
368
369 if (! extract_keyword (is, keywords, kw, val, true))
370 error ("load: failed to extract number of rows and columns");
371
372 if (kw == "ndims")
373 {
374 int mdims = val;
375
376 if (mdims < 0)
377 error ("load: failed to extract matrix size");
378
379 dim_vector dv;
380 dv.resize (mdims);
381
382 for (int i = 0; i < mdims; i++)
383 is >> dv(i);
384
385 if (! is)
386 error ("load: failed to read dimensions");
387
388 charNDArray tmp(dv);
389
390 if (tmp.isempty ())
391 matrix = tmp;
392 else
393 {
394 char *ftmp = tmp.fortran_vec ();
395
397
398 if (! is.read (ftmp, dv.numel ()) || ! is)
399 error ("load: failed to load string constant");
400
401 matrix = tmp;
402 }
403 }
404 else if (kw == "elements")
405 {
406 int elements = val;
407
408 if (elements < 0)
409 error ("load: failed to extract number of string elements");
410
411 // FIXME: need to be able to get max length before doing anything.
412
413 charMatrix chm (elements, 0);
414 int max_len = 0;
415 for (int i = 0; i < elements; i++)
416 {
417 int len;
418 if (! extract_keyword (is, "length", len) || len < 0)
419 error ("load: failed to extract string length for element %d",
420 i+1);
421
422 // Use this instead of a C-style character
423 // buffer so that we can properly handle
424 // embedded NUL characters.
425 charMatrix tmp (1, len);
426 char *ptmp = tmp.fortran_vec ();
427
428 if (len > 0 && ! is.read (ptmp, len))
429 error ("load: failed to load string constant");
430
431 if (len > max_len)
432 {
433 max_len = len;
434 chm.resize (elements, max_len, 0);
435 }
436
437 chm.insert (tmp, i, 0);
438 }
439
440 matrix = chm;
441 }
442 else if (kw == "length")
443 {
444 int len = val;
445
446 if (len >= 0)
447 {
448 // This is cruft for backward compatibility,
449 // but relatively harmless.
450
451 // Use this instead of a C-style character buffer so
452 // that we can properly handle embedded NUL characters.
453 charMatrix tmp (1, len);
454 char *ptmp = tmp.fortran_vec ();
455
456 if (len > 0 && ! is.read (ptmp, len))
457 error ("load: failed to load string constant");
458
459 if (! is)
460 error ("load: failed to load string constant");
461
462 matrix = tmp;
463 }
464 }
465 else
467
468 return true;
469}
470
471bool
473 bool /* save_as_floats */)
474{
475 dim_vector dv = dims ();
476 if (dv.ndims () < 1)
477 return false;
478
479 // Use negative value for ndims to differentiate with old format!!
480 int32_t tmp = - dv.ndims ();
481 os.write (reinterpret_cast<char *> (&tmp), 4);
482 for (int i=0; i < dv.ndims (); i++)
483 {
484 tmp = dv(i);
485 os.write (reinterpret_cast<char *> (&tmp), 4);
486 }
487
489 os.write (m.fortran_vec (), dv.numel ());
490 return true;
491}
492
493bool
494octave_char_matrix_str::load_binary (std::istream& is, bool swap,
496{
497 int32_t elements;
498 if (! is.read (reinterpret_cast<char *> (&elements), 4))
499 return false;
500 if (swap)
501 swap_bytes<4> (&elements);
502
503 if (elements < 0)
504 {
505 int32_t mdims = - elements;
506 int32_t di;
507 dim_vector dv;
508 dv.resize (mdims);
509
510 for (int i = 0; i < mdims; i++)
511 {
512 if (! is.read (reinterpret_cast<char *> (&di), 4))
513 return false;
514 if (swap)
515 swap_bytes<4> (&di);
516 dv(i) = di;
517 }
518
519 // Convert an array with a single dimension to be a row vector.
520 // Octave should never write files like this, other software
521 // might.
522
523 if (mdims == 1)
524 {
525 mdims = 2;
526 dv.resize (mdims);
527 dv(1) = dv(0);
528 dv(0) = 1;
529 }
530
531 charNDArray m(dv);
532 char *tmp = m.fortran_vec ();
533 is.read (tmp, dv.numel ());
534
535 if (! is)
536 return false;
537
538 matrix = m;
539 }
540 else
541 {
542 charMatrix chm (elements, 0);
543 int max_len = 0;
544 for (int i = 0; i < elements; i++)
545 {
546 int32_t len;
547 if (! is.read (reinterpret_cast<char *> (&len), 4))
548 return false;
549 if (swap)
551 charMatrix btmp (1, len);
552 char *pbtmp = btmp.fortran_vec ();
553 if (! is.read (pbtmp, len))
554 return false;
555 if (len > max_len)
556 {
557 max_len = len;
558 chm.resize (elements, max_len, 0);
559 }
560 chm.insert (btmp, i, 0);
561 }
562 matrix = chm;
563 }
564 return true;
565}
566
567bool
569 bool /* save_as_floats */)
570{
571 bool retval = false;
572
573#if defined (HAVE_HDF5)
574
575 dim_vector dv = dims ();
576 int empty = save_hdf5_empty (loc_id, name, dv);
577 if (empty)
578 return (empty > 0);
579
580 int rank = dv.ndims ();
581 hid_t space_hid, data_hid;
582 space_hid = data_hid = -1;
584
585 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
586
587 // Octave uses column-major, while HDF5 uses row-major ordering
588 for (int i = 0; i < rank; i++)
589 hdims[i] = dv(rank-i-1);
590
591 space_hid = H5Screate_simple (rank, hdims, nullptr);
592 if (space_hid < 0)
593 return false;
594#if defined (HAVE_HDF5_18)
595 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
597#else
598 data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
600#endif
601 if (data_hid < 0)
602 {
603 H5Sclose (space_hid);
604 return false;
605 }
606
607 OCTAVE_LOCAL_BUFFER (char, s, dv.numel ());
608
609 for (int i = 0; i < dv.numel (); ++i)
610 s[i] = m(i);
611
612 retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, octave_H5S_ALL, octave_H5S_ALL,
613 octave_H5P_DEFAULT, s) >= 0;
614
615 H5Dclose (data_hid);
616 H5Sclose (space_hid);
617
618#else
619 octave_unused_parameter (loc_id);
620 octave_unused_parameter (name);
621
622 warn_save ("hdf5");
623#endif
624
625 return retval;
626}
627
628bool
630{
631 bool retval = false;
632
633#if defined (HAVE_HDF5)
634
635 dim_vector dv;
636 int empty = load_hdf5_empty (loc_id, name, dv);
637 if (empty > 0)
638 matrix.resize (dv);
639 if (empty)
640 return (empty > 0);
641
642#if defined (HAVE_HDF5_18)
643 hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
644#else
645 hid_t data_hid = H5Dopen (loc_id, name);
646#endif
647 hid_t space_hid = H5Dget_space (data_hid);
648 hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
649 hid_t type_hid = H5Dget_type (data_hid);
650 hid_t type_class_hid = H5Tget_class (type_hid);
651
652 if (type_class_hid == H5T_INTEGER)
653 {
654 if (rank < 1)
655 {
656 H5Tclose (type_hid);
657 H5Sclose (space_hid);
658 H5Dclose (data_hid);
659 return false;
660 }
661
662 OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
663 OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
664
665 H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
666
667 // Octave uses column-major, while HDF5 uses row-major ordering
668 if (rank == 1)
669 {
670 dv.resize (2);
671 dv(0) = 1;
672 dv(1) = hdims[0];
673 }
674 else
675 {
676 dv.resize (rank);
677 for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
678 dv(j) = hdims[i];
679 }
680
681 charNDArray m (dv);
682 char *str = m.fortran_vec ();
683 if (H5Dread (data_hid, H5T_NATIVE_CHAR, octave_H5S_ALL, octave_H5S_ALL,
684 octave_H5P_DEFAULT, str) >= 0)
685 {
686 retval = true;
687 matrix = m;
688 }
689
690 H5Tclose (type_hid);
691 H5Sclose (space_hid);
692 H5Dclose (data_hid);
693 return true;
694 }
695 else
696 {
697 // This is cruft for backward compatibility and easy data importation
698 if (rank == 0)
699 {
700 // a single string:
701 int slen = H5Tget_size (type_hid);
702 if (slen < 0)
703 {
704 H5Tclose (type_hid);
705 H5Sclose (space_hid);
706 H5Dclose (data_hid);
707 return false;
708 }
709 else
710 {
711 OCTAVE_LOCAL_BUFFER (char, s, slen+1);
712 // create datatype for (null-terminated) string to read into:
713 hid_t st_id = H5Tcopy (H5T_C_S1);
714 H5Tset_size (st_id, slen+1);
715 if (H5Dread (data_hid, st_id, octave_H5S_ALL,
717 {
718 H5Tclose (st_id);
719 H5Tclose (type_hid);
720 H5Sclose (space_hid);
721 H5Dclose (data_hid);
722 return false;
723 }
724
725 matrix = charMatrix (s);
726
727 H5Tclose (st_id);
728 H5Tclose (type_hid);
729 H5Sclose (space_hid);
730 H5Dclose (data_hid);
731 return true;
732 }
733 }
734 else if (rank == 1)
735 {
736 // string vector
737 hsize_t elements, maxdim;
738 H5Sget_simple_extent_dims (space_hid, &elements, &maxdim);
739 int slen = H5Tget_size (type_hid);
740 if (slen < 0)
741 {
742 H5Tclose (type_hid);
743 H5Sclose (space_hid);
744 H5Dclose (data_hid);
745 return false;
746 }
747 else
748 {
749 // hdf5 string arrays store strings of all the
750 // same physical length (I think), which is
751 // slightly wasteful, but oh well.
752
753 OCTAVE_LOCAL_BUFFER (char, s, elements * (slen+1));
754
755 // create datatype for (null-terminated) string
756 // to read into:
757 hid_t st_id = H5Tcopy (H5T_C_S1);
758 H5Tset_size (st_id, slen+1);
759
760 if (H5Dread (data_hid, st_id, octave_H5S_ALL,
762 {
763 H5Tclose (st_id);
764 H5Tclose (type_hid);
765 H5Sclose (space_hid);
766 H5Dclose (data_hid);
767 return false;
768 }
769
770 charMatrix chm (elements, slen, ' ');
771 for (hsize_t i = 0; i < elements; ++i)
772 {
773 chm.insert (s + i*(slen+1), i, 0);
774 }
775
776 matrix = chm;
777
778 H5Tclose (st_id);
779 H5Tclose (type_hid);
780 H5Sclose (space_hid);
781 H5Dclose (data_hid);
782 return true;
783 }
784 }
785 else
786 {
787 H5Tclose (type_hid);
788 H5Sclose (space_hid);
789 H5Dclose (data_hid);
790 return false;
791 }
792 }
793
794#else
795 octave_unused_parameter (loc_id);
796 octave_unused_parameter (name);
797
798 warn_load ("hdf5");
799#endif
800
801 return retval;
802}
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:63
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:129
T & xelem(octave_idx_type n)
Size of the specified dimension.
Definition: Array.h:504
OCTARRAY_API void clear(void)
Definition: Array.cc:87
OCTARRAY_API Array< T, Alloc > index(const octave::idx_vector &i) const
Indexing without resizing.
Definition: Array.cc:697
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:411
octave_idx_type cols(void) const
Definition: Array.h:457
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Definition: Array.h:487
octave_idx_type rows(void) const
Definition: Array.h:449
bool isempty(void) const
Size of the specified dimension.
Definition: Array.h:607
OCTARRAY_API void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array.cc:1010
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
Definition: dMatrix.h:42
void resize(octave_idx_type nr, octave_idx_type nc, char rfv=0)
Definition: chMatrix.h:98
OCTAVE_API charMatrix & insert(const char *s, octave_idx_type r, octave_idx_type c)
Definition: chMatrix.cc:59
OCTAVE_API std::string row_as_string(octave_idx_type, bool strip_ws=false) const
Definition: chMatrix.cc:82
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
OCTAVE_API std::string str(char sep='x') const
Definition: dim-vector.cc:68
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 set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
octave_idx_type numel(void) const
Definition: ov-base-mat.h:118
dim_vector dims(void) const
Definition: ov-base-mat.h:116
int current_print_indent_level(void) const
Definition: ov-base.h:893
bool is_zero_by_zero(void) const
Definition: ov-base.h:393
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
virtual bool is_sq_string(void) const
Definition: ov-base.h:419
OCTINTERP_API void warn_save(const char *type) const
Definition: ov-base.cc:1161
void short_disp(std::ostream &os) const
Definition: ov-str-mat.cc:280
ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-str-mat.cc:192
NDArray array_value(bool=false) const
Definition: ov-str-mat.cc:198
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-str-mat.cc:272
bool load_ascii(std::istream &is)
Definition: ov-str-mat.cc:358
type_conv_info numeric_conversion_function(void) const
Definition: ov-str-mat.cc:83
std::string type_name(void) const
Definition: ov-str-mat.h:184
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-str-mat.cc:629
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-str-mat.cc:494
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-str-mat.cc:568
Array< std::string > cellstr_value(void) const
Definition: ov-str-mat.cc:255
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition: ov-str-mat.cc:154
string_vector string_vector_value(bool pad=false) const
Definition: ov-str-mat.cc:210
Matrix matrix_value(bool=false) const
Definition: ov-str-mat.cc:186
Complex complex_value(bool=false) const
Definition: ov-str-mat.cc:180
bool save_ascii(std::ostream &os)
Definition: ov-str-mat.cc:321
double double_value(bool=false) const
Definition: ov-str-mat.cc:174
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
Definition: ov-str-mat.cc:295
octave_value do_index_op_internal(const octave_value_list &idx, bool resize_ok, char type='"')
Definition: ov-str-mat.cc:90
ComplexNDArray complex_array_value(bool=false) const
Definition: ov-str-mat.cc:204
std::string string_value(bool force=false) const
Definition: ov-str-mat.cc:230
bool save_binary(std::ostream &os, bool save_as_floats)
Definition: ov-str-mat.cc:472
charMatrix char_matrix_value(bool=false) const
Definition: ov-ch-mat.h:142
charNDArray char_array_value(bool=false) const
Definition: ov-ch-mat.h:145
static int static_type_id(void)
Definition: ov-re-mat.h:246
octave_idx_type length(void) const
Definition: ovl.h:113
void resize(octave_idx_type n, const std::string &rfv="")
Definition: str-vec.h:95
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5S_ALL
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:1070
void error(const char *fmt,...)
Definition: error.cc:980
#define panic_impossible()
Definition: error.h:411
QString name
void skip_preceeding_newline(std::istream &is)
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
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
Definition: ls-oct-text.cc:84
class OCTAVE_API charMatrix
Definition: mx-fwd.h:36
std::complex< double > Complex
Definition: oct-cmplx.h:33
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_conversion_function(const octave_base_value &a)
Definition: ov-str-mat.cc:65
#define CHAR_MATRIX_CONV(TNAME, FCN)
Definition: ov-str-mat.cc:164
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
Definition: pr-output.cc:1762
std::string undo_string_escapes(const std::string &s)
Definition: utils.cc:1029
F77_RET_T len
Definition: xerbla.cc:61