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