GNU Octave  6.2.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-2021 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 
64 static octave_base_value *
66 {
67  octave_base_value *retval = nullptr;
68 
69  const octave_char_matrix_str& v
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 {
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:
109  break;
110 
111  case 1:
112  {
113  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  idx_vector i = idx (0).index_vector ();
123  k = 1;
124  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  {
133  Array<idx_vector> idx_vec (dim_vector (len, 1));
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& e)
144  {
145  // Rethrow to allow more info to be reported later.
146  e.set_pos_if_unset (len, k+1);
147  throw;
148  }
149 
150  return retval;
151 }
152 
154 octave_char_matrix_str::resize (const dim_vector& dv, bool fill) const
155 {
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 
173 double
174 octave_char_matrix_str::double_value (bool force_string_conv) const
175 {
176  CHAR_MATRIX_CONV ("real scalar", double_value);
177 }
178 
179 Complex
180 octave_char_matrix_str::complex_value (bool force_string_conv) const
181 {
182  CHAR_MATRIX_CONV ("complex scalar", complex_value);
183 }
184 
185 Matrix
186 octave_char_matrix_str::matrix_value (bool force_string_conv) const
187 {
188  CHAR_MATRIX_CONV ("real matrix", matrix_value);
189 }
190 
192 octave_char_matrix_str::complex_matrix_value (bool force_string_conv) const
193 {
194  CHAR_MATRIX_CONV ("complex matrix", complex_matrix_value);
195 }
196 
197 NDArray
198 octave_char_matrix_str::array_value (bool force_string_conv) const
199 {
200  CHAR_MATRIX_CONV ("real N-D array", array_value);
201 }
202 
204 octave_char_matrix_str::complex_array_value (bool force_string_conv) const
205 {
206  CHAR_MATRIX_CONV ("complex N-D array", complex_array_value);
207 }
208 
211 {
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 
229 std::string
231 {
232  if (matrix.ndims () != 2)
233  error ("invalid conversion of charNDArray to string");
234 
235  charMatrix chm (matrix);
236 
237  // FIXME: Is this correct?
238  return chm.row_as_string (0);
239 }
240 
243 {
245 
246  if (matrix.ndims () != 2)
247  error ("cellstr: cannot convert multidimensional arrays");
248 
249  const charMatrix chm (matrix);
250  octave_idx_type nr = chm.rows ();
251  retval.clear (nr, 1);
252  for (octave_idx_type i = 0; i < nr; i++)
253  retval.xelem (i) = chm.row_as_string (i);
254 
255  return retval;
256 }
257 
258 void
260  bool pr_as_read_syntax) const
261 {
262  octave_print_internal (os, matrix, pr_as_read_syntax,
263  current_print_indent_level (), true);
264 }
265 
266 void
267 octave_char_matrix_str::short_disp (std::ostream& os) const
268 {
269  if (matrix.ndims () == 2 && numel () > 0)
270  {
271  std::string tmp = string_value ();
272 
273  // FIXME: should this be configurable?
274  size_t max_len = 100;
275 
276  os << (tmp.length () > max_len ? tmp.substr (0, 100) : tmp);
277  }
278 }
279 
280 std::string
282  octave_idx_type i,
283  octave_idx_type) const
284 {
285  if (i == 0)
286  {
287  if (rows () == 1)
288  {
289  std::string retval = string_value ();
290 
291  if (! is_sq_string ())
293 
294  return retval;
295  }
296  else if (is_zero_by_zero ())
297  return "";
298  }
299 
300  std::string tname = type_name ();
301  dim_vector dv = matrix.dims ();
302  std::string dimstr = dv.str ();
303  return "[" + dimstr + " " + tname + "]";
304 }
305 
306 bool
308 {
309  dim_vector dv = dims ();
310  if (dv.ndims () > 2)
311  {
312  charNDArray tmp = char_array_value ();
313  os << "# ndims: " << dv.ndims () << "\n";
314  for (int i=0; i < dv.ndims (); i++)
315  os << ' ' << dv(i);
316  os << "\n";
317  os.write (tmp.fortran_vec (), dv.numel ());
318  os << "\n";
319  }
320  else
321  {
322  // Keep this case, rather than use generic code above for
323  // backward compatibility. Makes load_ascii much more complex!!
324  charMatrix chm = char_matrix_value ();
325  octave_idx_type elements = chm.rows ();
326  os << "# elements: " << elements << "\n";
327  for (octave_idx_type i = 0; i < elements; i++)
328  {
329  unsigned len = chm.cols ();
330  os << "# length: " << len << "\n";
331  std::string tstr = chm.row_as_string (i);
332  const char *tmp = tstr.data ();
333  if (tstr.length () > len)
334  panic_impossible ();
335  os.write (tmp, len);
336  os << "\n";
337  }
338  }
339 
340  return true;
341 }
342 
343 bool
345 {
346  string_vector keywords(3);
347 
348  keywords[0] = "ndims";
349  keywords[1] = "elements";
350  keywords[2] = "length";
351 
352  std::string kw;
353  int val = 0;
354 
355  if (! extract_keyword (is, keywords, kw, val, true))
356  error ("load: failed to extract number of rows and columns");
357 
358  if (kw == "ndims")
359  {
360  int mdims = val;
361 
362  if (mdims < 0)
363  error ("load: failed to extract matrix size");
364 
365  dim_vector dv;
366  dv.resize (mdims);
367 
368  for (int i = 0; i < mdims; i++)
369  is >> dv(i);
370 
371  if (! is)
372  error ("load: failed to read dimensions");
373 
374  charNDArray tmp(dv);
375 
376  if (tmp.isempty ())
377  matrix = tmp;
378  else
379  {
380  char *ftmp = tmp.fortran_vec ();
381 
383 
384  if (! is.read (ftmp, dv.numel ()) || ! is)
385  error ("load: failed to load string constant");
386 
387  matrix = tmp;
388  }
389  }
390  else if (kw == "elements")
391  {
392  int elements = val;
393 
394  if (elements < 0)
395  error ("load: failed to extract number of string elements");
396 
397  // FIXME: need to be able to get max length before doing anything.
398 
399  charMatrix chm (elements, 0);
400  int max_len = 0;
401  for (int i = 0; i < elements; i++)
402  {
403  int len;
404  if (! extract_keyword (is, "length", len) || len < 0)
405  error ("load: failed to extract string length for element %d",
406  i+1);
407 
408  // Use this instead of a C-style character
409  // buffer so that we can properly handle
410  // embedded NUL characters.
411  charMatrix tmp (1, len);
412  char *ptmp = tmp.fortran_vec ();
413 
414  if (len > 0 && ! is.read (ptmp, len))
415  error ("load: failed to load string constant");
416 
417  if (len > max_len)
418  {
419  max_len = len;
420  chm.resize (elements, max_len, 0);
421  }
422 
423  chm.insert (tmp, i, 0);
424  }
425 
426  matrix = chm;
427  }
428  else if (kw == "length")
429  {
430  int len = val;
431 
432  if (len >= 0)
433  {
434  // This is cruft for backward compatibility,
435  // but relatively harmless.
436 
437  // Use this instead of a C-style character buffer so
438  // that we can properly handle embedded NUL characters.
439  charMatrix tmp (1, len);
440  char *ptmp = tmp.fortran_vec ();
441 
442  if (len > 0 && ! is.read (ptmp, len))
443  error ("load: failed to load string constant");
444 
445  if (! is)
446  error ("load: failed to load string constant");
447 
448  matrix = tmp;
449  }
450  }
451  else
452  panic_impossible ();
453 
454  return true;
455 }
456 
457 bool
459  bool /* save_as_floats */)
460 {
461  dim_vector dv = dims ();
462  if (dv.ndims () < 1)
463  return false;
464 
465  // Use negative value for ndims to differentiate with old format!!
466  int32_t tmp = - dv.ndims ();
467  os.write (reinterpret_cast<char *> (&tmp), 4);
468  for (int i=0; i < dv.ndims (); i++)
469  {
470  tmp = dv(i);
471  os.write (reinterpret_cast<char *> (&tmp), 4);
472  }
473 
475  os.write (m.fortran_vec (), dv.numel ());
476  return true;
477 }
478 
479 bool
480 octave_char_matrix_str::load_binary (std::istream& is, bool swap,
482 {
483  int32_t elements;
484  if (! is.read (reinterpret_cast<char *> (&elements), 4))
485  return false;
486  if (swap)
487  swap_bytes<4> (&elements);
488 
489  if (elements < 0)
490  {
491  int32_t mdims = - elements;
492  int32_t di;
493  dim_vector dv;
494  dv.resize (mdims);
495 
496  for (int i = 0; i < mdims; i++)
497  {
498  if (! is.read (reinterpret_cast<char *> (&di), 4))
499  return false;
500  if (swap)
501  swap_bytes<4> (&di);
502  dv(i) = di;
503  }
504 
505  // Convert an array with a single dimension to be a row vector.
506  // Octave should never write files like this, other software
507  // might.
508 
509  if (mdims == 1)
510  {
511  mdims = 2;
512  dv.resize (mdims);
513  dv(1) = dv(0);
514  dv(0) = 1;
515  }
516 
517  charNDArray m(dv);
518  char *tmp = m.fortran_vec ();
519  is.read (tmp, dv.numel ());
520 
521  if (! is)
522  return false;
523 
524  matrix = m;
525  }
526  else
527  {
528  charMatrix chm (elements, 0);
529  int max_len = 0;
530  for (int i = 0; i < elements; i++)
531  {
532  int32_t len;
533  if (! is.read (reinterpret_cast<char *> (&len), 4))
534  return false;
535  if (swap)
536  swap_bytes<4> (&len);
537  charMatrix btmp (1, len);
538  char *pbtmp = btmp.fortran_vec ();
539  if (! is.read (pbtmp, len))
540  return false;
541  if (len > max_len)
542  {
543  max_len = len;
544  chm.resize (elements, max_len, 0);
545  }
546  chm.insert (btmp, i, 0);
547  }
548  matrix = chm;
549  }
550  return true;
551 }
552 
553 bool
555  bool /* save_as_floats */)
556 {
557  bool retval = false;
558 
559 #if defined (HAVE_HDF5)
560 
561  dim_vector dv = dims ();
562  int empty = save_hdf5_empty (loc_id, name, dv);
563  if (empty)
564  return (empty > 0);
565 
566  int rank = dv.ndims ();
567  hid_t space_hid, data_hid;
568  space_hid = data_hid = -1;
570 
571  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
572 
573  // Octave uses column-major, while HDF5 uses row-major ordering
574  for (int i = 0; i < rank; i++)
575  hdims[i] = dv(rank-i-1);
576 
577  space_hid = H5Screate_simple (rank, hdims, nullptr);
578  if (space_hid < 0)
579  return false;
580 #if defined (HAVE_HDF5_18)
581  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
583 #else
584  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
586 #endif
587  if (data_hid < 0)
588  {
589  H5Sclose (space_hid);
590  return false;
591  }
592 
593  OCTAVE_LOCAL_BUFFER (char, s, dv.numel ());
594 
595  for (int i = 0; i < dv.numel (); ++i)
596  s[i] = m(i);
597 
598  retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, octave_H5S_ALL, octave_H5S_ALL,
599  octave_H5P_DEFAULT, s) >= 0;
600 
601  H5Dclose (data_hid);
602  H5Sclose (space_hid);
603 
604 #else
605  octave_unused_parameter (loc_id);
606  octave_unused_parameter (name);
607 
608  warn_save ("hdf5");
609 #endif
610 
611  return retval;
612 }
613 
614 bool
616 {
617  bool retval = false;
618 
619 #if defined (HAVE_HDF5)
620 
621  dim_vector dv;
622  int empty = load_hdf5_empty (loc_id, name, dv);
623  if (empty > 0)
624  matrix.resize (dv);
625  if (empty)
626  return (empty > 0);
627 
628 #if defined (HAVE_HDF5_18)
629  hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
630 #else
631  hid_t data_hid = H5Dopen (loc_id, name);
632 #endif
633  hid_t space_hid = H5Dget_space (data_hid);
634  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
635  hid_t type_hid = H5Dget_type (data_hid);
636  hid_t type_class_hid = H5Tget_class (type_hid);
637 
638  if (type_class_hid == H5T_INTEGER)
639  {
640  if (rank < 1)
641  {
642  H5Tclose (type_hid);
643  H5Sclose (space_hid);
644  H5Dclose (data_hid);
645  return false;
646  }
647 
648  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
649  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
650 
651  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
652 
653  // Octave uses column-major, while HDF5 uses row-major ordering
654  if (rank == 1)
655  {
656  dv.resize (2);
657  dv(0) = 1;
658  dv(1) = hdims[0];
659  }
660  else
661  {
662  dv.resize (rank);
663  for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
664  dv(j) = hdims[i];
665  }
666 
667  charNDArray m (dv);
668  char *str = m.fortran_vec ();
669  if (H5Dread (data_hid, H5T_NATIVE_CHAR, octave_H5S_ALL, octave_H5S_ALL,
670  octave_H5P_DEFAULT, str) >= 0)
671  {
672  retval = true;
673  matrix = m;
674  }
675 
676  H5Tclose (type_hid);
677  H5Sclose (space_hid);
678  H5Dclose (data_hid);
679  return true;
680  }
681  else
682  {
683  // This is cruft for backward compatibility and easy data importation
684  if (rank == 0)
685  {
686  // a single string:
687  int slen = H5Tget_size (type_hid);
688  if (slen < 0)
689  {
690  H5Tclose (type_hid);
691  H5Sclose (space_hid);
692  H5Dclose (data_hid);
693  return false;
694  }
695  else
696  {
697  OCTAVE_LOCAL_BUFFER (char, s, slen+1);
698  // create datatype for (null-terminated) string to read into:
699  hid_t st_id = H5Tcopy (H5T_C_S1);
700  H5Tset_size (st_id, slen+1);
701  if (H5Dread (data_hid, st_id, octave_H5S_ALL,
703  {
704  H5Tclose (st_id);
705  H5Tclose (type_hid);
706  H5Sclose (space_hid);
707  H5Dclose (data_hid);
708  return false;
709  }
710 
711  matrix = charMatrix (s);
712 
713  H5Tclose (st_id);
714  H5Tclose (type_hid);
715  H5Sclose (space_hid);
716  H5Dclose (data_hid);
717  return true;
718  }
719  }
720  else if (rank == 1)
721  {
722  // string vector
723  hsize_t elements, maxdim;
724  H5Sget_simple_extent_dims (space_hid, &elements, &maxdim);
725  int slen = H5Tget_size (type_hid);
726  if (slen < 0)
727  {
728  H5Tclose (type_hid);
729  H5Sclose (space_hid);
730  H5Dclose (data_hid);
731  return false;
732  }
733  else
734  {
735  // hdf5 string arrays store strings of all the
736  // same physical length (I think), which is
737  // slightly wasteful, but oh well.
738 
739  OCTAVE_LOCAL_BUFFER (char, s, elements * (slen+1));
740 
741  // create datatype for (null-terminated) string
742  // to read into:
743  hid_t st_id = H5Tcopy (H5T_C_S1);
744  H5Tset_size (st_id, slen+1);
745 
746  if (H5Dread (data_hid, st_id, octave_H5S_ALL,
748  {
749  H5Tclose (st_id);
750  H5Tclose (type_hid);
751  H5Sclose (space_hid);
752  H5Dclose (data_hid);
753  return false;
754  }
755 
756  charMatrix chm (elements, slen, ' ');
757  for (hsize_t i = 0; i < elements; ++i)
758  {
759  chm.insert (s + i*(slen+1), i, 0);
760  }
761 
762  matrix = chm;
763 
764  H5Tclose (st_id);
765  H5Tclose (type_hid);
766  H5Sclose (space_hid);
767  H5Dclose (data_hid);
768  return true;
769  }
770  }
771  else
772  {
773  H5Tclose (type_hid);
774  H5Sclose (space_hid);
775  H5Dclose (data_hid);
776  return false;
777  }
778  }
779 
780 #else
781  octave_unused_parameter (loc_id);
782  octave_unused_parameter (name);
783 
784  warn_load ("hdf5");
785 #endif
786 
787  return retval;
788 }
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:63
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:128
void resize(const dim_vector &dv, const T &rfv)
Size of the specified dimension.
Definition: Array.cc:1011
T & xelem(octave_idx_type n)
Size of the specified dimension.
Definition: Array.h:469
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:377
octave_idx_type cols(void) const
Definition: Array.h:423
octave_idx_type rows(void) const
Definition: Array.h:415
Array< T > index(const idx_vector &i) const
Indexing without resizing.
Definition: Array.cc:698
void clear(void)
Definition: Array.cc:87
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Definition: Array.h:453
int ndims(void) const
Size of the specified dimension.
Definition: Array.h:589
const T * fortran_vec(void) const
Size of the specified dimension.
Definition: Array.h:583
bool isempty(void) const
Size of the specified dimension.
Definition: Array.h:572
Definition: dMatrix.h:42
void resize(octave_idx_type nr, octave_idx_type nc, char rfv=0)
Definition: chMatrix.h:95
charMatrix & insert(const char *s, octave_idx_type r, octave_idx_type c)
Definition: chMatrix.cc:59
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:95
std::string str(char sep='x') const
Definition: dim-vector.cc:85
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition: dim-vector.h:401
void resize(int n, int fill_value=0)
Definition: dim-vector.h:349
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:334
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:114
dim_vector dims(void) const
Definition: ov-base-mat.h:112
int current_print_indent_level(void) const
Definition: ov-base.h:847
bool is_zero_by_zero(void) const
Definition: ov-base.h:359
void warn_load(const char *type) const
Definition: ov-base.cc:1090
octave_idx_type rows(void) const
Definition: ov-base.h:318
friend class octave_value
Definition: ov-base.h:228
virtual bool is_sq_string(void) const
Definition: ov-base.h:385
void warn_save(const char *type) const
Definition: ov-base.cc:1099
void short_disp(std::ostream &os) const
Definition: ov-str-mat.cc:267
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:259
bool load_ascii(std::istream &is)
Definition: ov-str-mat.cc:344
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:615
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-str-mat.cc:480
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-str-mat.cc:554
Array< std::string > cellstr_value(void) const
Definition: ov-str-mat.cc:242
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:307
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:281
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:458
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:250
octave_idx_type length(void) const
Definition: ovl.h:113
const octave_hdf5_id octave_H5P_DEFAULT
const octave_hdf5_id octave_H5S_ALL
void error(const char *fmt,...)
Definition: error.cc:968
#define panic_impossible()
Definition: error.h:380
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:1224
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Definition: ls-hdf5.cc:1280
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
Definition: ls-oct-text.cc:84
T octave_idx_type m
Definition: mx-inlines.cc:773
octave_idx_type n
Definition: mx-inlines.cc:753
std::string undo_string_escapes(const std::string &s)
Definition: utils.cc:885
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:180
#define CHAR_MATRIX_CONV(TNAME, FCN)
Definition: ov-str-mat.cc:164
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
Definition: ov-str-mat.cc:65
octave_value::octave_value(const Array< char > &chm, char type) return retval
Definition: ov.cc:811
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
Definition: pr-output.cc:1762
F77_RET_T len
Definition: xerbla.cc:61