GNU Octave  4.4.1
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-range.cc
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 1996-2018 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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Octave is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 <https://www.gnu.org/licenses/>.
20 
21 */
22 
23 #if defined (HAVE_CONFIG_H)
24 # include "config.h"
25 #endif
26 
27 #include <iostream>
28 
29 #include "dNDArray.h"
30 #include "fNDArray.h"
31 #include "int8NDArray.h"
32 #include "int16NDArray.h"
33 #include "int32NDArray.h"
34 #include "int64NDArray.h"
35 #include "uint8NDArray.h"
36 #include "uint16NDArray.h"
37 #include "uint32NDArray.h"
38 #include "uint64NDArray.h"
39 
40 #include "lo-ieee.h"
41 #include "lo-utils.h"
42 
43 #include "defun.h"
44 #include "variables.h"
45 #include "errwarn.h"
46 #include "mxarray.h"
47 #include "ops.h"
48 #include "ovl.h"
49 #include "oct-hdf5.h"
50 #include "ov-range.h"
51 #include "ov-re-mat.h"
52 #include "ov-scalar.h"
53 #include "pr-output.h"
54 
55 #include "byte-swap.h"
56 #include "ls-ascii-helper.h"
57 #include "ls-hdf5.h"
58 #include "ls-utils.h"
59 
60 
62 
63 static octave_base_value *
65 {
66  const octave_range& v = dynamic_cast<const octave_range&> (a);
67 
68  return new octave_matrix (v.matrix_value ());
69 }
70 
73 {
76 }
77 
80 {
81  octave_base_value *retval = nullptr;
82 
83  switch (range.numel ())
84  {
85  case 1:
86  retval = new octave_scalar (range.base ());
87  break;
88 
89  case 0:
90  retval = new octave_matrix (Matrix (1, 0));
91  break;
92 
93  case -2:
95  break;
96 
97  default:
98  break;
99  }
100 
101  return retval;
102 }
103 
106  const std::list<octave_value_list>& idx)
107 {
109 
110  switch (type[0])
111  {
112  case '(':
113  retval = do_index_op (idx.front ());
114  break;
115 
116  case '{':
117  case '.':
118  {
119  std::string nm = type_name ();
120  error ("%s cannot be indexed with %c", nm.c_str (), type[0]);
121  }
122  break;
123 
124  default:
125  panic_impossible ();
126  }
127 
128  return retval.next_subsref (type, idx);
129 }
130 
132 octave_range::do_index_op (const octave_value_list& idx, bool resize_ok)
133 {
134  if (idx.length () == 1 && ! resize_ok)
135  {
137 
138  // The range can handle a single subscript.
139 
140  try
141  {
142  idx_vector i = idx(0).index_vector ();
143 
144  if (i.is_scalar () && i(0) < range.numel ())
145  retval = range.elem (i(0));
146  else
147  retval = range.index (i);
148  }
149  catch (octave::index_exception& e)
150  {
151  // More info may be added later before displaying error.
152 
153  e.set_pos_if_unset (1, 1);
154  throw;
155  }
156 
157  return retval;
158  }
159  else
160  {
162 
163  return tmp.do_index_op (idx, resize_ok);
164  }
165 }
166 
168 octave_range::index_vector (bool require_integers) const
169 {
170  if (idx_cache)
171  return *idx_cache;
172  else
173  {
174  if (require_integers || range.all_elements_are_ints ())
175  return set_idx_cache (idx_vector (range));
176  else
177  {
178  warning_with_id ("Octave:noninteger-range-as-index",
179  "non-integer range used as index");
180 
181  return octave_value (matrix_value ()).round ().index_vector ();
182  }
183  }
184 }
185 
186 double
188 {
189  octave_idx_type nel = range.numel ();
190 
191  if (nel == 0)
192  err_invalid_conversion ("range", "real scalar");
193 
194  warn_implicit_conversion ("Octave:array-to-scalar",
195  "range", "real scalar");
196 
197  return range.base ();
198 }
199 
200 float
202 {
203  octave_idx_type nel = range.numel ();
204 
205  if (nel == 0)
206  err_invalid_conversion ("range", "real scalar");
207 
208  warn_implicit_conversion ("Octave:array-to-scalar",
209  "range", "real scalar");
210 
211  return range.base ();
212 }
213 
216 {
217  const Matrix matrix = range.matrix_value ();
218  charNDArray retval (dims ());
219 
220  octave_idx_type nel = numel ();
221 
222  for (octave_idx_type i = 0; i < nel; i++)
223  retval.elem (i) = static_cast<char>(matrix.elem (i));
224 
225  return retval;
226 }
227 
229 octave_range::all (int dim) const
230 {
231  // FIXME: this is a potential waste of memory.
232 
233  Matrix m = range.matrix_value ();
234 
235  return m.all (dim);
236 }
237 
239 octave_range::any (int dim) const
240 {
241  // FIXME: this is a potential waste of memory.
242 
243  Matrix m = range.matrix_value ();
244 
245  return m.any (dim);
246 }
247 
250 {
251  return
252  (k == 0
254  : octave_value (range.diag (k)));
255 }
256 
259 {
260  Matrix mat = range.matrix_value ();
261 
262  return mat.diag (m, n);
263 }
264 
265 // Return true if this range has all true elements (non-zero, not NaN/NA).
266 // A range cannot have NaN/NA.
267 bool
269 {
270  bool retval = false;
271 
272  if (! range.isempty ())
273  {
274  if (dims ().numel () > 1)
276 
277  Range r = range_value ();
278  double base = r.base ();
279  double limit = r.limit ();
280 
281  // Can't be zero if we start and finish on the same size of 0
282  if (((base > 0 && limit > 0) || (base < 0 && limit < 0)) && numel () > 0)
283  retval = true;
284  else
285  {
286  /*
287  // This tells us whether one element is 0, if arithmetic is exact.
288  double steps_to_zero = base / r.inc ();
289 
290  retval = (steps_to_zero != floor (steps_to_zero));
291  */
292 
293  // FIXME: this is a waste of memory.
294  Matrix m ((range.matrix_value ().all ()).all ());
295 
296  retval = ! m.isempty () && m(0, 0) != 0.0;
297  }
298  }
299 
300  return retval;
301 }
302 
303 Complex
305 {
306  octave_idx_type nel = range.numel ();
307 
308  if (nel == 0)
309  err_invalid_conversion ("range", "complex scalar");
310 
311  warn_implicit_conversion ("Octave:array-to-scalar",
312  "range", "complex scalar");
313 
314  return Complex (range.base (), 0);
315 }
316 
319 {
320  float tmp = lo_ieee_float_nan_value ();
321 
323 
324  octave_idx_type nel = range.numel ();
325 
326  if (nel == 0)
327  err_invalid_conversion ("range", "complex scalar");
328 
329  warn_implicit_conversion ("Octave:array-to-scalar",
330  "range", "complex scalar");
331 
332  retval = range.base ();
333 
334  return retval;
335 }
336 
339 {
340  Matrix m = range.matrix_value ();
341 
342  if (m.any_element_is_nan ())
344  if (warn && m.any_element_not_one_or_zero ())
346 
347  return boolNDArray (m);
348 }
349 
351 octave_range::resize (const dim_vector& dv, bool fill) const
352 {
354  if (fill)
355  retval.resize (dv, 0);
356  else
357  retval.resize (dv);
358  return retval;
359 }
360 
362 octave_range::convert_to_str_internal (bool pad, bool force, char type) const
363 {
365  return tmp.convert_to_str (pad, force, type);
366 }
367 
370 {
371  return range;
372 }
373 
376 {
377  return FloatMatrix (range.matrix_value ());
378 }
379 
382 {
383  return int8NDArray (range.matrix_value ());
384 }
385 
388 {
389  return int16NDArray (range.matrix_value ());
390 }
391 
394 {
395  return int32NDArray (range.matrix_value ());
396 }
397 
400 {
401  return int64NDArray (range.matrix_value ());
402 }
403 
406 {
407  return uint8NDArray (range.matrix_value ());
408 }
409 
412 {
413  return uint16NDArray (range.matrix_value ());
414 }
415 
418 {
419  return uint32NDArray (range.matrix_value ());
420 }
421 
424 {
425  return uint64NDArray (range.matrix_value ());
426 }
427 
428 void
429 octave_range::print (std::ostream& os, bool pr_as_read_syntax)
430 {
431  print_raw (os, pr_as_read_syntax);
432  newline (os);
433 }
434 
435 void
436 octave_range::print_raw (std::ostream& os, bool pr_as_read_syntax) const
437 {
438  octave_print_internal (os, range, pr_as_read_syntax,
440 }
441 
442 bool
443 octave_range::print_name_tag (std::ostream& os, const std::string& name) const
444 {
445  bool retval = false;
446 
447  octave_idx_type n = range.numel ();
448 
449  indent (os);
450 
451  if (n == 0 || n == 1)
452  os << name << " = ";
453  else
454  {
455  os << name << " =";
456  newline (os);
457  if (! Vcompact_format)
458  newline (os);
459 
460  retval = true;
461  }
462 
463  return retval;
464 }
465 
466 void
467 octave_range::short_disp (std::ostream& os) const
468 {
469  octave_idx_type len = range.numel ();
470 
471  if (len == 0)
472  os << "[]";
473  else
474  {
475  os << range.base () << ':';
476 
477  if (len > 1)
478  {
479  if (range.inc () != 1)
480  os << range.inc () << ':';
481 
482  os << range.limit ();
483  }
484  }
485 }
486 
487 // Skip white space and comments on stream IS.
488 
489 static void
490 skip_comments (std::istream& is)
491 {
492  char c = '\0';
493  while (is.get (c))
494  {
495  if (c == ' ' || c == '\t' || c == '\n')
496  ; // Skip whitespace on way to beginning of next line.
497  else
498  break;
499  }
500 
501  skip_until_newline (is, false);
502 }
503 
506 {
507  return make_format (range_value ());
508 }
509 
513 {
514  std::ostringstream buf;
515  octave_print_internal (buf, fmt, range.elem (j));
516  return buf.str ();
517 }
518 
519 bool
521 {
522  Range r = range_value ();
523  double base = r.base ();
524  double limit = r.limit ();
525  double inc = r.inc ();
526  octave_idx_type len = r.numel ();
527 
528  if (inc != 0)
529  os << "# base, limit, increment\n";
530  else
531  os << "# base, length, increment\n";
532 
533  octave_write_double (os, base);
534  os << ' ';
535  if (inc != 0)
536  octave_write_double (os, limit);
537  else
538  os << len;
539  os << ' ';
540  octave_write_double (os, inc);
541  os << "\n";
542 
543  return true;
544 }
545 
546 bool
548 {
549  // # base, limit, range comment added by save ().
550  skip_comments (is);
551 
552  double base, limit, inc;
553  is >> base >> limit >> inc;
554 
555  if (! is)
556  error ("load: failed to load range constant");
557 
558  if (inc != 0)
559  range = Range (base, limit, inc);
560  else
561  range = Range (base, inc, static_cast<octave_idx_type> (limit));
562 
563  return true;
564 }
565 
566 bool
567 octave_range::save_binary (std::ostream& os, bool& /* save_as_floats */)
568 {
569  char tmp = LS_DOUBLE;
570  os.write (reinterpret_cast<char *> (&tmp), 1);
571  Range r = range_value ();
572  double bas = r.base ();
573  double lim = r.limit ();
574  double inc = r.inc ();
575  if (inc == 0)
576  lim = r.numel ();
577 
578  os.write (reinterpret_cast<char *> (&bas), 8);
579  os.write (reinterpret_cast<char *> (&lim), 8);
580  os.write (reinterpret_cast<char *> (&inc), 8);
581 
582  return true;
583 }
584 
585 bool
586 octave_range::load_binary (std::istream& is, bool swap,
588 {
589  char tmp;
590  if (! is.read (reinterpret_cast<char *> (&tmp), 1))
591  return false;
592  double bas, lim, inc;
593  if (! is.read (reinterpret_cast<char *> (&bas), 8))
594  return false;
595  if (swap)
596  swap_bytes<8> (&bas);
597  if (! is.read (reinterpret_cast<char *> (&lim), 8))
598  return false;
599  if (swap)
600  swap_bytes<8> (&lim);
601  if (! is.read (reinterpret_cast<char *> (&inc), 8))
602  return false;
603  if (swap)
604  swap_bytes<8> (&inc);
605  if (inc != 0)
606  range = Range (bas, lim, inc);
607  else
608  range = Range (bas, inc, static_cast<octave_idx_type> (lim));
609 
610  return true;
611 }
612 
613 #if defined (HAVE_HDF5)
614 
615 // The following subroutines creates an HDF5 representation of the way
616 // we will store Octave range types (triplets of floating-point numbers).
617 // NUM_TYPE is the HDF5 numeric type to use for storage (e.g.
618 // H5T_NATIVE_DOUBLE to save as 'double'). Note that any necessary
619 // conversions are handled automatically by HDF5.
620 
621 static hid_t
622 hdf5_make_range_type (hid_t num_type)
623 {
624  hid_t type_id = H5Tcreate (H5T_COMPOUND, sizeof (double) * 3);
625 
626  H5Tinsert (type_id, "base", 0 * sizeof (double), num_type);
627  H5Tinsert (type_id, "limit", 1 * sizeof (double), num_type);
628  H5Tinsert (type_id, "increment", 2 * sizeof (double), num_type);
629 
630  return type_id;
631 }
632 
633 #endif
634 
635 bool
637  bool /* save_as_floats */)
638 {
639  bool retval = false;
640 
641 #if defined (HAVE_HDF5)
642 
643  hsize_t dimens[3];
644  hid_t space_hid, type_hid, data_hid;
645  space_hid = type_hid = data_hid = -1;
646 
647  space_hid = H5Screate_simple (0, dimens, nullptr);
648  if (space_hid < 0) return false;
649 
650  type_hid = hdf5_make_range_type (H5T_NATIVE_DOUBLE);
651  if (type_hid < 0)
652  {
653  H5Sclose (space_hid);
654  return false;
655  }
656 #if defined (HAVE_HDF5_18)
657  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid,
659 #else
660  data_hid = H5Dcreate (loc_id, name, type_hid, space_hid, octave_H5P_DEFAULT);
661 #endif
662  if (data_hid < 0)
663  {
664  H5Sclose (space_hid);
665  H5Tclose (type_hid);
666  return false;
667  }
668 
669  Range r = range_value ();
670  double range_vals[3];
671  range_vals[0] = r.base ();
672  range_vals[1] = (r.inc () != 0 ? r.limit () : r.numel ());
673  range_vals[2] = r.inc ();
674 
675  if (H5Dwrite (data_hid, type_hid, octave_H5S_ALL, octave_H5S_ALL,
676  octave_H5P_DEFAULT, range_vals)
677  >= 0)
678  {
679  octave_idx_type nel = r.numel ();
681  "OCTAVE_RANGE_NELEM", &nel) >= 0;
682  }
683  else
684  retval = false;
685 
686  H5Dclose (data_hid);
687  H5Tclose (type_hid);
688  H5Sclose (space_hid);
689 
690 #else
691  octave_unused_parameter (loc_id);
692  octave_unused_parameter (name);
693 
694  warn_save ("hdf5");
695 #endif
696 
697  return retval;
698 }
699 
700 bool
702 {
703  bool retval = false;
704 
705 #if defined (HAVE_HDF5)
706 
707 #if defined (HAVE_HDF5_18)
708  hid_t data_hid = H5Dopen (loc_id, name, octave_H5P_DEFAULT);
709 #else
710  hid_t data_hid = H5Dopen (loc_id, name);
711 #endif
712  hid_t type_hid = H5Dget_type (data_hid);
713 
714  hid_t range_type = hdf5_make_range_type (H5T_NATIVE_DOUBLE);
715 
716  if (! hdf5_types_compatible (type_hid, range_type))
717  {
718  H5Tclose (range_type);
719  H5Dclose (data_hid);
720  return false;
721  }
722 
723  hid_t space_hid = H5Dget_space (data_hid);
724  hsize_t rank = H5Sget_simple_extent_ndims (space_hid);
725 
726  if (rank != 0)
727  {
728  H5Tclose (range_type);
729  H5Sclose (space_hid);
730  H5Dclose (data_hid);
731  return false;
732  }
733 
734  double rangevals[3];
735  if (H5Dread (data_hid, range_type, octave_H5S_ALL, octave_H5S_ALL,
736  octave_H5P_DEFAULT, rangevals)
737  >= 0)
738  {
739  retval = true;
740  octave_idx_type nel;
741  if (hdf5_get_scalar_attr (data_hid, H5T_NATIVE_IDX,
742  "OCTAVE_RANGE_NELEM", &nel))
743  range = Range (rangevals[0], rangevals[2], nel);
744  else
745  {
746  if (rangevals[2] != 0)
747  range = Range (rangevals[0], rangevals[1], rangevals[2]);
748  else
749  range = Range (rangevals[0], rangevals[2],
750  static_cast<octave_idx_type> (rangevals[1]));
751  }
752  }
753 
754  H5Tclose (range_type);
755  H5Sclose (space_hid);
756  H5Dclose (data_hid);
757 
758 #else
759  octave_unused_parameter (loc_id);
760  octave_unused_parameter (name);
761 
762  warn_load ("hdf5");
763 #endif
764 
765  return retval;
766 }
767 
768 mxArray *
770 {
772 
773  double *pr = static_cast<double *> (retval->get_data ());
774 
775  mwSize nel = numel ();
776 
777  Matrix m = matrix_value ();
778 
779  const double *p = m.data ();
780 
781  for (mwSize i = 0; i < nel; i++)
782  pr[i] = p[i];
783 
784  return retval;
785 }
786 
789 {
790  return (n < range.numel ()) ? octave_value (range.elem (n))
791  : octave_value ();
792 }
octave_idx_type write(const octave_value &data, octave_idx_type block_size, oct_data_conv::data_type output_type, octave_idx_type skip, mach_info::float_format flt_fmt)
Definition: oct-stream.cc:6704
void octave_write_double(std::ostream &os, double d)
Definition: lo-utils.cc:395
bool load_hdf5(octave_hdf5_id loc_id, const char *name)
Definition: ov-range.cc:701
void warning_with_id(const char *id, const char *fmt,...)
Definition: error.cc:816
static hid_t hdf5_make_range_type(hid_t num_type)
Definition: ov-range.cc:622
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-range.cc:105
octave_hdf5_err hdf5_add_scalar_attr(octave_hdf5_id loc_id, octave_hdf5_id type_id, const char *attr_name, void *buf)
Definition: ls-hdf5.cc:853
Matrix diag(octave_idx_type k=0) const
Definition: Range.cc:290
charNDArray char_array_value(bool=false) const
Definition: ov-range.cc:215
intNDArray< octave_int64 > int64NDArray
Definition: int64NDArray.h:33
characters Given a string matrix
Definition: hex2num.cc:155
bool isempty(void) const
Definition: ov.h:529
OCTAVE_IDX_TYPE mwSize
Definition: mxarray.in.h:93
Matrix matrix_value(bool=false) const
Definition: ov-range.h:182
const T * data(void) const
Definition: Array.h:582
FloatComplex float_complex_value(bool=false) const
Definition: ov-range.cc:318
void short_disp(std::ostream &os) const
Definition: ov-range.cc:467
static void skip_comments(std::istream &is)
Definition: ov-range.cc:490
void warn_logical_conversion(void)
Definition: errwarn.cc:359
int current_print_indent_level(void) const
Definition: ov-base.h:849
bool all_elements_are_ints(void) const
Definition: Range.cc:39
const octave_hdf5_id octave_H5S_ALL
intNDArray< octave_uint32 > uint32NDArray
Definition: uint32NDArray.h:33
void newline(std::ostream &os) const
Definition: ov-base.cc:1328
intNDArray< octave_uint8 > uint8NDArray
Definition: uint8NDArray.h:33
bool is_true(void) const
Definition: ov-range.cc:268
void print_raw(std::ostream &os, bool pr_as_read_syntax=false) const
Definition: ov-range.cc:436
intNDArray< octave_uint16 > uint16NDArray
Definition: uint16NDArray.h:33
void skip_until_newline(std::istream &is, bool keep_newline)
octave_value as_double(void) const
Definition: ov-range.cc:369
for large enough k
Definition: lu.cc:617
idx_vector index_vector(bool require_integers=false) const
Definition: ov-range.cc:168
Range range
Definition: ov-range.h:313
Definition: Range.h:33
void swap_bytes< 8 >(void *ptr)
Definition: byte-swap.h:68
void error(const char *fmt,...)
Definition: error.cc:578
octave_base_value * try_narrowing_conversion(void)
Definition: ov-range.cc:79
bool load_ascii(std::istream &is)
Definition: ov-range.cc:547
bool save_binary(std::ostream &os, bool &save_as_floats)
Definition: ov-range.cc:567
#define DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA(t, n, c)
Definition: ov-base.h:180
octave_value as_uint8(void) const
Definition: ov-range.cc:405
intNDArray< octave_int16 > int16NDArray
Definition: int16NDArray.h:33
double double_value(bool=false) const
Definition: ov-range.cc:187
nd example oindent opens the file binary numeric values will be read assuming they are stored in IEEE format with the least significant bit and then converted to the native representation Opening a file that is already open simply opens it again and returns a separate file id It is not an error to open a file several though writing to the same file through several different file ids may produce unexpected results The possible values of text mode reading and writing automatically converts linefeeds to the appropriate line end character for the you may append a you must also open the file in binary mode The parameter conversions are currently only supported for and permissions will be set to and then everything is written in a single operation This is very efficient and improves performance c
Definition: file-io.cc:587
std::string type_name(void) const
Definition: ov-range.h:333
void err_nan_to_logical_conversion(void)
i e
Definition: data.cc:2591
Range range_value(void) const
Definition: ov-range.h:248
static octave_base_value * default_numeric_conversion_function(const octave_base_value &a)
Definition: ov-range.cc:64
octave_value as_uint64(void) const
Definition: ov-range.cc:423
octave_value all(int dim=0) const
Definition: ov-range.cc:229
bool hdf5_get_scalar_attr(octave_hdf5_id loc_id, octave_hdf5_id type_id, const char *attr_name, void *buf)
Definition: ls-hdf5.cc:268
double limit(void) const
Definition: Range.h:79
float float_value(bool=false) const
Definition: ov-range.cc:201
void warn_load(const char *type) const
Definition: ov-base.cc:1097
bool save_ascii(std::ostream &os)
Definition: ov-range.cc:520
double base(void) const
Definition: Range.h:78
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition: ov.h:511
boolMatrix all(int dim=-1) const
Definition: dMatrix.cc:2535
idx_vector * idx_cache
Definition: ov-range.h:327
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:400
bool swap
Definition: load-save.cc:738
octave_value fast_elem_extract(octave_idx_type n) const
Definition: ov-range.cc:788
octave_value any(int dim=0) const
Definition: ov-range.cc:239
Array< double > index(const idx_vector &i) const
Definition: Range.cc:166
bool Vcompact_format
Definition: pr-output.cc:99
Complex complex_value(bool=false) const
Definition: ov-range.cc:304
void octave_print_internal(std::ostream &os, const float_display_format &fmt, bool d, bool pr_as_read_syntax)
Definition: pr-output.cc:1780
mxArray * as_mxArray(void) const
Definition: ov-range.cc:769
nd deftypefn *std::string name
Definition: sysdep.cc:647
Matrix diag(octave_idx_type k=0) const
Definition: dMatrix.cc:2583
OCTAVE_EXPORT octave_value_list isdir nd deftypefn *std::string nm
Definition: utils.cc:975
octave_value do_index_op(const octave_value_list &idx, bool resize_ok=false)
Definition: ov-range.cc:132
intNDArray< octave_int8 > int8NDArray
Definition: int8NDArray.h:33
boolNDArray bool_array_value(bool warn=false) const
Definition: ov-range.cc:338
bool hdf5_types_compatible(octave_hdf5_id t1, octave_hdf5_id t2)
Definition: ls-hdf5.cc:190
octave_value as_uint32(void) const
Definition: ov-range.cc:417
static int static_type_id(void)
Definition: ov-re-mat.h:248
bool load_binary(std::istream &is, bool swap, octave::mach_info::float_format fmt)
Definition: ov-range.cc:586
Matrix matrix_value(void) const
Definition: Range.cc:84
octave_idx_type numel(void) const
Definition: Range.h:85
double tmp
Definition: data.cc:6252
octave_value retval
Definition: data.cc:6246
idx_vector set_idx_cache(const idx_vector &idx) const
Definition: ov-range.h:315
#define panic_impossible()
Definition: error.h:40
int64_t octave_hdf5_id
virtual octave_idx_type numel(void) const
Definition: ov-base.h:333
void warn_save(const char *type) const
Definition: ov-base.cc:1106
idx type
Definition: ov.cc:3114
double elem(octave_idx_type i) const
Definition: Range.cc:131
Definition: dMatrix.h:36
boolMatrix any(int dim=-1) const
Definition: dMatrix.cc:2541
float lo_ieee_float_nan_value(void)
Definition: lo-ieee.cc:123
void mxArray
Definition: mex.h:55
void indent(std::ostream &os) const
Definition: ov-base.cc:1309
friend class octave_value
Definition: ov-base.h:228
octave_value as_uint16(void) const
Definition: ov-range.cc:411
bool save_hdf5(octave_hdf5_id loc_id, const char *name, bool save_as_floats)
Definition: ov-range.cc:636
octave_value diag(octave_idx_type k=0) const
Definition: ov-range.cc:249
intNDArray< octave_int32 > int32NDArray
Definition: int32NDArray.h:33
void err_invalid_conversion(const std::string &from, const std::string &to)
Definition: errwarn.cc:68
octave_value as_int32(void) const
Definition: ov-range.cc:393
dim_vector dims(void) const
Definition: ov-range.h:108
float_display_format make_format(const double &d)
Definition: pr-output.cc:591
octave_idx_type numel(int n=0) const
Number of elements that a matrix with this dimensions would have.
Definition: dim-vector.h:362
octave_value as_int64(void) const
Definition: ov-range.cc:399
octave_value as_int16(void) const
Definition: ov-range.cc:387
bool any_element_not_one_or_zero(void) const
Definition: dNDArray.cc:565
p
Definition: lu.cc:138
octave_value convert_to_str_internal(bool pad, bool force, char type) const
Definition: ov-range.cc:362
octave_value resize(const dim_vector &dv, bool fill=false) const
Definition: ov-range.cc:351
NDArray array_value(bool=false) const
Definition: ov-range.h:188
void warn_implicit_conversion(const char *id, const char *from, const char *to)
Definition: errwarn.cc:338
float_display_format get_edit_display_format(void) const
Definition: ov-range.cc:505
void print(std::ostream &os, bool pr_as_read_syntax=false)
Definition: ov-range.cc:429
octave_value as_single(void) const
Definition: ov-range.cc:375
octave_idx_type length(void) const
Definition: ovl.h:96
#define H5T_NATIVE_IDX
Definition: oct-hdf5.h:39
for i
Definition: data.cc:5264
void warn_array_as_logical(const dim_vector &dv)
Definition: errwarn.cc:282
const octave_hdf5_id octave_H5P_DEFAULT
std::complex< float > FloatComplex
Definition: oct-cmplx.h:32
std::complex< double > Complex
Definition: oct-cmplx.h:31
std::string edit_display(const float_display_format &fmt, octave_idx_type i, octave_idx_type j) const
Definition: ov-range.cc:511
type_conv_info numeric_conversion_function(void) const
Definition: ov-range.cc:72
write the output to stdout if nargout is
Definition: load-save.cc:1612
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:888
bool isempty(void) const
Definition: Range.h:92
dim_vector dv
Definition: sub2ind.cc:263
octave_value as_int8(void) const
Definition: ov-range.cc:381
octave_value next_subsref(const std::string &type, const std::list< octave_value_list > &idx, size_t skip=1)
octave::stream os
Definition: file-io.cc:627
bool any_element_is_nan(void) const
Definition: dNDArray.cc:553
bool print_name_tag(std::ostream &os, const std::string &name) const
Definition: ov-range.cc:443
intNDArray< octave_uint64 > uint64NDArray
Definition: uint64NDArray.h:33
double inc(void) const
Definition: Range.h:80