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-range.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2015 John W. Eaton
4 
5 This file is part of Octave.
6 
7 Octave is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with Octave; see the file COPYING. If not, see
19 <http://www.gnu.org/licenses/>.
20 
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include <iostream>
28 
29 #include "lo-ieee.h"
30 #include "lo-utils.h"
31 
32 #include "defun.h"
33 #include "variables.h"
34 #include "gripes.h"
35 #include "mxarray.h"
36 #include "ops.h"
37 #include "oct-obj.h"
38 #include "oct-hdf5.h"
39 #include "ov-range.h"
40 #include "ov-re-mat.h"
41 #include "ov-scalar.h"
42 #include "pr-output.h"
43 
44 #include "byte-swap.h"
45 #include "ls-ascii-helper.h"
46 #include "ls-hdf5.h"
47 #include "ls-utils.h"
48 
49 // If TRUE, allow ranges with non-integer elements as array indices.
51 
52 
54 
55 static octave_base_value *
57 {
58  CAST_CONV_ARG (const octave_range&);
59 
60  return new octave_matrix (v.matrix_value ());
61 }
62 
65 {
68 }
69 
72 {
73  octave_base_value *retval = 0;
74 
75  switch (range.nelem ())
76  {
77  case 1:
78  retval = new octave_scalar (range.base ());
79  break;
80 
81  case 0:
82  retval = new octave_matrix (Matrix (1, 0));
83  break;
84 
85  case -2:
86  retval = new octave_matrix (range.matrix_value ());
87  break;
88 
89  default:
90  break;
91  }
92 
93  return retval;
94 }
95 
97 octave_range::subsref (const std::string& type,
98  const std::list<octave_value_list>& idx)
99 {
100  octave_value retval;
101 
102  switch (type[0])
103  {
104  case '(':
105  retval = do_index_op (idx.front ());
106  break;
107 
108  case '{':
109  case '.':
110  {
111  std::string nm = type_name ();
112  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
113  }
114  break;
115 
116  default:
117  panic_impossible ();
118  }
119 
120  return retval.next_subsref (type, idx);
121 }
122 
124 octave_range::do_index_op (const octave_value_list& idx, bool resize_ok)
125 {
126  if (idx.length () == 1 && ! resize_ok)
127  {
128  octave_value retval;
129 
130  // The range can handle a single subscript.
131  idx_vector i = idx(0).index_vector ();
132  if (! error_state)
133  {
134  if (i.is_scalar () && i(0) < range.nelem ())
135  retval = range.elem (i(0));
136  else
137  retval = range.index (i);
138  }
139 
140  return retval;
141  }
142  else
143  {
145 
146  return tmp.do_index_op (idx, resize_ok);
147  }
148 }
149 
151 octave_range::index_vector (bool require_integers) const
152 {
153  if (idx_cache)
154  return *idx_cache;
155  else
156  {
157  if (require_integers
160  return set_idx_cache (idx_vector (range));
161  else
162  {
163  warning_with_id ("Octave:noninteger-range-as-index",
164  "non-integer range used as index");
165 
166  return octave_value (matrix_value ()).round ().index_vector ();
167  }
168  }
169 }
170 
171 double
173 {
174  double retval = lo_ieee_nan_value ();
175 
176  octave_idx_type nel = range.nelem ();
177 
178  if (nel > 0)
179  {
180  gripe_implicit_conversion ("Octave:array-to-scalar",
181  "range", "real scalar");
182 
183  retval = range.base ();
184  }
185  else
186  gripe_invalid_conversion ("range", "real scalar");
187 
188  return retval;
189 }
190 
191 float
193 {
194  float retval = lo_ieee_float_nan_value ();
195 
196  octave_idx_type nel = range.nelem ();
197 
198  if (nel > 0)
199  {
200  gripe_implicit_conversion ("Octave:array-to-scalar",
201  "range", "real scalar");
202 
203  retval = range.base ();
204  }
205  else
206  gripe_invalid_conversion ("range", "real scalar");
207 
208  return retval;
209 }
210 
213 {
214  const Matrix matrix = range.matrix_value ();
215  charNDArray retval (dims ());
216 
217  octave_idx_type nel = numel ();
218 
219  for (octave_idx_type i = 0; i < nel; i++)
220  retval.elem (i) = static_cast<char>(matrix.elem (i));
221 
222  return retval;
223 }
224 
226 octave_range::all (int dim) const
227 {
228  // FIXME: this is a potential waste of memory.
229 
230  Matrix m = range.matrix_value ();
231 
232  return m.all (dim);
233 }
234 
236 octave_range::any (int dim) const
237 {
238  // FIXME: this is a potential waste of memory.
239 
240  Matrix m = range.matrix_value ();
241 
242  return m.any (dim);
243 }
244 
247 {
248  return
249  (k == 0
251  : octave_value (range.diag (k)));
252 }
253 
256 {
257  Matrix mat = range.matrix_value ();
258 
259  return mat.diag (m, n);
260 }
261 
262 bool
264 {
265  bool retval = false;
266 
267  if (range.nelem () != 0)
268  {
269  // FIXME: this is a potential waste of memory.
270 
271  Matrix m ((range.matrix_value () . all ()) . all ());
272 
273  retval = (m.rows () == 1 && m.columns () == 1 && m (0, 0) != 0.0);
274  }
275 
276  return retval;
277 }
278 
279 Complex
281 {
282  double tmp = lo_ieee_nan_value ();
283 
284  Complex retval (tmp, tmp);
285 
286  octave_idx_type nel = range.nelem ();
287 
288  if (nel > 0)
289  {
290  gripe_implicit_conversion ("Octave:array-to-scalar",
291  "range", "complex scalar");
292 
293  retval = range.base ();
294  }
295  else
296  gripe_invalid_conversion ("range", "complex scalar");
297 
298  return retval;
299 }
300 
303 {
304  float tmp = lo_ieee_float_nan_value ();
305 
306  FloatComplex retval (tmp, tmp);
307 
308  octave_idx_type nel = range.nelem ();
309 
310  if (nel > 0)
311  {
312  gripe_implicit_conversion ("Octave:array-to-scalar",
313  "range", "complex scalar");
314 
315  retval = range.base ();
316  }
317  else
318  gripe_invalid_conversion ("range", "complex scalar");
319 
320  return retval;
321 }
322 
325 {
326  Matrix m = range.matrix_value ();
327 
328  if (m.any_element_is_nan ())
330  else if (warn && m.any_element_not_one_or_zero ())
332 
333  return boolNDArray (m);
334 }
335 
337 octave_range::resize (const dim_vector& dv, bool fill) const
338 {
339  NDArray retval = array_value ();
340  if (fill)
341  retval.resize (dv, 0);
342  else
343  retval.resize (dv);
344  return retval;
345 }
346 
348 octave_range::convert_to_str_internal (bool pad, bool force, char type) const
349 {
351  return tmp.convert_to_str (pad, force, type);
352 }
353 
354 void
355 octave_range::print (std::ostream& os, bool pr_as_read_syntax)
356 {
357  print_raw (os, pr_as_read_syntax);
358  newline (os);
359 }
360 
361 void
362 octave_range::print_raw (std::ostream& os, bool pr_as_read_syntax) const
363 {
364  octave_print_internal (os, range, pr_as_read_syntax,
366 }
367 
368 bool
369 octave_range::print_name_tag (std::ostream& os, const std::string& name) const
370 {
371  bool retval = false;
372 
373  octave_idx_type n = range.nelem ();
374 
375  indent (os);
376 
377  if (n == 0 || n == 1)
378  os << name << " = ";
379  else
380  {
381  os << name << " =";
382  newline (os);
383  if (! Vcompact_format)
384  newline (os);
385 
386  retval = true;
387  }
388 
389  return retval;
390 }
391 
392 void
393 octave_range::short_disp (std::ostream& os) const
394 {
395  octave_idx_type len = range.nelem ();
396 
397  if (len == 0)
398  os << "[]";
399  else
400  {
401  os << range.base () << ":";
402 
403  if (len > 1)
404  {
405  if (range.inc () != 1)
406  os << range.inc () << ":";
407 
408  os << range.limit ();
409  }
410  }
411 }
412 
413 // Skip white space and comments on stream IS.
414 
415 static void
416 skip_comments (std::istream& is)
417 {
418  char c = '\0';
419  while (is.get (c))
420  {
421  if (c == ' ' || c == '\t' || c == '\n')
422  ; // Skip whitespace on way to beginning of next line.
423  else
424  break;
425  }
426 
427  skip_until_newline (is, false);
428 }
429 
430 bool
431 octave_range::save_ascii (std::ostream& os)
432 {
433  Range r = range_value ();
434  double base = r.base ();
435  double limit = r.limit ();
436  double inc = r.inc ();
437  octave_idx_type len = r.nelem ();
438 
439  if (inc != 0)
440  os << "# base, limit, increment\n";
441  else
442  os << "# base, length, increment\n";
443 
444  octave_write_double (os, base);
445  os << " ";
446  if (inc != 0)
447  octave_write_double (os, limit);
448  else
449  os << len;
450  os << " ";
451  octave_write_double (os, inc);
452  os << "\n";
453 
454  return true;
455 }
456 
457 bool
458 octave_range::load_ascii (std::istream& is)
459 {
460  // # base, limit, range comment added by save ().
461  skip_comments (is);
462 
463  double base, limit, inc;
464  is >> base >> limit >> inc;
465 
466  if (!is)
467  {
468  error ("load: failed to load range constant");
469  return false;
470  }
471 
472  if (inc != 0)
473  range = Range (base, limit, inc);
474  else
475  range = Range (base, inc, static_cast<octave_idx_type> (limit));
476 
477  return true;
478 }
479 
480 bool
481 octave_range::save_binary (std::ostream& os, bool& /* save_as_floats */)
482 {
483  char tmp = LS_DOUBLE;
484  os.write (reinterpret_cast<char *> (&tmp), 1);
485  Range r = range_value ();
486  double bas = r.base ();
487  double lim = r.limit ();
488  double inc = r.inc ();
489  if (inc == 0)
490  lim = r.nelem ();
491 
492  os.write (reinterpret_cast<char *> (&bas), 8);
493  os.write (reinterpret_cast<char *> (&lim), 8);
494  os.write (reinterpret_cast<char *> (&inc), 8);
495 
496  return true;
497 }
498 
499 bool
500 octave_range::load_binary (std::istream& is, bool swap,
501  oct_mach_info::float_format /* fmt */)
502 {
503  char tmp;
504  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
505  return false;
506  double bas, lim, inc;
507  if (! is.read (reinterpret_cast<char *> (&bas), 8))
508  return false;
509  if (swap)
510  swap_bytes<8> (&bas);
511  if (! is.read (reinterpret_cast<char *> (&lim), 8))
512  return false;
513  if (swap)
514  swap_bytes<8> (&lim);
515  if (! is.read (reinterpret_cast<char *> (&inc), 8))
516  return false;
517  if (swap)
518  swap_bytes<8> (&inc);
519  if (inc != 0)
520  range = Range (bas, lim, inc);
521  else
522  range = Range (bas, inc, static_cast<octave_idx_type> (lim));
523 
524  return true;
525 }
526 
527 #if defined (HAVE_HDF5)
528 
529 // The following subroutines creates an HDF5 representation of the way
530 // we will store Octave range types (triplets of floating-point numbers).
531 // NUM_TYPE is the HDF5 numeric type to use for storage (e.g.
532 // H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary
533 // conversions are handled automatically by HDF5.
534 
535 static hid_t
536 hdf5_make_range_type (hid_t num_type)
537 {
538  hid_t type_id = H5Tcreate (H5T_COMPOUND, sizeof (double) * 3);
539 
540  H5Tinsert (type_id, "base", 0 * sizeof (double), num_type);
541  H5Tinsert (type_id, "limit", 1 * sizeof (double), num_type);
542  H5Tinsert (type_id, "increment", 2 * sizeof (double), num_type);
543 
544  return type_id;
545 }
546 
547 #endif
548 
549 bool
550 octave_range::save_hdf5 (octave_hdf5_id loc_id, const char *name,
551  bool /* save_as_floats */)
552 {
553  bool retval = false;
554 
555 #if defined (HAVE_HDF5)
556 
557  hsize_t dimens[3];
558  hid_t space_hid, type_hid, data_hid;
559  space_hid = type_hid = data_hid = -1;
560 
561  space_hid = H5Screate_simple (0, dimens, 0);
562  if (space_hid < 0) return false;
563 
564  type_hid = hdf5_make_range_type (H5T_NATIVE_DOUBLE);
565  if (type_hid < 0)
566  {
567  H5Sclose (space_hid);
568  return false;
569  }
570 #if HAVE_HDF5_18
571  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
572  H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
573 #else
574  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, H5P_DEFAULT);
575 #endif
576  if (data_hid < 0)
577  {
578  H5Sclose (space_hid);
579  H5Tclose (type_hid);
580  return false;
581  }
582 
583  Range r = range_value ();
584  double range_vals[3];
585  range_vals[0] = r.base ();
586  range_vals[1] = r.inc () != 0 ? r.limit () : r.nelem ();
587  range_vals[2] = r.inc ();
588 
589  if (H5Dwrite (data_hid, type_hid, H5S_ALL, H5S_ALL, H5P_DEFAULT,
590  range_vals) >= 0)
591  {
592  octave_idx_type nel = r.nelem ();
593  retval = hdf5_add_scalar_attr (data_hid, H5T_NATIVE_IDX,
594  "OCTAVE_RANGE_NELEM", &nel) >= 0;
595  }
596  else
597  retval = false;
598 
599  H5Dclose (data_hid);
600  H5Tclose (type_hid);
601  H5Sclose (space_hid);
602 
603 #else
604  gripe_save ("hdf5");
605 #endif
606 
607  return retval;
608 }
609 
610 bool
611 octave_range::load_hdf5 (octave_hdf5_id loc_id, const char *name)
612 {
613  bool retval = false;
614 
615 #if defined (HAVE_HDF5)
616 
617 #if HAVE_HDF5_18
618  hid_t data_hid = H5Dopen (loc_id, name, H5P_DEFAULT);
619 #else
620  hid_t data_hid = H5Dopen (loc_id, name);
621 #endif
622  hid_t type_hid = H5Dget_type (data_hid);
623 
624  hid_t range_type = hdf5_make_range_type (H5T_NATIVE_DOUBLE);
625 
626  if (! hdf5_types_compatible (type_hid, range_type))
627  {
628  H5Tclose (range_type);
629  H5Dclose (data_hid);
630  return false;
631  }
632 
633  hid_t space_hid = H5Dget_space (data_hid);
634  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
635 
636  if (rank != 0)
637  {
638  H5Tclose (range_type);
639  H5Sclose (space_hid);
640  H5Dclose (data_hid);
641  return false;
642  }
643 
644  double rangevals[3];
645  if (H5Dread (data_hid, range_type, H5S_ALL, H5S_ALL, H5P_DEFAULT,
646  rangevals) >= 0)
647  {
648  retval = true;
649  octave_idx_type nel;
650  if (hdf5_get_scalar_attr (data_hid, H5T_NATIVE_IDX,
651  "OCTAVE_RANGE_NELEM", &nel))
652  range = Range (rangevals[0], rangevals[2], nel);
653  else
654  {
655  if (rangevals[2] != 0)
656  range = Range (rangevals[0], rangevals[1], rangevals[2]);
657  else
658  range = Range (rangevals[0], rangevals[2],
659  static_cast<octave_idx_type> (rangevals[1]));
660  }
661  }
662 
663  H5Tclose (range_type);
664  H5Sclose (space_hid);
665  H5Dclose (data_hid);
666 
667 #else
668  gripe_load ("hdf5");
669 #endif
670 
671  return retval;
672 }
673 
674 mxArray *
676 {
677  mxArray *retval = new mxArray (mxDOUBLE_CLASS, dims (), mxREAL);
678 
679  double *pr = static_cast<double *> (retval->get_data ());
680 
681  mwSize nel = numel ();
682 
683  Matrix m = matrix_value ();
684 
685  const double *p = m.data ();
686 
687  for (mwSize i = 0; i < nel; i++)
688  pr[i] = p[i];
689 
690  return retval;
691 }
692 
695 {
696  return (n < range.nelem ()) ? octave_value (range.elem (n))
697  : octave_value ();
698 }
699 
700 DEFUN (allow_noninteger_range_as_index, args, nargout,
701  "-*- texinfo -*-\n\
702 @deftypefn {Built-in Function} {@var{val} =} allow_noninteger_range_as_index ()\n\
703 @deftypefnx {Built-in Function} {@var{old_val} =} allow_noninteger_range_as_index (@var{new_val})\n\
704 @deftypefnx {Built-in Function} {} allow_noninteger_range_as_index (@var{new_val}, \"local\")\n\
705 Query or set the internal variable that controls whether non-integer\n\
706 ranges are allowed as indices.\n\
707 \n\
708 This might be useful for @sc{matlab} compatibility; however, it is still not\n\
709 entirely compatible because @sc{matlab} treats the range expression\n\
710 differently in different contexts.\n\
711 \n\
712 When called from inside a function with the @qcode{\"local\"} option, the\n\
713 variable is changed locally for the function and any subroutines it calls.\n\
714 The original variable value is restored when exiting the function.\n\
715 @end deftypefn")
716 {
717  static bool warned = false;
718  if (! warned)
719  {
720  warned = true;
721  warning_with_id ("Octave:deprecated-function",
722  "allow_noninteger_range_as_index is obsolete and will be removed from a future version of Octave");
723  }
724 
725  return SET_INTERNAL_VARIABLE (allow_noninteger_range_as_index);
726 }
727 
728 /*
729 %!test
730 %! x = 0:10;
731 %! save = allow_noninteger_range_as_index ();
732 %! warn_state = warning ("query", "Octave:noninteger-range-as-index");
733 %! unwind_protect
734 %! allow_noninteger_range_as_index (false);
735 %! fail ("x(2.1:5)");
736 %! assert (x(2:5), 1:4);
737 %! allow_noninteger_range_as_index (true);
738 %! warning ("off", "Octave:noninteger-range-as-index");
739 %! assert (x(2.49:5), 1:3);
740 %! assert (x(2.5:5), 2:4);
741 %! assert (x(2.51:5), 2:4);
742 %! unwind_protect_cleanup
743 %! allow_noninteger_range_as_index (save);
744 %! warning (warn_state.state, warn_state.identifier);
745 %! end_unwind_protect
746 */
Matrix diag(octave_idx_type k=0) const
Definition: dMatrix.cc:2712
void octave_write_double(std::ostream &os, double d)
Definition: lo-utils.cc:386
type_conv_info numeric_conversion_function(void) const
Definition: ov-range.cc:64
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-range.cc:611
void gripe_implicit_conversion(const char *id, const char *from, const char *to)
Definition: gripes.cc:180
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:696
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition: ov-range.cc:348
static hid_t hdf5_make_range_type(hid_t num_type)
Definition: ov-range.cc:536
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-range.cc:97
bool hdf5_types_compatible(hid_t t1, hid_t t2)
Definition: ls-hdf5.cc:107
mxArray * as_mxArray(void) const
Definition: ov-range.cc:675
boolMatrix any(int dim=-1) const
Definition: dMatrix.cc:2670
dim_vector dims(void) const
Definition: ov-range.h:108
Range range_value(void) const
Definition: ov-range.h:247
static void skip_comments(std::istream &is)
Definition: ov-range.cc:416
void gripe_load(const char *type) const
Definition: ov-base.cc:1258
NDArray array_value(bool=false) const
Definition: ov-range.h:187
octave_idx_type length(void) const
Definition: oct-obj.h:89
octave_idx_type nelem(void) const
Definition: Range.h:64
void skip_until_newline(std::istream &is, bool keep_newline)
Range range
Definition: ov-range.h:294
Definition: Range.h:31
charNDArray char_array_value(bool=false) const
Definition: ov-range.cc:212
void swap_bytes< 8 >(void *ptr)
Definition: byte-swap.h:67
#define DEFUN(name, args_name, nargout_name, doc)
Definition: defun.h:44
void error(const char *fmt,...)
Definition: error.cc:476
octave_base_value * try_narrowing_conversion(void)
Definition: ov-range.cc:71
#define SET_INTERNAL_VARIABLE(NM)
Definition: variables.h:120
float float_value(bool=false) const
Definition: ov-range.cc:192
void indent(std::ostream &os) const
Definition: ov-base.cc:1481
bool load_ascii(std::istream &is)
Definition: ov-range.cc:458
void * get_data(void) const
Definition: mxarray.h:433
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-range.cc:481
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:164
void gripe_save(const char *type) const
Definition: ov-base.cc:1267
T & elem(octave_idx_type n)
Definition: Array.h:380
double lo_ieee_nan_value(void)
Definition: lo-ieee.cc:126
herr_t hdf5_add_scalar_attr(hid_t loc_id, hid_t type_id, const char *attr_name, void *buf)
Definition: ls-hdf5.cc:702
bool any_element_is_nan(void) const
Definition: dNDArray.cc:564
void newline(std::ostream &os) const
Definition: ov-base.cc:1500
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
Definition: ov-range.cc:56
double double_value(bool=false) const
Definition: ov-range.cc:172
bool save_ascii(std::ostream &os)
Definition: ov-range.cc:431
virtual octave_idx_type numel(void) const
Definition: ov-base.h:311
idx_vector * idx_cache
Definition: ov-range.h:308
octave_value any(int dim=0) const
Definition: ov-range.cc:236
bool any_element_not_one_or_zero(void) const
Definition: dNDArray.cc:576
bool Vcompact_format
Definition: pr-output.cc:106
OCTAVE_EMPTY_CPP_ARG std::string type_name(void) const
Definition: ov-range.h:315
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov-range.cc:124
#define CAST_CONV_ARG(t)
Definition: ops.h:83
octave_value convert_to_str(bool pad=false, bool force=false, char type= '\'') const
Definition: ov.h:1017
void short_disp(std::ostream &os) const
Definition: ov-range.cc:393
double limit(void) const
Definition: Range.h:62
octave_value fast_elem_extract(octave_idx_type n) const
Definition: ov-range.cc:694
void gripe_nan_to_logical_conversion(void)
double inc(void) const
Definition: Range.h:63
static int static_type_id(void)
Definition: ov-re-mat.h:235
const T * data(void) const
Definition: Array.h:479
int error_state
Definition: error.cc:101
Matrix diag(octave_idx_type k=0) const
Definition: Range.cc:294
Matrix matrix_value(bool=false) const
Definition: ov-range.h:181
void resize(const dim_vector &dv, const T &rfv)
Definition: Array.cc:1033
double elem(octave_idx_type i) const
Definition: Range.cc:105
bool hdf5_get_scalar_attr(hid_t loc_id, hid_t type_id, const char *attr_name, void *buf)
Definition: ls-hdf5.cc:173
#define panic_impossible()
Definition: error.h:33
Matrix matrix_value(void) const
Definition: Range.cc:52
bool print_name_tag(std::ostream &os, const std::string &name) const
Definition: ov-range.cc:369
Definition: dMatrix.h:35
boolNDArray bool_array_value(bool warn=false) const
Definition: ov-range.cc:324
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:202
void mxArray
Definition: mex.h:53
friend class octave_value
Definition: ov-base.h:206
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-range.cc:550
bool is_true(void) const
Definition: ov-range.cc:263
Array< double > index(const idx_vector &i) const
Definition: Range.cc:157
#define H5T_NATIVE_IDX
Definition: ls-hdf5.h:209
void gripe_logical_conversion(void)
Definition: gripes.cc:201
void gripe_invalid_conversion(const std::string &from, const std::string &to)
Definition: gripes.cc:99
boolMatrix all(int dim=-1) const
Definition: dMatrix.cc:2664
int current_print_indent_level(void) const
Definition: ov-base.h:805
bool load_binary(std::istream &is, bool swap, oct_mach_info::float_format fmt)
Definition: ov-range.cc:500
void octave_print_internal(std::ostream &, char, bool)
Definition: pr-output.cc:1715
bool is_scalar(void) const
Definition: idx-vector.h:578
void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov-range.cc:355
bool all_elements_are_ints(void) const
Definition: Range.cc:40
idx_vector index_vector(bool require_integers=false) const
Definition: ov-range.cc:151
static bool Vallow_noninteger_range_as_index
Definition: ov-range.cc:50
double base(void) const
Definition: Range.h:61
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition: ov-range.cc:337
std::complex< float > FloatComplex
Definition: oct-cmplx.h:30
Definition: mxarray.h:52
std::complex< double > Complex
Definition: oct-cmplx.h:29
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-range.cc:362
FloatComplex float_complex_value(bool=false) const
Definition: ov-range.cc:302
octave_value diag(octave_idx_type k=0) const
Definition: ov-range.cc:246
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
Definition: ov.cc:1317
Complex complex_value(bool=false) const
Definition: ov-range.cc:280
octave_value all(int dim=0) const
Definition: ov-range.cc:226
idx_vector set_idx_cache(const idx_vector &idx) const
Definition: ov-range.h:296
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov.h:438