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-cell.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1999-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 <iomanip>
29 #include <iostream>
30 #include <sstream>
31 #include <vector>
32 #include <queue>
33 
34 #include "Array-util.h"
35 #include "byte-swap.h"
36 #include "lo-utils.h"
37 #include "quit.h"
38 #include "oct-locbuf.h"
39 
40 #include "defun.h"
41 #include "error.h"
42 #include "mxarray.h"
43 #include "ov-cell.h"
44 #include "ovl.h"
45 #include "oct-hdf5.h"
46 #include "unwind-prot.h"
47 #include "utils.h"
48 #include "ov-base-mat.h"
49 #include "ov-base-mat.cc"
50 #include "ov-re-mat.h"
51 #include "ov-scalar.h"
52 #include "pr-output.h"
53 #include "ov-scalar.h"
54 #include "errwarn.h"
55 
56 #include "ls-oct-text.h"
57 #include "ls-oct-binary.h"
58 #include "ls-hdf5.h"
59 #include "ls-utils.h"
60 
61 // Cell is able to handle octave_value indexing by itself, so just forward
62 // everything.
63 
64 template <>
67  bool resize_ok)
68 {
69  return matrix.index (idx, resize_ok);
70 }
71 
72 template <>
73 void
75 {
76  matrix.assign (idx, rhs);
77 }
78 
79 template <>
80 void
82  octave_value rhs)
83 {
84  // FIXME: Really?
85  if (rhs.is_cell ())
86  matrix.assign (idx, rhs.cell_value ());
87  else
88  matrix.assign (idx, Cell (rhs));
89 }
90 
91 template <>
92 void
94 {
95  matrix.delete_elements (idx);
96 }
97 
98 // FIXME: this list of specializations is becoming so long that we should
99 // really ask whether octave_cell should inherit from octave_base_matrix at all.
100 
101 template <>
104 {
105  if (n < matrix.numel ())
106  return Cell (matrix(n));
107  else
108  return octave_value ();
109 }
110 
111 template <>
112 bool
114  const octave_value& x)
115 {
116  const octave_cell *xrep =
117  dynamic_cast<const octave_cell *> (&x.get_rep ());
118 
119  bool retval = xrep && xrep->matrix.numel () == 1 && n < matrix.numel ();
120  if (retval)
121  matrix(n) = xrep->matrix(0);
122 
123  return retval;
124 }
125 
126 template class octave_base_matrix<Cell>;
127 
129 
132  const std::list<octave_value_list>& idx,
133  int nargout,
134  const std::list<octave_lvalue> *lvalue_list)
135 {
137 
138  switch (type[0])
139  {
140  case '(':
141  retval(0) = do_index_op (idx.front ());
142  break;
143 
144  case '{':
145  {
146  octave_value tmp = do_index_op (idx.front ());
147 
148  Cell tcell = tmp.cell_value ();
149 
150  if (tcell.numel () == 1)
151  retval(0) = tcell(0,0);
152  else
153  retval = octave_value (octave_value_list (tcell), true);
154  }
155  break;
156 
157  case '.':
158  {
159  std::string nm = type_name ();
160  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
161  }
162  break;
163 
164  default:
165  panic_impossible ();
166  }
167 
168  // FIXME: perhaps there should be an
169  // octave_value_list::next_subsref member function? See also
170  // octave_user_function::subsref.
171 
172  if (idx.size () > 1)
173  retval = (lvalue_list
174  ? retval(0).next_subsref (nargout, type, idx, lvalue_list)
175  : retval(0).next_subsref (nargout, type, idx));
176 
177  return retval;
178 }
179 
182  const std::list<octave_value_list>& idx,
183  bool auto_add)
184 {
186 
187  switch (type[0])
188  {
189  case '(':
190  retval = do_index_op (idx.front (), auto_add);
191  break;
192 
193  case '{':
194  {
195  octave_value tmp = do_index_op (idx.front (), auto_add);
196 
197  const Cell tcell = tmp.cell_value ();
198 
199  if (tcell.numel () == 1)
200  retval = tcell(0,0);
201  else
202  retval = octave_value (octave_value_list (tcell), true);
203  }
204  break;
205 
206  case '.':
207  {
208  std::string nm = type_name ();
209  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
210  }
211  break;
212 
213  default:
214  panic_impossible ();
215  }
216 
217  // FIXME: perhaps there should be an
218  // octave_value_list::next_subsref member function? See also
219  // octave_user_function::subsref.
220 
221  if (idx.size () > 1)
222  retval = retval.next_subsref (auto_add, type, idx);
223 
224  return retval;
225 }
226 
229  const std::list<octave_value_list>& idx,
230  const octave_value& rhs)
231 {
233 
234  int n = type.length ();
235 
236  octave_value t_rhs = rhs;
237 
239 
240  if (idx.front ().empty ())
241  error ("missing index in indexed assignment");
242 
243  if (n > 1)
244  {
245  switch (type[0])
246  {
247  case '(':
248  {
249  if (is_empty () && type[1] == '.')
250  {
251  // Allow conversion of empty cell array to some other
252  // type in cases like
253  //
254  // x = {}; x(i).f = rhs
255 
257 
258  return tmp.subsasgn (type, idx, rhs);
259  }
260  else
261  {
262  octave_value tmp = do_index_op (idx.front (), true);
263 
264  if (! tmp.is_defined ())
265  tmp = octave_value::empty_conv (type.substr (1), rhs);
266 
267  std::list<octave_value_list> next_idx (idx);
268 
269  next_idx.erase (next_idx.begin ());
270 
271  tmp.make_unique ();
272 
273  t_rhs = tmp.subsasgn (type.substr (1), next_idx, rhs);
274  }
275  }
276  break;
277 
278  case '{':
279  {
280  matrix.make_unique ();
281  Cell tmpc = matrix.index (idx.front (), true);
282 
283  std::list<octave_value_list> next_idx (idx);
284 
285  next_idx.erase (next_idx.begin ());
286 
287  std::string next_type = type.substr (1);
288 
289  if (tmpc.numel () != 1)
291 
292  octave_value tmp = tmpc(0);
293  tmpc = Cell ();
294 
295  if (! tmp.is_defined () || tmp.is_zero_by_zero ())
296  {
297  tmp = octave_value::empty_conv (type.substr (1), rhs);
298  tmp.make_unique (); // probably a no-op.
299  }
300  else
301  // optimization: ignore copy still stored inside array.
302  tmp.make_unique (1);
303 
304  t_rhs = tmp.subsasgn (next_type, next_idx, rhs);
305  }
306  break;
307 
308  case '.':
309  {
310  if (! is_empty ())
311  {
312  std::string nm = type_name ();
313  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
314  }
315 
316  // Do nothing; the next branch will handle it.
317  }
318  break;
319 
320  default:
321  panic_impossible ();
322  }
323  }
324 
325  switch (type[0])
326  {
327  case '(':
328  {
329  octave_value_list i = idx.front ();
330 
331  if (t_rhs.is_cell ())
333  else if (t_rhs.is_null_value ())
335  else
337 
338  count++;
339  retval = octave_value (this);
340  }
341  break;
342 
343  case '{':
344  {
345  octave_value_list idxf = idx.front ();
346 
347  if (t_rhs.is_cs_list ())
348  {
349  Cell tmp_cell = Cell (t_rhs.list_value ());
350 
351  // Inquire the proper shape of the RHS.
352 
353  dim_vector didx = dims ().redim (idxf.length ());
354  for (octave_idx_type k = 0; k < idxf.length (); k++)
355  if (! idxf(k).is_magic_colon ()) didx(k) = idxf(k).numel ();
356 
357  if (didx.numel () == tmp_cell.numel ())
358  tmp_cell = tmp_cell.reshape (didx);
359 
360  octave_base_matrix<Cell>::assign (idxf, tmp_cell);
361  }
362  else if (idxf.all_scalars ()
363  || do_index_op (idxf, true).numel () == 1)
364  // Regularize a null matrix if stored into a cell.
366  Cell (t_rhs.storable_value ()));
367  else
369 
370  count++;
371  retval = octave_value (this);
372  }
373  break;
374 
375  case '.':
376  {
377  if (! is_empty ())
378  {
379  std::string nm = type_name ();
380  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
381  }
382 
383  // Allow conversion of empty cell array to some other
384  // type in cases like
385  //
386  // x = {}; x.f = rhs
387 
389 
390  return tmp.subsasgn (type, idx, rhs);
391  }
392  break;
393 
394  default:
395  panic_impossible ();
396  }
397 
398  return retval;
399 }
400 
401 bool
403 {
404  bool retval;
405  if (cellstr_cache.get ())
406  retval = true;
407  else
408  {
409  retval = matrix.is_cellstr ();
410  // Allocate empty cache to mark that this is indeed a cellstr.
411  if (retval)
412  cellstr_cache.reset (new Array<std::string> ());
413  }
414 
415  return retval;
416 }
417 
418 void
420 {
423 }
424 
425 void
427 {
430 }
431 
432 void
434 {
437 }
438 
439 size_t
441 {
442  size_t retval = 0;
443 
444  for (octave_idx_type i = 0; i < numel (); i++)
445  retval += matrix(i).byte_size ();
446 
447  return retval;
448 }
449 
452 {
454 
455  if (! is_cellstr ())
456  error ("sort: only cell arrays of character strings may be sorted");
457 
459 
460  tmp = tmp.sort (dim, mode);
461 
462  // We already have the cache.
463  retval = new octave_cell (tmp);
464 
465  return retval;
466 }
467 
470  sortmode mode) const
471 {
473 
474  if (! is_cellstr ())
475  error ("sort: only cell arrays of character strings may be sorted");
476 
478 
479  tmp = tmp.sort (sidx, dim, mode);
480 
481  // We already have the cache.
482  retval = new octave_cell (tmp);
483 
484  return retval;
485 }
486 
487 sortmode
489 {
491 
492  if (! is_cellstr ())
493  error ("issorted: A is not a cell array of strings");
494 
496 
497  retval = tmp.is_sorted (mode);
498 
499  return retval;
500 }
501 
504 {
506 
507  if (! is_cellstr ())
508  error ("sortrows: only cell arrays of character strings may be sorted");
509 
511 
512  retval = tmp.sort_rows_idx (mode);
513 
514  return retval;
515 }
516 
517 sortmode
519 {
521 
522  if (! is_cellstr ())
523  error ("issorted: A is not a cell array of strings");
524 
526 
527  retval = tmp.is_sorted_rows (mode);
528 
529  return retval;
530 }
531 
532 bool
534 {
535  error ("invalid conversion from cell array to logical value");
536 }
537 
540 {
541  return octave_value_list (matrix);
542 }
543 
546 {
548 
549  octave_idx_type nel = numel ();
550 
551  int n_elts = 0;
552 
553  octave_idx_type max_len = 0;
554 
555  std::queue<string_vector> strvec_queue;
556 
557  for (octave_idx_type i = 0; i < nel; i++)
558  {
559  string_vector s = matrix(i).string_vector_value ();
560 
561  octave_idx_type s_len = s.numel ();
562 
563  n_elts += s_len ? s_len : 1;
564 
565  octave_idx_type s_max_len = s.max_length ();
566 
567  if (s_max_len > max_len)
568  max_len = s_max_len;
569 
570  strvec_queue.push (s);
571  }
572 
573  retval = string_vector (n_elts);
574 
575  octave_idx_type k = 0;
576 
577  for (octave_idx_type i = 0; i < nel; i++)
578  {
579  const string_vector s = strvec_queue.front ();
580  strvec_queue.pop ();
581 
582  octave_idx_type s_len = s.numel ();
583 
584  if (s_len)
585  {
586  for (octave_idx_type j = 0; j < s_len; j++)
587  {
588  std::string t = s[j];
589  int t_len = t.length ();
590 
591  if (pad && max_len > t_len)
592  t += std::string (max_len - t_len, ' ');
593 
594  retval[k++] = t;
595  }
596  }
597  else if (pad)
598  retval[k++] = std::string (max_len, ' ');
599  else
600  retval[k++] = "";
601  }
602 
603  return retval;
604 }
605 
608 {
610 
611  if (! is_cellstr ())
612  error ("invalid conversion from cell array to array of strings");
613 
614  if (cellstr_cache->is_empty ())
616 
617  return *cellstr_cache;
618 
619  return retval;
620 }
621 
622 bool
624 {
625  return true;
626 }
627 
628 void
629 octave_cell::print (std::ostream& os, bool)
630 {
631  print_raw (os);
632 }
633 
634 void
635 octave_cell::print_raw (std::ostream& os, bool) const
636 {
637  int nd = matrix.ndims ();
638 
639  if (nd == 2)
640  {
641  octave_idx_type nr = rows ();
642  octave_idx_type nc = columns ();
643 
644  if (nr > 0 && nc > 0)
645  {
646  newline (os);
647  indent (os);
648  os << "{";
649  newline (os);
650 
652 
653  for (octave_idx_type j = 0; j < nc; j++)
654  {
655  for (octave_idx_type i = 0; i < nr; i++)
656  {
657  octave_quit ();
658 
659  std::ostringstream buf;
660  buf << "[" << i+1 << "," << j+1 << "]";
661 
662  octave_value val = matrix(i,j);
663 
664  val.print_with_name (os, buf.str ());
665  }
666  }
667 
669 
670  indent (os);
671  os << "}";
672  newline (os);
673  }
674  else
675  {
676  indent (os);
677  os << "{}";
679  os << "(" << nr << "x" << nc << ")";
680  newline (os);
681  }
682  }
683  else
684  {
685  indent (os);
686  dim_vector dv = matrix.dims ();
687  os << "{" << dv.str () << " Cell Array}";
688  newline (os);
689  }
690 }
691 
692 void
693 octave_cell::short_disp (std::ostream& os) const
694 {
695  os << (matrix.is_empty () ? "{}" : "...");
696 }
697 
698 #define CELL_ELT_TAG "<cell-element>"
699 
700 bool
701 octave_cell::save_ascii (std::ostream& os)
702 {
703  dim_vector dv = dims ();
704  if (dv.ndims () > 2)
705  {
706  os << "# ndims: " << dv.ndims () << "\n";
707 
708  for (int i = 0; i < dv.ndims (); i++)
709  os << " " << dv(i);
710  os << "\n";
711 
712  Cell tmp = cell_value ();
713 
714  for (octave_idx_type i = 0; i < dv.numel (); i++)
715  {
716  octave_value o_val = tmp.elem (i);
717 
718  // Recurse to print sub-value.
719  bool b = save_text_data (os, o_val, CELL_ELT_TAG, false, 0);
720 
721  if (! b)
722  return ! os.fail ();
723  }
724  }
725  else
726  {
727  // Keep this case, rather than use generic code above for backward
728  // compatibility. Makes load_ascii much more complex!!
729  os << "# rows: " << rows () << "\n"
730  << "# columns: " << columns () << "\n";
731 
732  Cell tmp = cell_value ();
733 
734  for (octave_idx_type j = 0; j < tmp.cols (); j++)
735  {
736  for (octave_idx_type i = 0; i < tmp.rows (); i++)
737  {
738  octave_value o_val = tmp.elem (i, j);
739 
740  // Recurse to print sub-value.
741  bool b = save_text_data (os, o_val, CELL_ELT_TAG, false, 0);
742 
743  if (! b)
744  return ! os.fail ();
745  }
746 
747  os << "\n";
748  }
749  }
750 
751  return true;
752 }
753 
754 bool
756 {
758 
760 
761  keywords[0] = "ndims";
762  keywords[1] = "rows";
763 
764  std::string kw;
765  octave_idx_type val = 0;
766 
767  if (! extract_keyword (is, keywords, kw, val, true))
768  error ("load: failed to extract number of rows and columns");
769 
770  if (kw == "ndims")
771  {
772  int mdims = static_cast<int> (val);
773 
774  if (mdims < 0)
775  error ("load: failed to extract number of rows and columns");
776 
777  dim_vector dv;
778  dv.resize (mdims);
779 
780  for (int i = 0; i < mdims; i++)
781  is >> dv(i);
782 
783  Cell tmp(dv);
784 
785  for (octave_idx_type i = 0; i < dv.numel (); i++)
786  {
787  octave_value t2;
788  bool dummy;
789 
790  // recurse to read cell elements
791  std::string nm = read_text_data (is, "",
792  dummy, t2, i);
793 
794  if (nm != CELL_ELT_TAG)
795  error ("load: cell array element had unexpected name");
796 
797  if (is)
798  tmp.elem (i) = t2;
799  }
800 
801  if (! is)
802  error ("load: failed to load matrix constant");
803 
804  matrix = tmp;
805  }
806  else if (kw == "rows")
807  {
808  octave_idx_type nr = val;
809  octave_idx_type nc = 0;
810 
811  if (nr < 0 || ! extract_keyword (is, "columns", nc) || nc < 0)
812  error ("load: failed to extract number of rows and columns for cell array");
813 
814  if (nr > 0 && nc > 0)
815  {
816  Cell tmp (nr, nc);
817 
818  for (octave_idx_type j = 0; j < nc; j++)
819  {
820  for (octave_idx_type i = 0; i < nr; i++)
821  {
822  octave_value t2;
823  bool dummy;
824 
825  // recurse to read cell elements
826  std::string nm = read_text_data (is, "",
827  dummy, t2, i);
828 
829  if (nm != CELL_ELT_TAG)
830  error ("load: cell array element had unexpected name");
831 
832  if (is)
833  tmp.elem (i, j) = t2;
834  }
835  }
836 
837  if (! is)
838  error ("load: failed to load cell element");
839 
840  matrix = tmp;
841  }
842  else if (nr == 0 || nc == 0)
843  matrix = Cell (nr, nc);
844  else
845  panic_impossible ();
846  }
847  else
848  panic_impossible ();
849 
850  return true;
851 }
852 
853 bool
854 octave_cell::save_binary (std::ostream& os, bool& save_as_floats)
855 {
856  dim_vector dv = dims ();
857  if (dv.ndims () < 1)
858  return false;
859 
860  // Use negative value for ndims
861  int32_t di = - dv.ndims ();
862  os.write (reinterpret_cast<char *> (&di), 4);
863  for (int i = 0; i < dv.ndims (); i++)
864  {
865  di = dv(i);
866  os.write (reinterpret_cast<char *> (&di), 4);
867  }
868 
869  Cell tmp = cell_value ();
870 
871  for (octave_idx_type i = 0; i < dv.numel (); i++)
872  {
873  octave_value o_val = tmp.elem (i);
874 
875  // Recurse to print sub-value.
876  bool b = save_binary_data (os, o_val, CELL_ELT_TAG, "", 0,
877  save_as_floats);
878 
879  if (! b)
880  return false;
881  }
882 
883  return true;
884 }
885 
886 bool
887 octave_cell::load_binary (std::istream& is, bool swap,
889 {
891 
892  int32_t mdims;
893  if (! is.read (reinterpret_cast<char *> (&mdims), 4))
894  return false;
895  if (swap)
896  swap_bytes<4> (&mdims);
897  if (mdims >= 0)
898  return false;
899 
900  mdims = -mdims;
901  int32_t di;
902  dim_vector dv;
903  dv.resize (mdims);
904 
905  for (int i = 0; i < mdims; i++)
906  {
907  if (! is.read (reinterpret_cast<char *> (&di), 4))
908  return false;
909  if (swap)
910  swap_bytes<4> (&di);
911  dv(i) = di;
912  }
913 
914  // Convert an array with a single dimension to be a row vector.
915  // Octave should never write files like this, other software
916  // might.
917 
918  if (mdims == 1)
919  {
920  mdims = 2;
921  dv.resize (mdims);
922  dv(1) = dv(0);
923  dv(0) = 1;
924  }
925 
926  octave_idx_type nel = dv.numel ();
927  Cell tmp(dv);
928 
929  for (octave_idx_type i = 0; i < nel; i++)
930  {
931  octave_value t2;
932  bool dummy;
933  std::string doc;
934 
935  // recurse to read cell elements
936  std::string nm = read_binary_data (is, swap, fmt, "",
937  dummy, t2, doc);
938 
939  if (nm != CELL_ELT_TAG)
940  error ("load: cell array element had unexpected name");
941 
942  if (is)
943  tmp.elem (i) = t2;
944  }
945 
946  if (! is)
947  error ("load: failed to load matrix constant");
948 
949  matrix = tmp;
950 
951  return true;
952 }
953 
954 void *
956 {
958  return matrix.mex_get_data ();
959 }
960 
961 bool
963  bool save_as_floats)
964 {
965 #if defined (HAVE_HDF5)
966 
967  dim_vector dv = dims ();
968  int empty = save_hdf5_empty (loc_id, name, dv);
969  if (empty)
970  return (empty > 0);
971 
972  hsize_t rank = dv.ndims ();
973  hid_t space_hid, data_hid, size_hid;
974  space_hid = data_hid = size_hid = -1;
975 
976 #if defined (HAVE_HDF5_18)
977  data_hid = H5Gcreate (loc_id, name, octave_H5P_DEFAULT, octave_H5P_DEFAULT,
979 #else
980  data_hid = H5Gcreate (loc_id, name, 0);
981 #endif
982 
983  if (data_hid < 0)
984  return false;
985 
986  // Have to save cell array shape, since can't have a
987  // dataset of groups....
988 
989  space_hid = H5Screate_simple (1, &rank, 0);
990 
991  if (space_hid < 0)
992  {
993  H5Gclose (data_hid);
994  return false;
995  }
996 
997  OCTAVE_LOCAL_BUFFER (octave_idx_type, hdims, rank);
998 
999  // Octave uses column-major, while HDF5 uses row-major ordering
1000  for (hsize_t i = 0; i < rank; i++)
1001  hdims[i] = dv(rank-i-1);
1002 
1003 #if defined (HAVE_HDF5_18)
1004  size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid,
1006 #else
1007  size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid,
1009 #endif
1010  if (size_hid < 0)
1011  {
1012  H5Sclose (space_hid);
1013  H5Gclose (data_hid);
1014  return false;
1015  }
1016 
1017  if (H5Dwrite (size_hid, H5T_NATIVE_IDX, octave_H5S_ALL, octave_H5S_ALL,
1018  octave_H5P_DEFAULT, hdims) < 0)
1019  {
1020  H5Dclose (size_hid);
1021  H5Sclose (space_hid);
1022  H5Gclose (data_hid);
1023  return false;
1024  }
1025 
1026  H5Dclose (size_hid);
1027  H5Sclose (space_hid);
1028 
1029  // Recursively add each element of the cell to this group.
1030 
1031  Cell tmp = cell_value ();
1032 
1033  octave_idx_type nel = dv.numel ();
1034 
1035  for (octave_idx_type i = 0; i < nel; i++)
1036  {
1037  std::ostringstream buf;
1038  int digits = static_cast<int> (std::floor (::log10 (static_cast<double>
1039  (nel)) + 1.0));
1040  buf << "_" << std::setw (digits) << std::setfill ('0') << i;
1041  std::string s = buf.str ();
1042 
1043  if (! add_hdf5_data (data_hid, tmp.elem (i), s.c_str (), "", false,
1044  save_as_floats))
1045  {
1046  H5Gclose (data_hid);
1047  return false;
1048  }
1049  }
1050 
1051  H5Gclose (data_hid);
1052 
1053  return true;
1054 
1055 #else
1056  octave_unused_parameter (loc_id);
1057  octave_unused_parameter (name);
1058  octave_unused_parameter (save_as_floats);
1059 
1060  warn_save ("hdf5");
1061 
1062  return false;
1063 #endif
1064 }
1065 
1066 bool
1068 {
1069  bool retval = false;
1070 
1071 #if defined (HAVE_HDF5)
1072 
1074 
1075  dim_vector dv;
1076  int empty = load_hdf5_empty (loc_id, name, dv);
1077  if (empty > 0)
1078  matrix.resize (dv);
1079  if (empty)
1080  return (empty > 0);
1081 
1082 #if defined (HAVE_HDF5_18)
1083  hid_t group_id = H5Gopen (loc_id, name, octave_H5P_DEFAULT);
1084 #else
1085  hid_t group_id = H5Gopen (loc_id, name);
1086 #endif
1087 
1088  if (group_id < 0)
1089  return false;
1090 
1091 #if defined (HAVE_HDF5_18)
1092  hid_t data_hid = H5Dopen (group_id, "dims", octave_H5P_DEFAULT);
1093 #else
1094  hid_t data_hid = H5Dopen (group_id, "dims");
1095 #endif
1096  hid_t space_hid = H5Dget_space (data_hid);
1097  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
1098  if (rank != 1)
1099  {
1100  H5Dclose (data_hid);
1101  H5Gclose (group_id);
1102  return false;
1103  }
1104 
1105  OCTAVE_LOCAL_BUFFER (hsize_t, hdims, rank);
1106  OCTAVE_LOCAL_BUFFER (hsize_t, maxdims, rank);
1107 
1108  H5Sget_simple_extent_dims (space_hid, hdims, maxdims);
1109 
1110  // Octave uses column-major, while HDF5 uses row-major ordering.
1111 
1112  dv.resize (hdims[0]);
1113 
1115 
1116  if (H5Dread (data_hid, H5T_NATIVE_IDX, octave_H5S_ALL, octave_H5S_ALL,
1117  octave_H5P_DEFAULT, tmp) < 0)
1118  {
1119  H5Dclose (data_hid);
1120  H5Gclose (group_id);
1121  return false;
1122  }
1123 
1124  H5Dclose (data_hid);
1125  H5Gclose (group_id);
1126 
1127  for (hsize_t i = 0, j = hdims[0] - 1; i < hdims[0]; i++, j--)
1128  dv(j) = tmp[i];
1129 
1130  hdf5_callback_data dsub;
1131 
1132  herr_t retval2 = -1;
1133 
1134  Cell m (dv);
1135 
1136  int current_item = 0;
1137 
1138  hsize_t num_obj = 0;
1139 #if defined (HAVE_HDF5_18)
1140  group_id = H5Gopen (loc_id, name, octave_H5P_DEFAULT);
1141 #else
1142  group_id = H5Gopen (loc_id, name);
1143 #endif
1144  H5Gget_num_objs (group_id, &num_obj);
1145  H5Gclose (group_id);
1146 
1147  for (octave_idx_type i = 0; i < dv.numel (); i++)
1148  {
1149 
1150  if (current_item >= static_cast<int> (num_obj))
1151  retval2 = -1;
1152  else
1153  retval2 = hdf5_h5g_iterate (loc_id, name, &current_item,&dsub);
1154 
1155  if (retval2 <= 0)
1156  break;
1157 
1158  octave_value ov = dsub.tc;
1159  m.elem (i) = ov;
1160 
1161  }
1162 
1163  if (retval2 >= 0)
1164  {
1165  matrix = m;
1166  retval = true;
1167  }
1168 
1169 #else
1170  octave_unused_parameter (loc_id);
1171  octave_unused_parameter (name);
1172 
1173  warn_load ("hdf5");
1174 #endif
1175 
1176  return retval;
1177 }
1178 
1179 DEFUN (iscell, args, ,
1180  doc: /* -*- texinfo -*-
1181 @deftypefn {} {} iscell (@var{x})
1182 Return true if @var{x} is a cell array object.
1183 @seealso{ismatrix, isstruct, iscellstr, isa}
1184 @end deftypefn */)
1185 {
1186  if (args.length () != 1)
1187  print_usage ();
1188 
1189  return ovl (args(0).is_cell ());
1190 }
1191 
1192 DEFUN (cell, args, ,
1193  doc: /* -*- texinfo -*-
1194 @deftypefn {} {} cell (@var{n})
1195 @deftypefnx {} {} cell (@var{m}, @var{n})
1196 @deftypefnx {} {} cell (@var{m}, @var{n}, @var{k}, @dots{})
1197 @deftypefnx {} {} cell ([@var{m} @var{n} @dots{}])
1198 Create a new cell array object.
1199 
1200 If invoked with a single scalar integer argument, return a square
1201 @nospell{NxN} cell array. If invoked with two or more scalar integer
1202 arguments, or a vector of integer values, return an array with the given
1203 dimensions.
1204 @seealso{cellstr, mat2cell, num2cell, struct2cell}
1205 @end deftypefn */)
1206 {
1207  int nargin = args.length ();
1208 
1209  dim_vector dims;
1210 
1211  switch (nargin)
1212  {
1213  case 0:
1214  dims = dim_vector (0, 0);
1215  break;
1216 
1217  case 1:
1218  get_dimensions (args(0), "cell", dims);
1219  break;
1220 
1221  default:
1222  {
1223  dims.resize (nargin);
1224 
1225  for (int i = 0; i < nargin; i++)
1226  dims(i) = (args(i).is_empty ()
1227  ? 0 : args(i).xnint_value ("cell: dimension must be a scalar integer"));
1228  }
1229  break;
1230  }
1231 
1232  dims.chop_trailing_singletons ();
1233 
1234  check_dimensions (dims, "cell");
1235 
1236  return ovl (Cell (dims));
1237 }
1238 
1239 DEFUN (iscellstr, args, ,
1240  doc: /* -*- texinfo -*-
1241 @deftypefn {} {} iscellstr (@var{cell})
1242 Return true if every element of the cell array @var{cell} is a character
1243 string.
1244 @seealso{ischar}
1245 @end deftypefn */)
1246 {
1247  if (args.length () != 1)
1248  print_usage ();
1249 
1250  return ovl (args(0).is_cellstr ());
1251 }
1252 
1253 // Note that since Fcellstr calls Fiscellstr, we need to have
1254 // Fiscellstr defined first (to provide a declaration) and also we
1255 // should keep it in the same file (so we don't have to provide a
1256 // declaration) and so we don't have to use feval to call it.
1257 
1258 DEFUN (cellstr, args, ,
1259  doc: /* -*- texinfo -*-
1260 @deftypefn {} {@var{cstr} =} cellstr (@var{strmat})
1261 Create a new cell array object from the elements of the string array
1262 @var{strmat}.
1263 
1264 Each row of @var{strmat} becomes an element of @var{cstr}. Any trailing
1265 spaces in a row are deleted before conversion.
1266 
1267 To convert back from a cellstr to a character array use @code{char}.
1268 @seealso{cell, char}
1269 @end deftypefn */)
1270 {
1271  if (args.length () != 1)
1272  print_usage ();
1273 
1275 
1276  if (tmp(0).is_true ())
1277  return ovl (args(0));
1278  else
1279  {
1280  string_vector s = args(0).xstring_vector_value ("cellstr: argument STRING must be a 2-D character array");
1281 
1282  return ovl (s.is_empty () ? Cell (octave_value (""))
1283  : Cell (s, true));
1284  }
1285 }
1286 
1287 DEFUN (struct2cell, args, ,
1288  doc: /* -*- texinfo -*-
1289 @deftypefn {} {@var{c} =} struct2cell (@var{s})
1290 Create a new cell array from the objects stored in the struct object.
1291 
1292 If @var{f} is the number of fields in the structure, the resulting cell
1293 array will have a dimension vector corresponding to
1294 @code{[@var{f} size(@var{s})]}. For example:
1295 
1296 @example
1297 @group
1298 s = struct ("name", @{"Peter", "Hannah", "Robert"@},
1299  "age", @{23, 16, 3@});
1300 c = struct2cell (s)
1301  @result{} c = @{2x1x3 Cell Array@}
1302 c(1,1,:)(:)
1303  @result{}
1304  @{
1305  [1,1] = Peter
1306  [2,1] = Hannah
1307  [3,1] = Robert
1308  @}
1309 c(2,1,:)(:)
1310  @result{}
1311  @{
1312  [1,1] = 23
1313  [2,1] = 16
1314  [3,1] = 3
1315  @}
1316 @end group
1317 @end example
1318 
1319 @seealso{cell2struct, fieldnames}
1320 @end deftypefn */)
1321 {
1322  if (args.length () != 1)
1323  print_usage ();
1324 
1325  const octave_map m = args(0).xmap_value ("struct2cell: argument S must be a structure");
1326 
1327  const dim_vector m_dv = m.dims ();
1328 
1329  octave_idx_type num_fields = m.nfields ();
1330 
1331  // The resulting dim_vector should have dimensions:
1332  // [numel(fields) size(struct)]
1333  // except if the struct is a column vector.
1334 
1335  dim_vector result_dv;
1336  if (m_dv(m_dv.ndims () - 1) == 1)
1337  result_dv.resize (m_dv.ndims ());
1338  else
1339  result_dv.resize (m_dv.ndims () + 1); // Add 1 for the fields.
1340 
1341  result_dv(0) = num_fields;
1342 
1343  for (int i = 1; i < result_dv.ndims (); i++)
1344  result_dv(i) = m_dv(i-1);
1345 
1346  NoAlias<Cell> c (result_dv);
1347 
1348  octave_idx_type n_elts = m.numel ();
1349 
1350  // Fill c in one sweep. Note that thanks to octave_map structure,
1351  // we don't need a key lookup at all.
1352  for (octave_idx_type j = 0; j < n_elts; j++)
1353  for (octave_idx_type i = 0; i < num_fields; i++)
1354  c(i,j) = m.contents(i)(j);
1355 
1356  return ovl (c);
1357 }
1358 
1359 /*
1360 %!test
1361 %! keys = cellstr (char (floor (rand (11,10)*24+65)))';
1362 %! vals = cellfun (@(x) mat2cell (rand (19,1), ones (19,1), 1), ...
1363 %! mat2cell ([1:11]', ones (11,1), 1), "uniformoutput", false)';
1364 %! s = struct ([keys; vals]{:});
1365 %! t = cell2struct ([vals{:}], keys, 2);
1366 %! assert (s, t);
1367 %! assert (struct2cell (s), [vals{:}]');
1368 %! assert (fieldnames (s), keys');
1369 */
1370 
1371 mxArray *
1372 octave_cell::as_mxArray (void) const
1373 {
1374  mxArray *retval = new mxArray (dims ());
1375 
1376  mxArray **elts = static_cast<mxArray **> (retval->get_data ());
1377 
1378  mwSize nel = numel ();
1379 
1380  const octave_value *p = matrix.data ();
1381 
1382  for (mwIndex i = 0; i < nel; i++)
1383  elts[i] = new mxArray (p[i]);
1384 
1385  return retval;
1386 }
1387 
1389 octave_cell::map (unary_mapper_t umap) const
1390 {
1391  switch (umap)
1392  {
1393 #define FORWARD_MAPPER(UMAP) \
1394  case umap_ ## UMAP: \
1395  return matrix.UMAP ()
1396 
1397  FORWARD_MAPPER (xisalnum);
1398  FORWARD_MAPPER (xisalpha);
1400  FORWARD_MAPPER (xiscntrl);
1401  FORWARD_MAPPER (xisdigit);
1402  FORWARD_MAPPER (xisgraph);
1403  FORWARD_MAPPER (xislower);
1404  FORWARD_MAPPER (xisprint);
1405  FORWARD_MAPPER (xispunct);
1406  FORWARD_MAPPER (xisspace);
1407  FORWARD_MAPPER (xisupper);
1408  FORWARD_MAPPER (xisxdigit);
1410  FORWARD_MAPPER (xtolower);
1411  FORWARD_MAPPER (xtoupper);
1412 
1413  default:
1414  return octave_base_value::map (umap);
1415  }
1416 }
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Definition: ov-cell.cc:503
octave_value map(unary_mapper_t umap) const
const Cell & contents(const_iterator p) const
Definition: oct-map.h:313
bool is_true(const std::string &s)
Definition: mkoctfile.cc:398
bool is_empty(void) const
Definition: Array.h:575
OCTAVE_EXPORT octave_value_list isa nd deftypefn *return ovl(args(0).is_cell())
Definition: Cell.h:37
std::string str(char sep= 'x') const
Definition: dim-vector.cc:73
bool save_ascii(std::ostream &os)
Definition: ov-cell.cc:701
octave_refcount< octave_idx_type > count
Definition: ov-base.h:843
string_vector string_vector_value(bool pad=false) const
Definition: ov-cell.cc:545
void err_nonbraced_cs_list_assignment(void)
Definition: errwarn.cc:80
bool is_true(void) const
Definition: ov-cell.cc:533
bool fast_elem_insert(octave_idx_type n, const octave_value &x)
Definition: ov-base-mat.cc:521
void increment_indent_level(void) const
Definition: ov-base.h:824
octave_idx_type columns(void) const
Definition: ov-base.h:319
Cell reshape(const dim_vector &new_dims) const
Definition: Cell.h:92
octave_idx_type max_length(void) const
Definition: str-vec.h:81
Array< octave_idx_type > sort_rows_idx(sortmode mode=ASCENDING) const
Sort by rows returns only indices.
Definition: Array.cc:2087
void assign(const octave_value_list &idx, const MT &rhs)
Definition: ov-base-mat.cc:214
int ndims(void) const
Definition: Array.h:590
OCTINTERP_API void print_usage(void)
Definition: defun.cc:52
octave_value tc
Definition: ls-hdf5.h:107
sortmode
Definition: oct-sort.h:105
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
static int xtoascii(int c)
Definition: ov-ch-mat.cc:250
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
void delete_elements(const octave_value_list &idx)
Definition: ov-cell.cc:433
Return the CPU time used by your Octave session The first output is the total time spent executing your process and is equal to the sum of second and third which are the number of CPU seconds spent executing in user mode and the number of CPU seconds spent executing in system mode
Definition: data.cc:6386
void delete_elements(const octave_value_list &idx)
Definition: ov-base-mat.cc:378
bool is_defined(void) const
Definition: ov.h:536
for large enough k
Definition: lu.cc:606
void * mex_get_data(void) const
Give a pointer to the data in mex format.
Definition: Array.h:706
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
#define DEFUN(name, args_name, nargout_name, doc)
Definition: defun.h:46
octave_value sort(octave_idx_type dim=0, sortmode mode=ASCENDING) const
Definition: ov-cell.cc:451
void error(const char *fmt,...)
Definition: error.cc:570
Cell cell_value(void) const
Definition: ov-cell.h:138
void indent(std::ostream &os) const
Definition: ov-base.cc:1362
void * get_data(void) const
Definition: mxarray.h:449
#define FORWARD_MAPPER(UMAP)
void make_unique(void)
Definition: ov.h:327
mxArray * as_mxArray(void) const
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:169
bool is_cell(void) const
Definition: ov.h:545
octave_value_list list_value(void) const
Definition: ov-cell.cc:539
int load_hdf5_empty(octave_hdf5_id loc_id, const char *name, dim_vector &d)
Definition: ls-hdf5.cc:953
T & elem(octave_idx_type n)
Definition: Array.h:482
octave_idx_type numel(void) const
Definition: oct-map.h:371
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
Definition: ov-usr-fcn.cc:935
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-cell.cc:635
s
Definition: file-io.cc:2682
void newline(std::ostream &os) const
Definition: ov-base.cc:1381
bool is_empty(void) const
Definition: ov-base.h:355
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
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov.cc:1540
Cell cell_value(void) const
Definition: ov.cc:1687
bool swap
Definition: load-save.cc:725
JNIEnv void * args
Definition: ov-java.cc:67
void err_indexed_cs_list(void)
Definition: errwarn.cc:62
const dim_vector & dims(void) const
Return a const-reference so that dims ()(i) works efficiently.
Definition: Array.h:439
void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov-cell.cc:629
size_t byte_size(void) const
Definition: ov-cell.cc:440
void warn_load(const char *type) const
Definition: ov-base.cc:1151
size_t byte_size(void) const
Definition: Array.h:435
Array< std::string > cellstr_value(void) const
Definition: Cell.cc:142
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
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:941
void swap_bytes< 4 >(void *ptr)
Definition: byte-swap.h:60
bool is_null_value(void) const
Definition: ov.h:608
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function xample nargout(@histc)
Definition: ov-usr-fcn.cc:935
bool save_text_data(std::ostream &os, const octave_value &val_arg, const std::string &name, bool mark_as_global, int precision)
Definition: ls-oct-text.cc:300
Array< T > sort(int dim=0, sortmode mode=ASCENDING) const
Definition: Array.cc:1775
std::string extract_keyword(std::istream &is, const char *keyword, const bool next_only)
Definition: ls-oct-text.cc:80
octave_idx_type nfields(void) const
Definition: oct-map.h:326
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov-base-mat.cc:130
octave_idx_type numel(const octave_value_list &idx)
Definition: ov.h:411
std::string type_name(void) const
Definition: ov-cell.h:187
void make_unique(void)
Definition: Array.h:185
nd deftypefn *octave_map m
Definition: ov-struct.cc:2058
Array< std::string > cellstr_value(void) const
Definition: ov-cell.cc:607
int nargin
Definition: graphics.cc:10115
const T * data(void) const
Definition: Array.h:582
bool save_as_floats
Definition: load-save.cc:1581
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1028
std::string read_binary_data(std::istream &is, bool swap, octave::mach_info::float_format fmt, const std::string &filename, bool &global, octave_value &tc, std::string &doc)
dim_vector dims(void) const
Definition: oct-map.h:399
double tmp
Definition: data.cc:6300
void clear_cellstr_cache(void) const
Definition: ov-cell.h:182
octave_hdf5_err hdf5_h5g_iterate(octave_hdf5_id loc_id, const char *name, int *idx, void *operator_data)
Definition: ls-hdf5.cc:706
octave_value retval
Definition: data.cc:6294
#define panic_impossible()
Definition: error.h:40
int64_t octave_hdf5_id
dim_vector redim(int n) const
Definition: dim-vector.cc:275
bool is_cellstr(void) const
Definition: Cell.cc:123
octave_idx_type length(void) const
Definition: ov.cc:1623
idx type
Definition: ov.cc:3129
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
Definition: lu.cc:138
the exceeded dimensions are set to if fewer subscripts than dimensions are the exceeding dimensions are merged into the final requested dimension For consider the following dims
Definition: sub2ind.cc:255
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-cell.cc:1067
void * mex_get_data(void) const
Definition: ov-cell.cc:955
void decrement_indent_level(void) const
Definition: ov-base.h:827
void warn_save(const char *type) const
Definition: ov-base.cc:1160
void mxArray
Definition: mex.h:55
OCTAVE_EXPORT octave_value_list iscellstr
Definition: ov-cell.cc:1184
friend class octave_value
Definition: ov-base.h:211
OCTINTERP_API octave_value_list Fiscellstr(const octave_value_list &=octave_value_list(), int=0)
OCTINTERP_API void get_dimensions(const octave_value &a, const char *warn_for, dim_vector &dim)
std::unique_ptr< Array< std::string > > cellstr_cache
Definition: ov-cell.h:185
dim_vector dims(void) const
Definition: ov-base-mat.h:110
sortmode is_sorted(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
Definition: Array.cc:2052
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-cell.h:76
octave_idx_type length(void) const
Number of elements in the array.
Definition: Array.h:354
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-cell.cc:962
This is a simple wrapper template that will subclass an Array type or any later type derived from ...
Definition: Array.h:888
bool Vprint_empty_dimensions
Definition: pr-output.cc:76
bool print_as_scalar(void) const
Definition: ov-cell.cc:623
octave_cell(void)
Definition: ov-cell.h:54
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-cell.cc:854
bool save_binary_data(std::ostream &os, const octave_value &tc, const std::string &name, const std::string &doc, bool mark_as_global, bool save_as_floats)
=val(i)}if ode{val(i)}occurs in table i
Definition: lookup.cc:239
const octave_base_value & get_rep(void) const
Definition: ov.h:1270
p
Definition: lu.cc:138
bool is_cs_list(void) const
Definition: ov.h:602
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-cell.cc:887
std::string read_text_data(std::istream &is, const std::string &filename, bool &global, octave_value &tc, octave_idx_type count)
Definition: ls-oct-text.cc:236
void print_with_name(std::ostream &os, const std::string &name) const
Definition: ov.h:1225
octave_idx_type ndims(void) const
Number of dimensions.
Definition: dim-vector.h:301
#define H5T_NATIVE_IDX
Definition: oct-hdf5.h:39
b
Definition: cellfun.cc:398
Cell index(const octave_value_list &idx, bool resize_ok=false) const
Definition: Cell.cc:155
octave_value fast_elem_extract(octave_idx_type n) const
Definition: ov-base-mat.cc:511
#define OCTAVE_LOCAL_BUFFER(T, buf, size)
Definition: oct-locbuf.h:200
virtual octave_value map(unary_mapper_t) const
Definition: ov-base.cc:1175
bool is_cellstr(void) const
Definition: ov-cell.cc:402
octave_value subsasgn(const std::string &type, const std::list< octave_value_list > &idx, const octave_value &rhs)
Definition: ov-cell.cc:228
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Definition: ov-cell.cc:518
double floor(double x)
Definition: lo-mappers.cc:330
const octave_hdf5_id octave_H5P_DEFAULT
octave_value_list list_value(void) const
Definition: ov.cc:1741
void assign(const octave_value_list &idx, const Cell &rhs)
Definition: ov-cell.cc:419
void short_disp(std::ostream &os) const
Definition: ov-cell.cc:693
bool all_scalars(void) const
Definition: ovl.cc:175
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
bool load_ascii(std::istream &is)
Definition: ov-cell.cc:755
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:87
sortmode is_sorted(sortmode mode=UNSORTED) const
Definition: ov-cell.cc:488
bool add_hdf5_data(octave_hdf5_id loc_id, const octave_value &tc, const std::string &name, const std::string &doc, bool mark_as_global, bool save_as_floats)
Definition: ls-hdf5.cc:1053
octave_value storable_value(void) const
Definition: ov.cc:2166
void chop_trailing_singletons(void)
Definition: dim-vector.h:232
OCTINTERP_API void check_dimensions(dim_vector &dim, const char *warnfor)
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
sortmode is_sorted_rows(sortmode mode=UNSORTED) const
Ordering is auto-detected or can be specified.
Definition: Array.cc:2105
bool is_zero_by_zero(void) const
Definition: ov.h:696
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
Definition: ov.cc:1462
octave_idx_type rows(void) const
Definition: ov-base.h:312
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE * x
static octave_value empty_conv(const std::string &type, const octave_value &rhs=octave_value())
Definition: ov.cc:2882
static int xisascii(int c)
Definition: ov-ch-mat.cc:241
#define CELL_ELT_TAG
Definition: ov-cell.cc:698