GNU Octave  4.2.1
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-2017 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 #if defined (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 "errwarn.h"
42 #include "ls-ascii-helper.h"
43 #include "ls-hdf5.h"
44 #include "ls-oct-text.h"
45 #include "ls-utils.h"
46 #include "ovl.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 {
66 
67  const octave_char_matrix_str& v
68  = dynamic_cast<const octave_char_matrix_str&> (a);
69 
70  NDArray nda = v.array_value (true);
71 
72  if (nda.numel () == 1)
73  retval = new octave_scalar (nda(0));
74  else
75  retval = new octave_matrix (nda);
76 
77  return retval;
78 }
79 
82 {
85 }
86 
89  bool resize_ok, char type)
90 {
92 
93  octave_idx_type len = idx.length ();
94 
95  // If we catch an indexing error in index_vector, we flag an error in
96  // index k. Ensure it is the right value befor each idx_vector call.
97  // Same variable as used in the for loop in the default case.
98 
99  octave_idx_type k = 0;
100 
101  try
102  {
103  switch (len)
104  {
105  case 0:
106  retval = octave_value (matrix, type);
107  break;
108 
109  case 1:
110  {
111  idx_vector i = idx (0).index_vector ();
112 
113  retval = octave_value (charNDArray (matrix.index (i, resize_ok)),
114  type);
115  }
116  break;
117 
118  case 2:
119  {
120  idx_vector i = idx (0).index_vector ();
121  k = 1;
122  idx_vector j = idx (1).index_vector ();
123 
124  retval = octave_value (charNDArray (matrix.index (i, j, resize_ok)),
125  type);
126  }
127  break;
128 
129  default:
130  {
131  Array<idx_vector> idx_vec (dim_vector (len, 1));
132 
133  for (k = 0; k < len; k++)
134  idx_vec(k) = idx(k).index_vector ();
135 
136  retval =
137  octave_value (charNDArray (matrix.index (idx_vec, resize_ok)),
138  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 
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 
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  {
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 bool
282 {
283  dim_vector dv = dims ();
284  if (dv.ndims () > 2)
285  {
287  os << "# ndims: " << dv.ndims () << "\n";
288  for (int i=0; i < dv.ndims (); i++)
289  os << " " << dv(i);
290  os << "\n";
291  os.write (tmp.fortran_vec (), dv.numel ());
292  os << "\n";
293  }
294  else
295  {
296  // Keep this case, rather than use generic code above for
297  // backward compatibility. Makes load_ascii much more complex!!
298  charMatrix chm = char_matrix_value ();
299  octave_idx_type elements = chm.rows ();
300  os << "# elements: " << elements << "\n";
301  for (octave_idx_type i = 0; i < elements; i++)
302  {
303  unsigned len = chm.cols ();
304  os << "# length: " << len << "\n";
305  std::string tstr = chm.row_as_string (i);
306  const char *tmp = tstr.data ();
307  if (tstr.length () > len)
308  panic_impossible ();
309  os.write (tmp, len);
310  os << "\n";
311  }
312  }
313 
314  return true;
315 }
316 
317 bool
319 {
321 
322  keywords[0] = "ndims";
323  keywords[1] = "elements";
324  keywords[2] = "length";
325 
326  std::string kw;
327  int val = 0;
328 
329  if (! extract_keyword (is, keywords, kw, val, true))
330  error ("load: failed to extract number of rows and columns");
331 
332  if (kw == "ndims")
333  {
334  int mdims = val;
335 
336  if (mdims < 0)
337  error ("load: failed to extract matrix size");
338 
339  dim_vector dv;
340  dv.resize (mdims);
341 
342  for (int i = 0; i < mdims; i++)
343  is >> dv(i);
344 
345  if (! is)
346  error ("load: failed to read dimensions");
347 
348  charNDArray tmp(dv);
349 
350  if (tmp.is_empty ())
351  matrix = tmp;
352  else
353  {
354  char *ftmp = tmp.fortran_vec ();
355 
357 
358  if (! is.read (ftmp, dv.numel ()) || ! is)
359  error ("load: failed to load string constant");
360 
361  matrix = tmp;
362  }
363  }
364  else if (kw == "elements")
365  {
366  int elements = val;
367 
368  if (elements < 0)
369  error ("load: failed to extract number of string elements");
370 
371  // FIXME: need to be able to get max length before doing anything.
372 
373  charMatrix chm (elements, 0);
374  int max_len = 0;
375  for (int i = 0; i < elements; i++)
376  {
377  int len;
378  if (! extract_keyword (is, "length", len) || len < 0)
379  error ("load: failed to extract string length for element %d",
380  i+1);
381 
382  // Use this instead of a C-style character
383  // buffer so that we can properly handle
384  // embedded NUL characters.
385  charMatrix tmp (1, len);
386  char *ptmp = tmp.fortran_vec ();
387 
388  if (len > 0 && ! is.read (ptmp, len))
389  error ("load: failed to load string constant");
390 
391  if (len > max_len)
392  {
393  max_len = len;
394  chm.resize (elements, max_len, 0);
395  }
396 
397  chm.insert (tmp, i, 0);
398  }
399 
400  matrix = chm;
401  }
402  else if (kw == "length")
403  {
404  int len = val;
405 
406  if (len >= 0)
407  {
408  // This is cruft for backward compatibility,
409  // but relatively harmless.
410 
411  // Use this instead of a C-style character buffer so
412  // that we can properly handle embedded NUL characters.
413  charMatrix tmp (1, len);
414  char *ptmp = tmp.fortran_vec ();
415 
416  if (len > 0 && ! is.read (ptmp, len))
417  error ("load: failed to load string constant");
418 
419  if (! is)
420  error ("load: failed to load string constant");
421 
422  matrix = tmp;
423  }
424  }
425  else
426  panic_impossible ();
427 
428  return true;
429 }
430 
431 bool
433  bool& /* save_as_floats */)
434 {
435  dim_vector dv = dims ();
436  if (dv.ndims () < 1)
437  return false;
438 
439  // Use negative value for ndims to differentiate with old format!!
440  int32_t tmp = - dv.ndims ();
441  os.write (reinterpret_cast<char *> (&tmp), 4);
442  for (int i=0; i < dv.ndims (); i++)
443  {
444  tmp = dv(i);
445  os.write (reinterpret_cast<char *> (&tmp), 4);
446  }
447 
449  os.write (m.fortran_vec (), dv.numel ());
450  return true;
451 }
452 
453 bool
456 {
457  int32_t elements;
458  if (! is.read (reinterpret_cast<char *> (&elements), 4))
459  return false;
460  if (swap)
461  swap_bytes<4> (&elements);
462 
463  if (elements < 0)
464  {
465  int32_t mdims = - elements;
466  int32_t di;
467  dim_vector dv;
468  dv.resize (mdims);
469 
470  for (int i = 0; i < mdims; i++)
471  {
472  if (! is.read (reinterpret_cast<char *> (&di), 4))
473  return false;
474  if (swap)
475  swap_bytes<4> (&di);
476  dv(i) = di;
477  }
478 
479  // Convert an array with a single dimension to be a row vector.
480  // Octave should never write files like this, other software
481  // might.
482 
483  if (mdims == 1)
484  {
485  mdims = 2;
486  dv.resize (mdims);
487  dv(1) = dv(0);
488  dv(0) = 1;
489  }
490 
491  charNDArray m(dv);
492  char *tmp = m.fortran_vec ();
493  is.read (tmp, dv.numel ());
494 
495  if (! is)
496  return false;
497 
498  matrix = m;
499  }
500  else
501  {
502  charMatrix chm (elements, 0);
503  int max_len = 0;
504  for (int i = 0; i < elements; i++)
505  {
506  int32_t len;
507  if (! is.read (reinterpret_cast<char *> (&len), 4))
508  return false;
509  if (swap)
510  swap_bytes<4> (&len);
511  charMatrix btmp (1, len);
512  char *pbtmp = btmp.fortran_vec ();
513  if (! is.read (pbtmp, len))
514  return false;
515  if (len > max_len)
516  {
517  max_len = len;
518  chm.resize (elements, max_len, 0);
519  }
520  chm.insert (btmp, i, 0);
521  }
522  matrix = chm;
523  }
524  return true;
525 }
526 
527 bool
529  bool /* save_as_floats */)
530 {
531  bool retval = false;
532 
533 #if defined (HAVE_HDF5)
534 
535  dim_vector dv = dims ();
536  int empty = save_hdf5_empty (loc_id, name, dv);
537  if (empty)
538  return (empty > 0);
539 
540  int rank = dv.ndims ();
541  hid_t space_hid, data_hid;
542  space_hid = data_hid = -1;
544 
545  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
546 
547  // Octave uses column-major, while HDF5 uses row-major ordering
548  for (int i = 0; i < rank; i++)
549  hdims[i] = dv(rank-i-1);
550 
551  space_hid = H5Screate_simple (rank, hdims, 0);
552  if (space_hid < 0)
553  return false;
554 #if defined (HAVE_HDF5_18)
555  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
557 #else
558  data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_CHAR, space_hid,
560 #endif
561  if (data_hid < 0)
562  {
563  H5Sclose (space_hid);
564  return false;
565  }
566 
567  OCTAVE_LOCAL_BUFFER (char, s, dv.numel ());
568 
569  for (int i = 0; i < dv.numel (); ++i)
570  s[i] = m(i);
571 
572  retval = H5Dwrite (data_hid, H5T_NATIVE_CHAR, octave_H5S_ALL, octave_H5S_ALL,
573  octave_H5P_DEFAULT, s) >= 0;
574 
575  H5Dclose (data_hid);
576  H5Sclose (space_hid);
577 
578 #else
579  octave_unused_parameter (loc_id);
580  octave_unused_parameter (name);
581 
582  warn_save ("hdf5");
583 #endif
584 
585  return retval;
586 }
587 
588 bool
590 {
591  bool retval = false;
592 
593 #if defined (HAVE_HDF5)
594 
595  dim_vector dv;
596  int empty = load_hdf5_empty (loc_id, name, dv);
597  if (empty > 0)
598  matrix.resize (dv);
599  if (empty)
600  return (empty > 0);
601 
602 #if defined (HAVE_HDF5_18)
603  hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
604 #else
605  hid_t data_hid = H5Dopen (loc_id, name);
606 #endif
607  hid_t space_hid = H5Dget_space (data_hid);
608  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
609  hid_t type_hid = H5Dget_type (data_hid);
610  hid_t type_class_hid = H5Tget_class (type_hid);
611 
612  if (type_class_hid == H5T_INTEGER)
613  {
614  if (rank < 1)
615  {
616  H5Tclose (type_hid);
617  H5Sclose (space_hid);
618  H5Dclose (data_hid);
619  return false;
620  }
621 
622  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
623  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
624 
625  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
626 
627  // Octave uses column-major, while HDF5 uses row-major ordering
628  if (rank == 1)
629  {
630  dv.resize (2);
631  dv(0) = 1;
632  dv(1) = hdims[0];
633  }
634  else
635  {
636  dv.resize (rank);
637  for (hsize_t i = 0, j = rank - 1; i < rank; i++, j--)
638  dv(j) = hdims[i];
639  }
640 
641  charNDArray m (dv);
642  char *str = m.fortran_vec ();
643  if (H5Dread (data_hid, H5T_NATIVE_CHAR, octave_H5S_ALL, octave_H5S_ALL,
644  octave_H5P_DEFAULT, str) >= 0)
645  {
646  retval = true;
647  matrix = m;
648  }
649 
650  H5Tclose (type_hid);
651  H5Sclose (space_hid);
652  H5Dclose (data_hid);
653  return true;
654  }
655  else
656  {
657  // This is cruft for backward compatibility and easy data
658  // importation
659  if (rank == 0) //FIXME: Does rank==0 even exist for strings in HDF5?
660  {
661  // a single string:
662  int slen = H5Tget_size (type_hid);
663  if (slen < 0)
664  {
665  H5Tclose (type_hid);
666  H5Sclose (space_hid);
667  H5Dclose (data_hid);
668  return false;
669  }
670  else
671  {
672  OCTAVE_LOCAL_BUFFER (char, s, slen);
673  // create datatype for (null-terminated) string
674  // to read into:
675  hid_t st_id = H5Tcopy (H5T_C_S1);
676  H5Tset_size (st_id, slen+1);
677  if (H5Dread (data_hid, st_id, octave_H5S_ALL,
679  {
680  H5Tclose (st_id);
681  H5Tclose (type_hid);
682  H5Sclose (space_hid);
683  H5Dclose (data_hid);
684  return false;
685  }
686 
687  matrix = charMatrix (s);
688 
689  H5Tclose (st_id);
690  H5Tclose (type_hid);
691  H5Sclose (space_hid);
692  H5Dclose (data_hid);
693  return true;
694  }
695  }
696  else if (rank == 1)
697  {
698  // string vector
699  hsize_t elements, maxdim;
700  H5Sget_simple_extent_dims (space_hid, &elements, &maxdim);
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  // hdf5 string arrays store strings of all the
712  // same physical length (I think), which is
713  // slightly wasteful, but oh well.
714 
715  OCTAVE_LOCAL_BUFFER (char, s, elements * (slen+1));
716 
717  // create datatype for (null-terminated) string
718  // to read into:
719  hid_t st_id = H5Tcopy (H5T_C_S1);
720  H5Tset_size (st_id, slen+1);
721 
722  if (H5Dread (data_hid, st_id, octave_H5S_ALL,
724  {
725  H5Tclose (st_id);
726  H5Tclose (type_hid);
727  H5Sclose (space_hid);
728  H5Dclose (data_hid);
729  return false;
730  }
731 
732  charMatrix chm (elements, slen, ' ');
733  for (hsize_t i = 0; i < elements; ++i)
734  {
735  chm.insert (s + i*(slen+1), i, 0);
736  }
737 
738  matrix = chm;
739 
740  H5Tclose (st_id);
741  H5Tclose (type_hid);
742  H5Sclose (space_hid);
743  H5Dclose (data_hid);
744  return true;
745  }
746  }
747  else
748  {
749  H5Tclose (type_hid);
750  H5Sclose (space_hid);
751  H5Dclose (data_hid);
752  return false;
753  }
754  }
755 
756 #else
757  octave_unused_parameter (loc_id);
758  octave_unused_parameter (name);
759 
760  warn_load ("hdf5");
761 #endif
762 
763  return retval;
764 }
bool is_empty(void) const
Definition: Array.h:575
octave_value do_index_op_internal(const octave_value_list &idx, bool resize_ok, char type= '"')
Definition: ov-str-mat.cc:88
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:267
int ndims(void) const
Definition: Array.h:590
octave_idx_type numel(void) const
Number of elements in the array.
Definition: Array.h:363
identity matrix If supplied two scalar respectively For allows like xample val
Definition: data.cc:5068
const octave_hdf5_id octave_H5S_ALL
void set_pos_if_unset(octave_idx_type nd_arg, octave_idx_type dim_arg)
int save_hdf5_empty(octave_hdf5_id loc_id, const char *name, const dim_vector d)
Definition: ls-hdf5.cc:897
octave_idx_type length(void) const
Definition: ovl.h:96
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-str-mat.cc:432
for large enough k
Definition: lu.cc:606
octave_idx_type numel(void) const
Definition: ov-base-mat.h:112
void resize(int n, int fill_value=0)
Definition: dim-vector.h:316
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition: ov-str-mat.cc:154
#define CHAR_MATRIX_CONV(TNAME, FCN)
Definition: ov-str-mat.cc:164
void error(const char *fmt,...)
Definition: error.cc:570
double double_value(bool=false) const
Definition: ov-str-mat.cc:174
NDArray array_value(bool=false) const
Definition: ov-str-mat.cc:198
Array< std::string > cellstr_value(void) const
Definition: ov-str-mat.cc:242
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:169
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-str-mat.cc:259
void skip_preceeding_newline(std::istream &is)
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Definition: ls-hdf5.cc:953
Complex complex_value(bool=false) const
Definition: ov-str-mat.cc:180
s
Definition: file-io.cc:2682
i e
Definition: data.cc:2724
std::string row_as_string(octave_idx_type, bool strip_ws=false) const
Definition: chMatrix.cc:81
std::string string_value(bool force=false) const
Definition: ov-str-mat.cc:230
void resize(octave_idx_type n, const std::string &rfv="")
Definition: str-vec.h:97
octave_idx_type rows(void) const
Definition: Array.h:401
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition: dim-vector.h:389
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
Definition: cellfun.cc:398
bool swap
Definition: load-save.cc:725
charMatrix & insert(const char *s, octave_idx_type r, octave_idx_type c)
Definition: chMatrix.cc:58
void warn_load(const char *type) const
Definition: ov-base.cc:1151
create a structure array and initialize its values The dimensions of each cell array of values must match Singleton cells and non cell values are repeated so that they fill the entire array If the cells are empty
Definition: ov-struct.cc:1688
OCTAVE_EXPORT octave_value_list any number nd example oindent prints the prompt xample Pick a any number!nd example oindent and waits for the user to enter a value The string entered by the user is evaluated as an so it may be a literal a variable name
Definition: input.cc:871
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:60
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
Definition: ls-oct-text.cc:80
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-str-mat.cc:589
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
string_vector string_vector_value(bool pad=false) const
Definition: ov-str-mat.cc:210
static int static_type_id(void)
Definition: ov-re-mat.h:250
std::string str
Definition: hash.cc:118
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1028
double tmp
Definition: data.cc:6300
octave_value retval
Definition: data.cc:6294
#define panic_impossible()
Definition: error.h:40
int64_t octave_hdf5_id
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-str-mat.cc:528
void resize(octave_idx_type nr, octave_idx_type nc, char rfv=0)
Definition: chMatrix.h:90
idx type
Definition: ov.cc:3129
Definition: dMatrix.h:37
bool load_ascii(std::istream &is)
Definition: ov-str-mat.cc:318
charMatrix char_matrix_value(bool=false) const
Definition: ov-ch-mat.h:142
virtual bool is_sq_string(void) const
Definition: ov-base.h:381
void warn_save(const char *type) const
Definition: ov-base.cc:1160
ComplexNDArray complex_array_value(bool=false) const
Definition: ov-str-mat.cc:204
friend class octave_value
Definition: ov-base.h:211
T & xelem(octave_idx_type n)
Definition: Array.h:455
type_conv_info numeric_conversion_function(void) const
Definition: ov-str-mat.cc:81
dim_vector dims(void) const
Definition: ov-base-mat.h:110
N Dimensional Array with copy-on-write semantics.
Definition: Array.h:126
void clear(void)
Definition: Array.cc:95
charNDArray char_array_value(bool=false) const
Definition: ov-ch-mat.h:145
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
int current_print_indent_level(void) const
Definition: ov-base.h:830
bool save_ascii(std::ostream &os)
Definition: ov-str-mat.cc:281
void octave_print_internal(std::ostream &, char, bool)
Definition: pr-output.cc:1722
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:301
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:200
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-str-mat.cc:454
const octave_hdf5_id octave_H5P_DEFAULT
std::complex< double > Complex
Definition: oct-cmplx.h:31
const T * fortran_vec(void) const
Definition: Array.h:584
octave_idx_type cols(void) const
Definition: Array.h:409
static const char *const keywords[]
Definition: help.cc:147
write the output to stdout if nargout is
Definition: load-save.cc:1576
ComplexMatrix complex_matrix_value(bool=false) const
Definition: ov-str-mat.cc:192
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
Definition: utils.cc:854
dim_vector dv
Definition: sub2ind.cc:263
Matrix matrix_value(bool=false) const
Definition: ov-str-mat.cc:186
Array< T > index(const idx_vector &i) const
Indexing without resizing.
Definition: Array.cc:718